NumericPrelude-0.0: An experimental alternative hierarchy of numeric type classesContentsIndex
MathObj.Matrix
Portabilityrequires multi-parameter type classes
Stabilityprovisional
Maintainermik@math.uni-jena.de
Description
Routines and abstractions for Matrices and basic linear algebra over fields or rings.
Synopsis
data T a = Cons (Array (Integer, Integer) a)
twist :: (Integer, Integer) -> (Integer, Integer)
transpose :: T a -> T a
rows :: T a -> [[a]]
columns :: T a -> [[a]]
fromList :: Integer -> Integer -> [a] -> T a
dimension :: T a -> (Integer, Integer)
numRows :: T a -> Integer
numColumns :: T a -> Integer
zipWith :: (a -> b -> c) -> T a -> T b -> T c
zeroMatrix :: C a => Integer -> Integer -> T a
preimage :: C a => T a -> T a -> Maybe (T a)
Documentation
data T a
A matrix is a twodimensional array of ring elements, indexed by integers.
Constructors
Cons (Array (Integer, Integer) a)
show/hide Instances
C T
Functor T
C a b => C a (T b)
C a => C (T a)
C a => C (T a)
??? a => Eq (T a)
??? a => Ord (T a)
??? a => Read (T a)
(C a, Show a) => Show (T a)
twist :: (Integer, Integer) -> (Integer, Integer)
Transposition of matrices is just transposition in the sense of Data.List.
transpose :: T a -> T a
rows :: T a -> [[a]]
columns :: T a -> [[a]]
fromList :: Integer -> Integer -> [a] -> T a
dimension :: T a -> (Integer, Integer)
numRows :: T a -> Integer
numColumns :: T a -> Integer
zipWith :: (a -> b -> c) -> T a -> T b -> T c
zeroMatrix :: C a => Integer -> Integer -> T a
preimage :: C a => T a -> T a -> Maybe (T a)

What more do we need from our matrix class? We have addition, subtraction and multiplication, and thus composition of generic free-module-maps. We're going to want to solve linear equations with or without fields underneath, so we're going to want an implementation of the Gaussian algorithm as well as most probably Smith normal form. Determinants are cool, and these are to be calculated either with the Gaussian algorithm or some other goodish method.

We'll want generic linear equation solving, returning one solution, any solution really, or nothing. Basically, this is asking for the preimage of a given vector over the given map, so

a_11 x_1 + .. + a_1n x_n = y_1 ... a_m1 x_1 + .. + a_mn a_n = y_m

has really x_1,...,x_n as a preimage of the vector y_1,..,y_m under the map (a_ij), since obviously y_1,..,y_m = (a_ij) x_1,..,x_n

So, generic linear equation solving boils down to the function

Produced by Haddock version 0.7