Matrix package:matrix

Matrix datatype and operations. Every provided example has been tested. Run cabal test for further tests.
Type of matrices. Elements can be of any type. Rows and columns are indexed starting by 1. This means that, if m :: Matrix a and i,j :: Int, then m ! (i,j) is the element in the i-th row and j-th column of m.
A native implementation of matrix operations. Matrix library. Basic operations and some algorithms. . Usage examples are included in the API reference generated by Haddock. . If you want to use GSL, BLAS and LAPACK, hmatrix (http://hackage.haskell.org/package/hmatrix) is the way to go.
O(rows*cols). Generate a matrix from a generator function. Example of usage:
(  1  0 -1 -2 )
(  3  2  1  0 )
(  5  4  3  2 )
matrix 4 4 $ \(i,j) -> 2*i - j = (  7  6  5  4 )
O(rows*cols). Similar to force. It copies the matrix content dropping any extra memory. Useful when using submatrix from a big matrix.
O(rows*cols). Transform a Matrix to a Vector of size rows*cols. This is equivalent to get all the rows of the matrix using getRow and then append them, but far more efficient.
O(rows*cols). Remove a row and a column from a matrix. Example:
( 1 2 3 )
( 4 5 6 )   ( 1 3 )
minorMatrix 2 2 ( 7 8 9 ) = ( 7 9 )
O(rows*cols). Permutation matrix.
permMatrix n i j =
i     j       n
1 ( 1 0 ... 0 ... 0 ... 0 0 )
2 ( 0 1 ... 0 ... 0 ... 0 0 )
(     ...   ...   ...     )
i ( 0 0 ... 0 ... 1 ... 0 0 )
(     ...   ...   ...     )
j ( 0 0 ... 1 ... 0 ... 0 0 )
(     ...   ...   ...     )
( 0 0 ... 0 ... 0 ... 1 0 )
n ( 0 0 ... 0 ... 0 ... 0 1 )
When i == j it reduces to identity n.
Display a matrix as a String using the Show instance of its elements.
Scale a matrix by a given factor. Example:
( 1 2 3 )   (  2  4  6 )
( 4 5 6 )   (  8 10 12 )
scaleMatrix 2 ( 7 8 9 ) = ( 14 16 18 )
O(1). Extract a submatrix given row and column limits. Example:
( 1 2 3 )
( 4 5 6 )   ( 2 3 )
submatrix 1 2 2 3 ( 7 8 9 ) = ( 5 6 )