Module

LinearAlgebra.Matrix

Package
purescript-linear-algebra
Repository
klangner/purescript-linear-algebra

#Matrix Source

data Matrix a

Dense Matrix implementation

Instances

#fromArray Source

fromArray :: forall a. Int -> Int -> Array a -> Maybe (Matrix a)

Create Matrix from Array

#fromColumn Source

fromColumn :: forall a. Vector a -> Matrix a

Create matrix from column

#fromRow Source

fromRow :: forall a. Vector a -> Matrix a

Create matrix from row

#replicate Source

replicate :: forall a. Int -> Int -> a -> Maybe (Matrix a)

Create array of given dimmension containing replicated value

#zeros Source

zeros :: Int -> Int -> Matrix Number

Create array of given dimmension with all values set to 0

#identity Source

identity :: Int -> Matrix Number

Create identy matrix

#ncols Source

ncols :: forall a. Matrix a -> Int

Number of cols in matrix

#nrows Source

nrows :: forall a. Matrix a -> Int

Number of rows in matrix

#column Source

column :: forall a. Int -> Matrix a -> Vector a

Get specific column as a vector. Index is 0 based If the index is out of range then return empty vector

#element Source

element :: forall a. Int -> Int -> Matrix a -> Maybe a

Get specific element. Index is 0 based

#row Source

row :: forall a. Int -> Matrix a -> Vector a

Get specific row as a vector. Index is 0 based If the index is out of range then return empty vector

#columns Source

columns :: forall a. Matrix a -> Array (Vector a)

List of columns

#rows Source

rows :: forall a. Matrix a -> Array (Vector a)

Return list of rows

#sliceCols Source

sliceCols :: forall a. Int -> Int -> Matrix a -> Matrix a

Slice matrix along the columns. Range is inclusive.

#sliceRows Source

sliceRows :: forall a. Int -> Int -> Matrix a -> Matrix a

Slice matrix along the rows. Range is inclusive.

#toVector Source

toVector :: forall a. Matrix a -> Vector a

Convert Matrix to Vector

#insertCol Source

insertCol :: forall a. Int -> Vector a -> Matrix a -> Matrix a

Insert new column at a given index to the matrix

#transpose Source

transpose :: forall a. Matrix a -> Matrix a

Transpose matrix

#add Source

add :: Matrix Number -> Matrix Number -> Matrix Number

Add 2 matrices. The should have the same size

#multiply Source

multiply :: Matrix Number -> Matrix Number -> Matrix Number

Multiply 2 matrices. The have to have compatible dimmensions