MathObj.Matrix
 Portability requires multi-parameter type classes Stability provisional Maintainer numericprelude@henning-thielemann.de
Description

Routines and abstractions for Matrices and basic linear algebra over fields or rings.

We stick to simple Int indices. Although advanced indices would be nice e.g. for matrices with sub-matrices, this is not easily implemented since arrays do only support a lower and an upper bound but no additional parameters.

ToDo: - Matrix inverse, determinant

Synopsis
 data T a type Dimension = Int format :: Show a => T a -> String transpose :: T a -> T a rows :: T a -> [[a]] columns :: T a -> [[a]] fromRows :: Dimension -> Dimension -> [[a]] -> T a fromColumns :: Dimension -> Dimension -> [[a]] -> T a fromList :: Dimension -> Dimension -> [a] -> T a dimension :: T a -> (Dimension, Dimension) numRows :: T a -> Dimension numColumns :: T a -> Dimension zipWith :: (a -> b -> c) -> T a -> T b -> T c zero :: C a => Dimension -> Dimension -> T a one :: C a => Dimension -> T a diagonal :: C a => [a] -> T a scale :: C a => a -> T a -> T a random :: (RandomGen g, Random a) => Dimension -> Dimension -> g -> (T a, g) randomR :: (RandomGen g, Random a) => Dimension -> Dimension -> (a, a) -> g -> (T a, g)
Documentation
 data T a Source
A matrix is a twodimensional array, indexed by integers. Instances
 Functor T C T C a b => C a (T b) Eq a => Eq (T a) Ord a => Ord (T a) Read a => Read (T a) Show a => Show (T a) C a => C (T a) C a => C (T a)
 type Dimension = Int Source
 format :: Show a => T a -> String Source
 transpose :: T a -> T a Source
Transposition of matrices is just transposition in the sense of Data.List.
 rows :: T a -> [[a]] Source
 columns :: T a -> [[a]] Source
 fromRows :: Dimension -> Dimension -> [[a]] -> T a Source
 fromColumns :: Dimension -> Dimension -> [[a]] -> T a Source
 fromList :: Dimension -> Dimension -> [a] -> T a Source
 dimension :: T a -> (Dimension, Dimension) Source
 numRows :: T a -> Dimension Source
 numColumns :: T a -> Dimension Source
 zipWith :: (a -> b -> c) -> T a -> T b -> T c Source
 zero :: C a => Dimension -> Dimension -> T a Source
 one :: C a => Dimension -> T a Source
 diagonal :: C a => [a] -> T a Source
 scale :: C a => a -> T a -> T a Source
 random :: (RandomGen g, Random a) => Dimension -> Dimension -> g -> (T a, g) Source
 randomR :: (RandomGen g, Random a) => Dimension -> Dimension -> (a, a) -> g -> (T a, g) Source