linear-1.21.3: Linear Algebra

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

Linear.Quaternion

Description

Quaternions

Synopsis

Documentation

data Quaternion a Source #

Quaternions

Constructors

Quaternion !a !(V3 a) 
Instances
Monad Quaternion Source # 
Instance details

Defined in Linear.Quaternion

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 # 
Instance details

Defined in Linear.Quaternion

Methods

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

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

MonadFix Quaternion Source # 
Instance details

Defined in Linear.Quaternion

Methods

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

Applicative Quaternion Source # 
Instance details

Defined in Linear.Quaternion

Methods

pure :: a -> Quaternion a #

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

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

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

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

Foldable Quaternion Source # 
Instance details

Defined in Linear.Quaternion

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 # 
Instance details

Defined in Linear.Quaternion

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) #

Distributive Quaternion Source # 
Instance details

Defined in Linear.Quaternion

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 # 
Instance details

Defined in Linear.Quaternion

Associated Types

type Rep Quaternion :: Type #

Methods

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

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

Eq1 Quaternion Source # 
Instance details

Defined in Linear.Quaternion

Methods

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

Ord1 Quaternion Source # 
Instance details

Defined in Linear.Quaternion

Methods

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

Read1 Quaternion Source # 
Instance details

Defined in Linear.Quaternion

Show1 Quaternion Source # 
Instance details

Defined in Linear.Quaternion

Methods

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

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

MonadZip Quaternion Source # 
Instance details

Defined in Linear.Quaternion

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 # 
Instance details

Defined in Linear.Quaternion

Methods

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

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

Hashable1 Quaternion Source # 
Instance details

Defined in Linear.Quaternion

Methods

liftHashWithSalt :: (Int -> a -> Int) -> Int -> Quaternion a -> Int #

Apply Quaternion Source # 
Instance details

Defined in Linear.Quaternion

Methods

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

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

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

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

Bind Quaternion Source # 
Instance details

Defined in Linear.Quaternion

Methods

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

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

Additive Quaternion Source # 
Instance details

Defined in Linear.Quaternion

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 # 
Instance details

Defined in Linear.Quaternion

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 # 
Instance details

Defined in Linear.Quaternion

Associated Types

type Size Quaternion :: Nat Source #

R1 Quaternion Source # 
Instance details

Defined in Linear.Quaternion

Methods

_x :: Lens' (Quaternion a) a Source #

R2 Quaternion Source # 
Instance details

Defined in Linear.Quaternion

Methods

_y :: Lens' (Quaternion a) a Source #

_xy :: Lens' (Quaternion a) (V2 a) Source #

R3 Quaternion Source # 
Instance details

Defined in Linear.Quaternion

Methods

_z :: Lens' (Quaternion a) a Source #

_xyz :: Lens' (Quaternion a) (V3 a) Source #

R4 Quaternion Source # 
Instance details

Defined in Linear.Quaternion

Methods

_w :: Lens' (Quaternion a) a Source #

_xyzw :: Lens' (Quaternion a) (V4 a) Source #

Hamiltonian Quaternion Source # 
Instance details

Defined in Linear.Quaternion

Complicated Quaternion Source # 
Instance details

Defined in Linear.Quaternion

Methods

_e :: Lens' (Quaternion a) a Source #

_i :: Lens' (Quaternion a) a Source #

Trace Quaternion Source # 
Instance details

Defined in Linear.Trace

Affine Quaternion Source # 
Instance details

Defined in Linear.Affine

Associated Types

type Diff Quaternion :: Type -> Type Source #

Unbox a => Vector Vector (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

Unbox a => MVector MVector (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

(Num r, TrivialConjugate r) => Coalgebra r (E Quaternion) Source # 
Instance details

Defined in Linear.Algebra

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 # 
Instance details

Defined in Linear.Algebra

Methods

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

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

Eq a => Eq (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

Methods

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

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

RealFloat a => Floating (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

RealFloat a => Fractional (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

Data a => Data (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

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 # 
Instance details

Defined in Linear.Quaternion

Ord a => Ord (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

Read a => Read (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

Show a => Show (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

Ix a => Ix (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

Generic (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

Associated Types

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

Methods

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

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

Semigroup a => Semigroup (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

Monoid a => Monoid (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

Lift a => Lift (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

Methods

lift :: Quaternion a -> Q Exp #

Storable a => Storable (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

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 # 
Instance details

Defined in Linear.Quaternion

Methods

put :: Quaternion a -> Put #

get :: Get (Quaternion a) #

putList :: [Quaternion a] -> Put #

Serial a => Serial (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

Methods

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

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

Serialize a => Serialize (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

Methods

put :: Putter (Quaternion a) #

get :: Get (Quaternion a) #

NFData a => NFData (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

Methods

rnf :: Quaternion a -> () #

Hashable a => Hashable (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

Methods

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

hash :: Quaternion a -> Int #

Unbox a => Unbox (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

Ixed (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

Random a => Random (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

Methods

randomR :: RandomGen g => (Quaternion a, Quaternion a) -> g -> (Quaternion a, g) #

random :: RandomGen g => g -> (Quaternion a, g) #

randomRs :: RandomGen g => (Quaternion a, Quaternion a) -> g -> [Quaternion a] #

randoms :: RandomGen g => g -> [Quaternion a] #

(Conjugate a, RealFloat a) => Conjugate (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

(RealFloat a, Epsilon a) => Epsilon (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

Generic1 Quaternion Source # 
Instance details

Defined in Linear.Quaternion

Associated Types

type Rep1 Quaternion :: k -> Type #

FunctorWithIndex (E Quaternion) Quaternion Source # 
Instance details

Defined in Linear.Quaternion

Methods

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

imapped :: IndexedSetter (E Quaternion) (Quaternion a) (Quaternion b) a b #

FoldableWithIndex (E Quaternion) Quaternion Source # 
Instance details

Defined in Linear.Quaternion

Methods

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

ifolded :: IndexedFold (E Quaternion) (Quaternion a) 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 # 
Instance details

Defined in Linear.Quaternion

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

Defined in Linear.Quaternion

Methods

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

Field1 (Quaternion a) (Quaternion a) a a Source # 
Instance details

Defined in Linear.Quaternion

Methods

_1 :: Lens (Quaternion a) (Quaternion a) a a #

Field2 (Quaternion a) (Quaternion a) a a Source # 
Instance details

Defined in Linear.Quaternion

Methods

_2 :: Lens (Quaternion a) (Quaternion a) a a #

Field3 (Quaternion a) (Quaternion a) a a Source # 
Instance details

Defined in Linear.Quaternion

Methods

_3 :: Lens (Quaternion a) (Quaternion a) a a #

Field4 (Quaternion a) (Quaternion a) a a Source # 
Instance details

Defined in Linear.Quaternion

Methods

_4 :: Lens (Quaternion a) (Quaternion a) a a #

type Rep Quaternion Source # 
Instance details

Defined in Linear.Quaternion

type Size Quaternion Source # 
Instance details

Defined in Linear.Quaternion

type Size Quaternion = 4
type Diff Quaternion Source # 
Instance details

Defined in Linear.Affine

data MVector s (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

type Rep (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

type Rep (Quaternion a) = D1 (MetaData "Quaternion" "Linear.Quaternion" "linear-1.21.3-4VKk0ANeJOgJLRUVoSPnwE" False) (C1 (MetaCons "Quaternion" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 a) :*: S1 (MetaSel (Nothing :: Maybe Symbol) SourceUnpack SourceStrict DecidedStrict) (Rec0 (V3 a))))
data Vector (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

type Index (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

type IxValue (Quaternion a) Source # 
Instance details

Defined in Linear.Quaternion

type IxValue (Quaternion a) = a
type Rep1 Quaternion Source # 
Instance details

Defined in Linear.Quaternion

type Rep1 Quaternion = D1 (MetaData "Quaternion" "Linear.Quaternion" "linear-1.21.3-4VKk0ANeJOgJLRUVoSPnwE" False) (C1 (MetaCons "Quaternion" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) Par1 :*: S1 (MetaSel (Nothing :: Maybe Symbol) SourceUnpack SourceStrict DecidedStrict) (Rec1 V3)))

class Complicated t where Source #

A vector space that includes the basis elements _e and _i

Methods

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

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

Instances
Complicated Complex Source # 
Instance details

Defined in Linear.Quaternion

Methods

_e :: Lens' (Complex a) a Source #

_i :: Lens' (Complex a) a Source #

Complicated Quaternion Source # 
Instance details

Defined in Linear.Quaternion

Methods

_e :: Lens' (Quaternion a) a Source #

_i :: Lens' (Quaternion a) a Source #

class Complicated t => Hamiltonian t where Source #

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

Methods

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

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

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

Instances
Hamiltonian Quaternion Source # 
Instance details

Defined in Linear.Quaternion

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.