Copyright | (c) Andrew Lelechenko, 2014-2015 |
---|---|
License | GPL-3 |
Maintainer | andrew.lelechenko@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe-Inferred |
Language | Haskell98 |
Provides types and functions for matrices and vectors of order 3. Can be used instead of Data.Matrix to reduce overhead and simplify code.
Documentation
Matrix of order 3. Instances of Num
, Fractional
and Monoid
are defined in terms of the multiplicative group of matrices,
not the additive one. E. g.,
toList 1 == [1,0,0,0,1,0,0,0,1] toList 1 /= [1,1,1,1,1,1,1,1,1]
Three-component vector.
multCol :: Num t => Matrix3 t -> Vector3 t -> Vector3 t Source
Multiplicate a matrix by a vector (considered as a column).
normalize :: Integral t => Matrix3 t -> Matrix3 t Source
Divide all elements of the matrix by their greatest common divisor. This is useful for matrices of projective transformations to reduce the magnitude of computations.
prettyMatrix :: Show t => Matrix3 t -> String Source
Print a matrix, separating rows with new lines and elements with spaces.