Portability | portable |
---|---|
Stability | experimental |
Maintainer | lennart...schmitt@<nospam>gmail.com |
This module implements a list of matrixes and a few functions to handle them.
- type MatrixList a = [Matrix a]
- type RawMatrixList a = [[[a]]]
- toLists :: Element a => MatrixList a -> RawMatrixList a
- countMatrixElements :: RawMatrixList a -> RawMatrix Double
- countMatrixes :: RawMatrixList a -> Double
- countMatrixesCols :: RawMatrixList a -> Double
- averages :: RawMatrixList Double -> RawMatrix Double
- crossProduct :: RawMatrixList Double -> RawMatrix Double
- mapVectors :: ([a] -> [b]) -> RawMatrixList a -> RawMatrixList b
- foldVectors :: ([a] -> b) -> RawMatrixList a -> RawMatrix b
- mapElements :: (a -> b) -> RawMatrixList a -> RawMatrixList b
- transposeAll :: RawMatrixList a -> RawMatrixList a
- countRows :: RawMatrixList a -> RawVector Double
- countAllRows :: RawMatrixList a -> Double
Data Types
type MatrixList a = [Matrix a]Source
A list of matrixes
type RawMatrixList a = [[[a]]]Source
A list of matrixes represented as a list of lists of lists
Functions
toLists :: Element a => MatrixList a -> RawMatrixList aSource
Transforms a Matrixlist to a RawMatrixList.
countMatrixes :: RawMatrixList a -> DoubleSource
Counts the number of matrixes in a list of matrixes
countMatrixesCols :: RawMatrixList a -> DoubleSource
Counts the number of cols (based on the guess that all matrixes have the similare structure)
averages :: RawMatrixList Double -> RawMatrix DoubleSource
Calculate every cols averages
averages [[[1,2],[2,1]],[[2,3],[3,4]]] == [[1.5,1.5],[2.5,3.5]]
crossProduct :: RawMatrixList Double -> RawMatrix DoubleSource
Calculates the cross-product of every matrix-cols
crossProduct [[[1,2],[2,1]],[[2,3],[3,4]]] == [[2.0,2.0],[6.0,12.0]]
mapVectors :: ([a] -> [b]) -> RawMatrixList a -> RawMatrixList bSource
maps a function over every vector of a list of matrixes
mapVectors (map (1+)) [[[1,2],[2,1]],[[2,3],[3,4]]] == [[[2.0,3.0],[3.0,2.0]],[[3.0,4.0],[4.0,5.0]]]
foldVectors :: ([a] -> b) -> RawMatrixList a -> RawMatrix bSource
folds every vector of a list of matrixes
foldVectors sum [[[1,2],[2,1]],[[2,3],[3,4]]] == [[[2.0,3.0],[3.0,2.0]],[[3.0,4.0],[4.0,5.0]]]
mapElements :: (a -> b) -> RawMatrixList a -> RawMatrixList bSource
maps a function over every element of a list of matrixes
mapElements (1+) [[[1,2],[2,1]],[[2,3],[3,4]]] == [[[2.0,3.0],[3.0,2.0]],[[3.0,4.0],[4.0,5.0]]]
transposeAll :: RawMatrixList a -> RawMatrixList aSource
Transposes every matrix in a lit of matrixes
countRows :: RawMatrixList a -> RawVector DoubleSource
Counts the rows of every matrix in the list
countRows [[[1,2],[2,1]],[[2,3],[3,4],[1,1]]] == [2.0,3.0]
countAllRows :: RawMatrixList a -> DoubleSource
Counts the sum of all matrixes-rows
countAllRows [[[1,2],[2,1]],[[2,3],[3,4],[1,1]]] == 5.0