jonathanfishbein1/linear-algebra/7.1.0

NOTE: the latest version is 30.0.0

Matrix

A module for Matrix

Types

type Matrix a
= Matrix (List (RowVector a))

Matrix type

type RowVector a
= RowVector (Vector a)

Row Vector

= ColumnVector (Vector a)

Column Vector

type Solution a
= UniqueSolution (ColumnVector a)
| InfiniteSolutions
{ nullity : Int
, rank : Int
}
| NoUniqueSolution String

Type to represent result of Gauss-Jordan reduction

= VectorDimension Int

Type to represent vector space such as R, R2, R3

Values

identityMatrix : Field a -> Int -> Matrix a

Create Identity Matrix with n dimension

Unitary Operations

scalarMultiplication : Field a -> a -> Matrix a -> Matrix a

Scalar multiplication over a Matrix

Transpose a Matrix

Matrix (ComplexNumberCartesian number)
-> Matrix (ComplexNumberCartesian number)

Take the complex conjugate of a Complex Numbered Matrix

Matrix (ComplexNumberCartesian number)
-> Matrix (ComplexNumberCartesian number)

Perform the adjoint operation on a Complex Numbered Matrix

invert : VectorSpace a -> Matrix a -> Result String (Matrix a)

Try to calculate the inverse of a matrix

subMatrix : Int -> Int -> Int -> Int -> Matrix a -> Matrix a

Calculate the submatrix given a starting and ending row and column index

nullSpace : VectorSpace a -> Matrix a -> Solution a

Calculate the null space of a matrix

determinant : VectorSpace a -> Matrix a -> Result String a

Try to calculate the determinant

matrixNorm : InnerProductSpace a -> Matrix a -> Result String a

Calculate the norm of a Matrix

leftNullSpace : VectorSpace a -> Matrix a -> Solution a

Calculate the left nullspace of a Matrix

Binary Operations

multiplyVectorMatrix : InnerProductSpace a -> Matrix a -> Vector a -> Vector a

Multiply a Vector by a Matrix

addMatrices : Field a -> Matrix a -> Matrix a -> Matrix a

Add two Matrices together

InnerProductSpace a
-> Matrix a
-> Matrix a
-> Result String (Matrix a)

Matrix Matrix multiplication

dotProduct : InnerProductSpace a -> Matrix a -> Matrix a -> Result String a

Calculate the dot product of two Matricies

matrixTensorProduct : Field a -> Matrix a -> Matrix a -> Matrix a

Calculate the tensor product of two Matricies

Matrix Predicates and Properties

Determine whether a matirx is square

isSymmetric : Matrix a -> Bool

Predicate to determine if Matrix is symmetric

isHermitian : Matrix (ComplexNumberCartesian number) -> Bool

Predicate to determine if Matrix is Hermitian

isInvertable : VectorSpace a -> Matrix a -> Result String (Matrix a)

Determine whether a matirx is invertable

isUnitary : Matrix (ComplexNumberCartesian Float) -> Bool

Determine whether a matirx is unitary

areBasis : VectorSpace a -> VectorDimension -> List (Vector a) -> Bool

Determine whether list of vectors are a basis for a space

areLinearlyIndependent : VectorSpace a -> List (Vector a) -> Bool

Predicate to determine if a list of Vectors are linearly independent

VectorSpace a
-> List (Vector a)
-> Result String Bool

Determine whether list of vectors spans a space

VectorSpace a
-> List (Vector a)
-> List (Vector a)

Determine the basis vectors of a vector space

mDimension : Matrix a -> Int

Number of rows in Matrix

nDimension : Matrix a -> Int

Number of columns in Matrix

Monoid

Monoid empty for Vector

sumMatrices : AbelianGroup a -> Matrix a -> Monoid (Matrix a)

Monoidally add two Matrices together

Monoidally append Matricies together horizontally

Monoidally append Matricies together vertically

Functor, Applicative, Monad, Foldable

map : (a -> b) -> Matrix a -> Matrix b

Map over a Matrix

pure : a -> Matrix a

Applicative pure for Matrix

apply : Matrix (a -> b) -> Matrix a -> Matrix b

Apply for Matrix

bind : Matrix a -> (a -> Matrix b) -> Matrix b

Monad bind for Matrix

liftA2 : (a -> b -> c) -> Matrix a -> Matrix b -> Matrix c

Lift a function to work on Matrix

foldl : (a -> b -> b) -> b -> Matrix a -> b

Left fold over a Matrix

Equality

equal : (a -> a -> Bool) -> Matrix a -> Matrix a -> Bool

Compare two matricies using comparator

Matrix Forms

upperTriangle : VectorSpace a -> Matrix a -> Result String (Matrix a)

Put a matrix into Upper Triangular Form

gaussianReduce : VectorSpace a -> Matrix a -> Matrix a

Gaussian Elimination

jordanReduce : VectorSpace a -> Matrix a -> Matrix a

Internal function for Jordan Elimination

gaussJordan : VectorSpace a -> Matrix a -> Matrix a

Function composition of Gaussian Elimination and Jordan Elimination

Solving

solve : VectorSpace a -> Matrix a -> ColumnVector a -> Solution a

Solve a system of linear equations using Gauss-Jordan elimination with explict augmented side column vector

solveMatrix : VectorSpace a -> Matrix a -> Solution a

Solve a system of linear equations using Gauss-Jordan elimination

Manipulation

getAt : ( Int, Int ) -> Matrix a -> Maybe a

Get the value in a matrix at the specified row and column

setAt : ( Int, Int ) -> a -> Matrix a -> Matrix a

Set the value in a Matrix at the specified row and column

printRealMatrix : Matrix Float -> String

Print a Real matrix to a string

printComplexMatrix : Matrix (ComplexNumberCartesian Float) -> String

Print a Complex matrix to a string

readRealMatrix : String -> Result (List DeadEnd) (Matrix Float)

Try to read a string into a Matrix

String
-> Result (List DeadEnd) (Matrix (ComplexNumberCartesian Float))

Try to read a string into a Matrix