feldspar-language-0.1: A functional embedded language for DSP and parallelism

Feldspar.Matrix

Description

Operations on matrices (nested parallel vectors). All operations in this module assume rectangular matrices.

Synopsis

Documentation

type Matrix m n a = Par m :>> (Par n :>> Data a)Source

freezeMatrix :: (NaturalT m, NaturalT n, Storable a) => Matrix m n a -> Data (m :> (n :> a))Source

Converts a matrix to a core array.

unfreezeMatrix :: (NaturalT m, NaturalT n, Storable a) => Data Int -> Data Int -> Data (m :> (n :> a)) -> Matrix m n aSource

Converts a core array to a matrix.

matrix :: (NaturalT m, NaturalT n, Storable a, ListBased a ~ a) => [[a]] -> Matrix m n aSource

Constructs a matrix.

transpose :: Matrix m n a -> Matrix n m aSource

Transpose of a matrix

mul :: (Primitive a, Num a) => Matrix m n a -> Matrix n p a -> Matrix m p aSource

Matrix multiplication

flatten :: Matrix m n a -> VectorP (m :* n) aSource

Concatenates the rows of a matrix.

diagonal :: Matrix n n a -> VectorP n aSource

The diagonal vector of a square matrix. It happens to work if the number of rows is less than the number of columns, but not the other way around (this would require some overhead).