Module

# LinearAlgebra.Matrix

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

### #MatrixSource

data Matrix a

Dense Matrix implementation

### #fromArraySource

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

Create Matrix from Array

### #fromColumnSource

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

Create matrix from column

### #fromRowSource

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

Create matrix from row

### #replicateSource

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

Create array of given dimmension containing replicated value

### #zerosSource

zeros :: Int -> Int -> Matrix Number

Create array of given dimmension with all values set to 0

### #identitySource

identity :: Int -> Matrix Number

Create identy matrix

### #ncolsSource

ncols :: forall a. Matrix a -> Int

Number of cols in matrix

### #nrowsSource

nrows :: forall a. Matrix a -> Int

Number of rows in matrix

### #columnSource

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

### #elementSource

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

Get specific element. Index is 0 based

### #rowSource

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

### #columnsSource

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

List of columns

### #rowsSource

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

Return list of rows

### #sliceColsSource

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

Slice matrix along the columns. Range is inclusive.

### #sliceRowsSource

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

Slice matrix along the rows. Range is inclusive.

### #toVectorSource

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

Convert Matrix to Vector

### #insertColSource

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

Insert new column at a given index to the matrix

### #transposeSource

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

Transpose matrix

### #addSource

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

Add 2 matrices. The should have the same size

### #multiplySource

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

Multiply 2 matrices. The have to have compatible dimmensions