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



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



freezeMatrix :: Storable a => Matrix a -> Data [[a]]Source

Converts a matrix to a core array.

unfreezeMatrix :: Storable a => Data Length -> Data Length -> Data [[a]] -> Matrix aSource

Converts a core array to a matrix. The first length argument is the number of rows (outer vector), and the second argument is the number of columns (inner argument).

matrix :: Storable a => [[a]] -> Matrix aSource

Constructs a matrix. The elements are stored in a core array.

transpose :: Matrix a -> Matrix aSource

Transpose of a matrix

mul :: Numeric a => Matrix a -> Matrix a -> Matrix aSource

Matrix multiplication

flatten :: Matrix a -> Vector (Data a)Source

Concatenates the rows of a matrix.

diagonal :: Matrix a -> Vector (Data a)Source

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).