linear-0.5: Linear Algebra

Portabilitynon-portable
Stabilityexperimental
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellNone

Linear.Matrix

Description

Simple matrix operation for low-dimensional primitives.

Synopsis

Documentation

(!*!) :: (Functor m, Foldable r, Applicative r, Distributive n, Num a) => m (r a) -> r (n a) -> m (n a)Source

matrix product

(!*) :: (Functor m, Metric r, Num a) => m (r a) -> r a -> m aSource

matrix * column vector

(*!) :: (Metric r, Distributive n, Num a) => r a -> r (n a) -> n aSource

row vector * matrix

(!!*) :: (Functor m, Functor r, Num a) => m (r a) -> a -> m (r a)Source

Matrix-scalar product.

(*!!) :: (Functor m, Functor r, Num a) => a -> m (r a) -> m (r a)Source

Scalar-matrix product.

adjoint :: (Functor m, Distributive n, Conjugate a) => m (n a) -> n (m a)Source

hermitian conjugate or conjugate transpose

type M22 a = V2 (V2 a)Source

Matrices use a row-major representation.

type M33 a = V3 (V3 a)Source

type M44 a = V4 (V4 a)Source

type M43 a = V4 (V3 a)Source

m33_to_m44 :: Num a => M33 a -> M44 aSource

m43_to_m44 :: Num a => M43 a -> M44 aSource

det22 :: Num a => V2 (V2 a) -> aSource

2x2 matrix determinant.

det33 :: Num a => V3 (V3 a) -> aSource

3x3 matrix determinant.

inv22 :: (Epsilon a, Floating a) => M22 a -> Maybe (M22 a)Source

2x2 matrix inverse.

inv33 :: (Epsilon a, Floating a) => M33 a -> Maybe (M33 a)Source

3x3 matrix inverse.

eye3 :: Num a => M33 aSource

3x3 identity matrix.

eye4 :: Num a => M44 aSource

4x4 identity matrix.

trace :: (Monad f, Foldable f, Num a) => f (f a) -> aSource

Compute the trace of a matrix

translation :: (R3 t, R4 v, Functor f, Functor t) => (V3 a -> f (V3 a)) -> t (v a) -> f (t a)Source

Extract the translation vector (first three entries of the last column) from a 3x4 or 4x4 matrix

fromQuaternion :: Num a => Quaternion a -> M33 aSource

Build a rotation matrix from a unit Quaternion.

mkTransformation :: Num a => Quaternion a -> V3 a -> M44 aSource

Build a transformation matrix from a rotation expressed as a Quaternion and a translation vector.