jonathanfishbein1/linear-algebra/23.0.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 Solution a
= UniqueSolution (ColumnVector a)
| InfiniteSolutions
{ nullity : Int
, rank : Int
}

Type to represent result of Gauss-Jordan reduction if system is consistant

= Consistant (Solution a)
| Inconsistant String (Solution a)

Type to represent result of Gauss-Jordan reduction

= VectorDimension Int

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

type alias MatrixSpace a =
{ abelianGroup : AbelianGroup (Matrix a)
, matrixScalarMultiplication : a -> Matrix a -> Matrix a
}

Type to represent a Vector Space

Values

identity : Field a -> Int -> Matrix a

Create Identity Matrix with n dimension

zeros : Field a -> Int -> Int -> Matrix a

Create Matrix with m x n dimension filled with zeros

Unitary Operations

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

Scalar multiplication over a Matrix

Transpose a Matrix

conjugate : Matrix (ComplexNumber number) -> Matrix (ComplexNumber number)

Take the complex conjugate of a Complex Numbered Matrix

adjoint : Matrix (ComplexNumber number) -> Matrix (ComplexNumber number)

Perform the adjoint operation on a Complex Numbered Matrix

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

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

nullSpace : Equality a -> InnerProductSpace a -> Matrix a -> Consistancy a

Calculate the null space of a matrix

leftNullSpace : Equality a -> InnerProductSpace a -> Matrix a -> Consistancy a

Calculate the left nullspace of a Matrix

getDiagonal : Matrix a -> Maybe (List a)

Get the diagonal of a Matrix

getDiagonalProduct : Field a -> Matrix a -> Maybe a

Get the Product of the diagonal of a Matrix

rank : InnerProductSpace a -> Matrix a -> Int

Calculate the rank of a Matrix

Create a Matrix from a list of Column Vectors

Binary Operations

add : Field a -> Matrix a -> Matrix a -> Matrix a

Add two Matrices together

subtract : Field a -> Matrix a -> Matrix a -> Matrix a

Subtract two Matrices

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

Multiply a Vector by a Matrix

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

Matrix Matrix multiplication

tensorProduct : Field a -> Matrix a -> Matrix a -> Matrix a

Calculate the tensor product of two Matricies

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

Calculate the commuter of two Hermitian Matricies

Matrix Predicates and Properties

InnerProductSpace a
-> List (ColumnVector a)
-> Bool

Determine whether list of vectors are a basis for a space

areLinearlyIndependent : InnerProductSpace a -> List (ColumnVector a) -> Bool

Predicate to determine if a list of Vectors are linearly independent

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

Determine whether list of vectors spans a space

mDimension : Matrix a -> Int

Number of rows in Matrix

nDimension : Matrix a -> Int

Number of columns in Matrix

areRowEquivalent : VectorSpace a -> Matrix a -> Matrix a -> Bool

Predicate to determine if two matricies are row equivalent

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

Predicate to determine if all values in the matric satisfy the given predicate

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

Determine whether a matirx is one to one

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

Determine whether a matirx is onto

Semigroup, Monoid, Group, Ring, Field, VectorSpace

Monoid empty for Vector

Monoidally append Matricies together horizontally

concatVertical : Monoid (Matrix a)

Monoidally append Matricies together vertically

realMatrixAdditionCommutativeSemigroup : CommutativeSemigroup (Matrix Float)

Commutative Semigroup instance for Matrix under the addition operation with real values.

complexMatrixAdditionCommutativeSemigroup : CommutativeSemigroup (Matrix (ComplexNumber Float))

Commutative Semigroup instance for Matrix under the addition operation with complex values.

realMatrixAdditionCommutativeMonoid : CommutativeMonoid (Matrix Float)

Commutative Monoid instance for Matrix under the addition operation with real values.

complexMatrixAdditionCommutativeMonoid : CommutativeMonoid (Matrix (ComplexNumber Float))

Commutative Monoid instance for Matrix under the addition operation with complex values.

realMatrixAlgebra : MatrixAlgebra Float

Real Numbered Matrix Algebra

complexMatrixAdditionAbelianGroup : AbelianGroup (Matrix (ComplexNumber Float))

Abelian Group instance for Matrix under the addition operation with complex values.

Append Matricies together horizontally

Group instance for Matrix under the addition operation with real values.

Semigroup instance for Matrix under the addition operation with real values.

realMatrixSpace : MatrixSpace Float

Real Numbered Vector Space for Matrix

complexMatrixSpace : MatrixSpace (ComplexNumber Float)

Complex Numbered Vector Space for Matrix

complexMatrixAdditionSemigroup : Semigroup (Matrix (ComplexNumber Float))

Semigroup instance for Matrix under the addition operation with complex values.

complexMatrixAdditionGroup : Group (Matrix (ComplexNumber Float))

Group instance for Matrix under the addition operation with complex values.

complexMatrixAlgebra : MatrixAlgebra (ComplexNumber Float)

Complex Numbered Matrix Algebra

Functor, Applicative, Monad, Foldable

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

Map over a Matrix

pure : a -> Matrix a

Applicative pure for Matrix

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

Apply for Matrix

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

Monad bind for Matrix

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

Lift a binary function to work on Matrix

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

Left fold over a Matrix

Equality

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

Equal type for Matrix.

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

Compare two Matrices for equality

Matrix Forms

upperTriangle : VectorSpace a -> Matrix a -> 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

Equality a
-> InnerProductSpace a
-> Matrix a

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

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 (ComplexNumber Float) -> String

Print a Complex matrix to a string

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

Try to read a string into a Matrix

readComplexMatrix : String -> Result (List DeadEnd) (Matrix (ComplexNumber Float))

Try to read a string into a Matrix