Module

LinearAlgebra.Matrix

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

#Matrix Source

type Matrix a = { ncols :: Int, nrows :: Int, values :: Array a }

Dense Matrix implementation

#replicate Source

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

Create array of given dimmension containing replicated value

#zeros Source

zeros :: Int -> Int -> Maybe (Matrix Number)

Create array of given dimmension with all values set to 0

#fromArray Source

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

Create Matrix from Array

#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

#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

#element Source

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

Get specific element. Index is 0 based

#rows Source

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

Return list of rows

#columns Source

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

List of columns