constructive-algebra-0.1.6: A library of constructive algebra.

Algebra.Matrix

Description

A small simple matrix library.

Synopsis

Documentation

newtype Vector r Source

Row vectors

Constructors

Vec [r] 

Instances

Eq r => Eq (Vector r) 
Show r => Show (Vector r) 
(Ring r, Arbitrary r, Eq r) => Arbitrary (Vector r) 

unVec :: Vector r -> [r]Source

newtype Matrix r Source

Matrices

Constructors

M [Vector r] 

Instances

Eq r => Eq (Matrix r) 
Show r => Show (Matrix r) 
(Eq r, Arbitrary r, Ring r) => Arbitrary (Matrix r) 

matrix :: [[r]] -> Matrix rSource

Construct a mxn matrix.

unMVec :: Matrix r -> [[r]]Source

unM :: Matrix r -> [Vector r]Source

identity :: IntegralDomain r => Int -> Matrix rSource

Construct a nxn identity matrix.

mulM :: Ring r => Matrix r -> Matrix r -> Matrix rSource

Matrix multiplication.

addM :: Ring r => Matrix r -> Matrix r -> Matrix rSource

Matrix addition.

transpose :: Matrix r -> Matrix rSource

Transpose a matrix.

dimension :: Matrix r -> (Int, Int)Source

Compute the dimension of a matrix.