linear-1.20.7: Linear Algebra

Copyright(C) 2012-2015 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellTrustworthy
LanguageHaskell98

Linear.Quaternion

Description

Quaternions

Synopsis

Documentation

data Quaternion a Source #

Quaternions

Constructors

Quaternion !a !(V3 a) 

Instances

Monad Quaternion Source # 

Methods

(>>=) :: Quaternion a -> (a -> Quaternion b) -> Quaternion b #

(>>) :: Quaternion a -> Quaternion b -> Quaternion b #

return :: a -> Quaternion a #

fail :: String -> Quaternion a #

Functor Quaternion Source # 

Methods

fmap :: (a -> b) -> Quaternion a -> Quaternion b #

(<$) :: a -> Quaternion b -> Quaternion a #

MonadFix Quaternion Source # 

Methods

mfix :: (a -> Quaternion a) -> Quaternion a #

Applicative Quaternion Source # 

Methods

pure :: a -> Quaternion a #

(<*>) :: Quaternion (a -> b) -> Quaternion a -> Quaternion b #

(*>) :: Quaternion a -> Quaternion b -> Quaternion b #

(<*) :: Quaternion a -> Quaternion b -> Quaternion a #

Foldable Quaternion Source # 

Methods

fold :: Monoid m => Quaternion m -> m #

foldMap :: Monoid m => (a -> m) -> Quaternion a -> m #

foldr :: (a -> b -> b) -> b -> Quaternion a -> b #

foldr' :: (a -> b -> b) -> b -> Quaternion a -> b #

foldl :: (b -> a -> b) -> b -> Quaternion a -> b #

foldl' :: (b -> a -> b) -> b -> Quaternion a -> b #

foldr1 :: (a -> a -> a) -> Quaternion a -> a #

foldl1 :: (a -> a -> a) -> Quaternion a -> a #

toList :: Quaternion a -> [a] #

null :: Quaternion a -> Bool #

length :: Quaternion a -> Int #

elem :: Eq a => a -> Quaternion a -> Bool #

maximum :: Ord a => Quaternion a -> a #

minimum :: Ord a => Quaternion a -> a #

sum :: Num a => Quaternion a -> a #

product :: Num a => Quaternion a -> a #

Traversable Quaternion Source # 

Methods

traverse :: Applicative f => (a -> f b) -> Quaternion a -> f (Quaternion b) #

sequenceA :: Applicative f => Quaternion (f a) -> f (Quaternion a) #

mapM :: Monad m => (a -> m b) -> Quaternion a -> m (Quaternion b) #

sequence :: Monad m => Quaternion (m a) -> m (Quaternion a) #

Generic1 Quaternion Source # 

Associated Types

type Rep1 (Quaternion :: * -> *) :: * -> * #

Distributive Quaternion Source # 

Methods

distribute :: Functor f => f (Quaternion a) -> Quaternion (f a) #

collect :: Functor f => (a -> Quaternion b) -> f a -> Quaternion (f b) #

distributeM :: Monad m => m (Quaternion a) -> Quaternion (m a) #

collectM :: Monad m => (a -> Quaternion b) -> m a -> Quaternion (m b) #

Representable Quaternion Source # 

Associated Types

type Rep (Quaternion :: * -> *) :: * #

Methods

tabulate :: (Rep Quaternion -> a) -> Quaternion a #

index :: Quaternion a -> Rep Quaternion -> a #

Eq1 Quaternion Source # 

Methods

liftEq :: (a -> b -> Bool) -> Quaternion a -> Quaternion b -> Bool #

Ord1 Quaternion Source # 

Methods

liftCompare :: (a -> b -> Ordering) -> Quaternion a -> Quaternion b -> Ordering #

Read1 Quaternion Source # 

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Quaternion a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Quaternion a] #

Show1 Quaternion Source # 

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Quaternion a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Quaternion a] -> ShowS #

MonadZip Quaternion Source # 

Methods

mzip :: Quaternion a -> Quaternion b -> Quaternion (a, b) #

mzipWith :: (a -> b -> c) -> Quaternion a -> Quaternion b -> Quaternion c #

munzip :: Quaternion (a, b) -> (Quaternion a, Quaternion b) #

Serial1 Quaternion Source # 

Methods

serializeWith :: MonadPut m => (a -> m ()) -> Quaternion a -> m () #

deserializeWith :: MonadGet m => m a -> m (Quaternion a) #

Apply Quaternion Source # 

Methods

(<.>) :: Quaternion (a -> b) -> Quaternion a -> Quaternion b #

(.>) :: Quaternion a -> Quaternion b -> Quaternion b #

(<.) :: Quaternion a -> Quaternion b -> Quaternion a #

Bind Quaternion Source # 

Methods

(>>-) :: Quaternion a -> (a -> Quaternion b) -> Quaternion b #

join :: Quaternion (Quaternion a) -> Quaternion a #

Additive Quaternion Source # 

Methods

zero :: Num a => Quaternion a Source #

(^+^) :: Num a => Quaternion a -> Quaternion a -> Quaternion a Source #

(^-^) :: Num a => Quaternion a -> Quaternion a -> Quaternion a Source #

lerp :: Num a => a -> Quaternion a -> Quaternion a -> Quaternion a Source #

liftU2 :: (a -> a -> a) -> Quaternion a -> Quaternion a -> Quaternion a Source #

liftI2 :: (a -> b -> c) -> Quaternion a -> Quaternion b -> Quaternion c Source #

Metric Quaternion Source # 

Methods

dot :: Num a => Quaternion a -> Quaternion a -> a Source #

quadrance :: Num a => Quaternion a -> a Source #

qd :: Num a => Quaternion a -> Quaternion a -> a Source #

distance :: Floating a => Quaternion a -> Quaternion a -> a Source #

norm :: Floating a => Quaternion a -> a Source #

signorm :: Floating a => Quaternion a -> Quaternion a Source #

Finite Quaternion Source # 

Associated Types

type Size (Quaternion :: * -> *) :: Nat Source #

Hamiltonian Quaternion Source # 

Methods

_j :: Functor f => (a -> f a) -> Quaternion a -> f (Quaternion a) Source #

_k :: Functor f => (a -> f a) -> Quaternion a -> f (Quaternion a) Source #

_ijk :: Functor f => (V3 a -> f (V3 a)) -> Quaternion a -> f (Quaternion a) Source #

Complicated Quaternion Source # 

Methods

_e :: Functor f => (a -> f a) -> Quaternion a -> f (Quaternion a) Source #

_i :: Functor f => (a -> f a) -> Quaternion a -> f (Quaternion a) Source #

Trace Quaternion Source # 
Affine Quaternion Source # 

Associated Types

type Diff (Quaternion :: * -> *) :: * -> * Source #

Unbox a => Vector Vector (Quaternion a) Source # 
Unbox a => MVector MVector (Quaternion a) Source # 
(Num r, TrivialConjugate r) => Coalgebra r (E Quaternion) Source # 

Methods

comult :: (E Quaternion -> r) -> E Quaternion -> E Quaternion -> r Source #

counital :: (E Quaternion -> r) -> r Source #

(Num r, TrivialConjugate r) => Algebra r (E Quaternion) Source # 

Methods

mult :: (E Quaternion -> E Quaternion -> r) -> E Quaternion -> r Source #

unital :: r -> E Quaternion -> r Source #

Eq a => Eq (Quaternion a) Source # 

Methods

(==) :: Quaternion a -> Quaternion a -> Bool #

(/=) :: Quaternion a -> Quaternion a -> Bool #

RealFloat a => Floating (Quaternion a) Source # 
RealFloat a => Fractional (Quaternion a) Source # 
Data a => Data (Quaternion a) Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Quaternion a -> c (Quaternion a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Quaternion a) #

toConstr :: Quaternion a -> Constr #

dataTypeOf :: Quaternion a -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (Quaternion a)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Quaternion a)) #

gmapT :: (forall b. Data b => b -> b) -> Quaternion a -> Quaternion a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Quaternion a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Quaternion a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Quaternion a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Quaternion a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Quaternion a -> m (Quaternion a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Quaternion a -> m (Quaternion a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Quaternion a -> m (Quaternion a) #

RealFloat a => Num (Quaternion a) Source # 
Ord a => Ord (Quaternion a) Source # 
Read a => Read (Quaternion a) Source # 
Show a => Show (Quaternion a) Source # 
Ix a => Ix (Quaternion a) Source # 
Generic (Quaternion a) Source # 

Associated Types

type Rep (Quaternion a) :: * -> * #

Methods

from :: Quaternion a -> Rep (Quaternion a) x #

to :: Rep (Quaternion a) x -> Quaternion a #

Storable a => Storable (Quaternion a) Source # 

Methods

sizeOf :: Quaternion a -> Int #

alignment :: Quaternion a -> Int #

peekElemOff :: Ptr (Quaternion a) -> Int -> IO (Quaternion a) #

pokeElemOff :: Ptr (Quaternion a) -> Int -> Quaternion a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (Quaternion a) #

pokeByteOff :: Ptr b -> Int -> Quaternion a -> IO () #

peek :: Ptr (Quaternion a) -> IO (Quaternion a) #

poke :: Ptr (Quaternion a) -> Quaternion a -> IO () #

Binary a => Binary (Quaternion a) Source # 

Methods

put :: Quaternion a -> Put #

get :: Get (Quaternion a) #

putList :: [Quaternion a] -> Put #

Serial a => Serial (Quaternion a) Source # 

Methods

serialize :: MonadPut m => Quaternion a -> m () #

deserialize :: MonadGet m => m (Quaternion a) #

Serialize a => Serialize (Quaternion a) Source # 

Methods

put :: Putter (Quaternion a) #

get :: Get (Quaternion a) #

NFData a => NFData (Quaternion a) Source # 

Methods

rnf :: Quaternion a -> () #

Hashable a => Hashable (Quaternion a) Source # 

Methods

hashWithSalt :: Int -> Quaternion a -> Int #

hash :: Quaternion a -> Int #

Unbox a => Unbox (Quaternion a) Source # 
Ixed (Quaternion a) Source # 
(RealFloat a, Epsilon a) => Epsilon (Quaternion a) Source # 
(Conjugate a, RealFloat a) => Conjugate (Quaternion a) Source # 
FunctorWithIndex (E Quaternion) Quaternion Source # 

Methods

imap :: (E Quaternion -> a -> b) -> Quaternion a -> Quaternion b #

imapped :: (Indexable (E Quaternion) p, Settable f) => p a (f b) -> Quaternion a -> f (Quaternion b) #

FoldableWithIndex (E Quaternion) Quaternion Source # 

Methods

ifoldMap :: Monoid m => (E Quaternion -> a -> m) -> Quaternion a -> m #

ifolded :: (Indexable (E Quaternion) p, Contravariant f, Applicative f) => p a (f a) -> Quaternion a -> f (Quaternion a) #

ifoldr :: (E Quaternion -> a -> b -> b) -> b -> Quaternion a -> b #

ifoldl :: (E Quaternion -> b -> a -> b) -> b -> Quaternion a -> b #

ifoldr' :: (E Quaternion -> a -> b -> b) -> b -> Quaternion a -> b #

ifoldl' :: (E Quaternion -> b -> a -> b) -> b -> Quaternion a -> b #

TraversableWithIndex (E Quaternion) Quaternion Source # 

Methods

itraverse :: Applicative f => (E Quaternion -> a -> f b) -> Quaternion a -> f (Quaternion b) #

itraversed :: (Indexable (E Quaternion) p, Applicative f) => p a (f b) -> Quaternion a -> f (Quaternion b) #

Each (Quaternion a) (Quaternion b) a b Source # 

Methods

each :: Traversal (Quaternion a) (Quaternion b) a b #

type Rep1 Quaternion Source # 
type Rep1 Quaternion = D1 (MetaData "Quaternion" "Linear.Quaternion" "linear-1.20.7-5lThnmKUFiyAbTBcmo6MON" False) (C1 (MetaCons "Quaternion" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) Par1) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedUnpack) (Rec1 V3))))
type Rep Quaternion Source # 
type Size Quaternion Source # 
type Size Quaternion = 4
type Diff Quaternion Source # 
data MVector s (Quaternion a) Source # 
type Rep (Quaternion a) Source # 
type Rep (Quaternion a) = D1 (MetaData "Quaternion" "Linear.Quaternion" "linear-1.20.7-5lThnmKUFiyAbTBcmo6MON" False) (C1 (MetaCons "Quaternion" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 a)) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedUnpack) (Rec0 (V3 a)))))
data Vector (Quaternion a) Source # 
type Index (Quaternion a) Source # 
type IxValue (Quaternion a) Source # 
type IxValue (Quaternion a) = a

class Complicated t where Source #

A vector space that includes the basis elements _e and _i

Methods

_e, _i :: Lens' (t a) a Source #

Instances

Complicated Complex Source # 

Methods

_e :: Functor f => (a -> f a) -> Complex a -> f (Complex a) Source #

_i :: Functor f => (a -> f a) -> Complex a -> f (Complex a) Source #

Complicated Quaternion Source # 

Methods

_e :: Functor f => (a -> f a) -> Quaternion a -> f (Quaternion a) Source #

_i :: Functor f => (a -> f a) -> Quaternion a -> f (Quaternion a) Source #

class Complicated t => Hamiltonian t where Source #

A vector space that includes the basis elements _e, _i, _j and _k

Methods

_j, _k :: Lens' (t a) a Source #

_ijk :: Lens' (t a) (V3 a) Source #

Instances

Hamiltonian Quaternion Source # 

Methods

_j :: Functor f => (a -> f a) -> Quaternion a -> f (Quaternion a) Source #

_k :: Functor f => (a -> f a) -> Quaternion a -> f (Quaternion a) Source #

_ijk :: Functor f => (V3 a -> f (V3 a)) -> Quaternion a -> f (Quaternion a) Source #

ee :: Complicated t => E t Source #

ei :: Complicated t => E t Source #

ej :: Hamiltonian t => E t Source #

ek :: Hamiltonian t => E t Source #

slerp :: RealFloat a => Quaternion a -> Quaternion a -> a -> Quaternion a Source #

Spherical linear interpolation between two quaternions.

asinq :: RealFloat a => Quaternion a -> Quaternion a -> Quaternion a Source #

asin with a specified branch cut.

acosq :: RealFloat a => Quaternion a -> Quaternion a -> Quaternion a Source #

acos with a specified branch cut.

atanq :: RealFloat a => Quaternion a -> Quaternion a -> Quaternion a Source #

atan with a specified branch cut.

asinhq :: RealFloat a => Quaternion a -> Quaternion a -> Quaternion a Source #

asinh with a specified branch cut.

acoshq :: RealFloat a => Quaternion a -> Quaternion a -> Quaternion a Source #

acosh with a specified branch cut.

atanhq :: RealFloat a => Quaternion a -> Quaternion a -> Quaternion a Source #

atanh with a specified branch cut.

absi :: Floating a => Quaternion a -> a Source #

norm of the imaginary component

pow :: RealFloat a => Quaternion a -> a -> Quaternion a Source #

raise a Quaternion to a scalar power

rotate :: (Conjugate a, RealFloat a) => Quaternion a -> V3 a -> V3 a Source #

Apply a rotation to a vector.

axisAngle :: (Epsilon a, Floating a) => V3 a -> a -> Quaternion a Source #

axisAngle axis theta builds a Quaternion representing a rotation of theta radians about axis.