blas-0.7: Bindings to the BLAS library

Stabilityexperimental
MaintainerPatrick Perry <patperry@stanford.edu>

Data.Matrix.Class.IMatrix

Contents

Description

An overloaded interface for immutable matrices. The matrices provide access to rows and columns, and can operate via multiplication on immutable dense vectors and matrices.

Synopsis

The IMatrix type class

class (MatrixShaped a, BLAS3 e) => IMatrix a e Source

A type class for immutable matrices. The member functions of the type class do not perform any checks on the validity of shapes or indices, so in general their safe counterparts should be preferred.

Instances

Rows and columns

row :: IMatrix a e => a (m, n) e -> Int -> Vector n eSource

Get the given row in a matrix.

col :: IMatrix a e => a (m, n) e -> Int -> Vector m eSource

Get the given column in a matrix.

rows :: IMatrix a e => a (m, n) e -> [Vector n e]Source

Get a list the row vectors in the matrix.

cols :: IMatrix a e => a (m, n) e -> [Vector m e]Source

Get a list the column vectors in the matrix.

Multiplication

(<*>) :: IMatrix a e => a (m, n) e -> Vector n e -> Vector m eSource

Matrix multiplication by a vector.

(<**>) :: IMatrix a e => a (m, k) e -> Matrix (k, n) e -> Matrix (m, n) eSource

Matrix multiplication by a matrix.

sapply :: IMatrix a e => e -> a (m, n) e -> Vector n e -> Vector m eSource

Scale and multiply by a vector. sapply k a x is equal to a <*> (k *> x), and often it is faster.

sapplyMat :: IMatrix a e => e -> a (m, k) e -> Matrix (k, n) e -> Matrix (m, n) eSource

Scale and multiply by a matrix. sapplyMat k a b is equal to a <**> (k *> b), and often it is faster.