Matrix package:hmatrix

Matrix representation suitable for BLAS/LAPACK computations.
Create a real matrix.
>>> matrix 5 [1..15]
(3><5)
[  1.0,  2.0,  3.0,  4.0,  5.0
,  6.0,  7.0,  8.0,  9.0, 10.0
, 11.0, 12.0, 13.0, 14.0, 15.0 ]
Numeric Linear Algebra Linear systems, matrix decompositions, and other numerical computations based on BLAS and LAPACK. Standard interface: Numeric.LinearAlgebra. Safer interface with statically checked dimensions: Numeric.LinearAlgebra.Static. Code examples: http://dis.um.es/~alberto/hmatrix/hmatrix.html
General matrix with specialized internal representations for dense, sparse, diagonal, banded, and constant elements.
>>> let m = mkSparse [((0,999),1.0),((1,1999),2.0)]

>>> m
SparseR {gmCSR = CSR {csrVals = fromList [1.0,2.0],
csrCols = fromList [1000,2000],
csrRows = fromList [1,2,3],
csrNRows = 2,
csrNCols = 2000},
nRows = 2,
nCols = 2000}
>>> let m = mkDense (mat 2 [1..4])

>>> m
Dense {gmDense = (2><2)
[ 1.0, 2.0
, 3.0, 4.0 ], nRows = 2, nCols = 2}
load a matrix from an ASCII file formatted as a 2D table.
save a matrix as a 2D ASCII table
reference to a rectangular slice of a matrix (no data copy)
application of a vector function on the flattened matrix elements
application of a vector function on the flattened matrices elements
A version of liftMatrix2 which automatically adapt matrices with a single row or column to match the dimensions of the other matrix.
>>> mapMatrixWithIndex (\(i,j) v -> 100*v + 10*fromIntegral i + fromIntegral j) (ident 3:: Matrix Double)
(3><3)
[ 100.0,   1.0,   2.0
,  10.0, 111.0,  12.0
,  20.0,  21.0, 122.0 ]
>>> mapMatrixWithIndexM (\(i,j) v -> Just $ 100*v + 10*fromIntegral i + fromIntegral j) (ident 3:: Matrix Double)
Just (3><3)
[ 100.0,   1.0,   2.0
,  10.0, 111.0,  12.0
,  20.0,  21.0, 122.0 ]
>>> mapMatrixWithIndexM_ (\(i,j) v -> printf "m[%d,%d] = %.f\n" i j v :: IO()) ((2><3)[1 :: Double ..])
m[0,0] = 1
m[0,1] = 2
m[0,2] = 3
m[1,0] = 4
m[1,1] = 5
m[1,2] = 6