Module

Data.Matrix.Operations

Package
purescript-sized-matrices
Repository
csicar/purescript-sized-matrices

#consRowVec Source

consRowVec :: forall h h' w a. Succ h h' => Nat w => Vec w a -> Matrix h w a -> Matrix h' w a

#(⤓) Source

Operator alias for Data.Matrix.Operations.consRowVec (right-associative / precedence 4)

> (vec2 1 2) ⤓ (matrix22 0 2 3 5)
 [1,2]
 [0,2]
 [3,5]

#consColVec Source

consColVec :: forall h w w' a. Succ w w' => Nat h => Vec h a -> Matrix h w a -> Matrix h w' a

#(⇥) Source

Operator alias for Data.Matrix.Operations.consColVec (right-associative / precedence 5)

> (Vec.vec2 1 2) ⇥ (matrix22 0 2 3 5)
  [2,3,5]
  [1,0,2]

#unconsV Source

unconsV :: forall h w h' a. Pred h h' => Pos h => Pos w => Matrix h w a -> { head :: Vec w a, tail :: Matrix h' w a }
> unconsV $ matrix22 1 2 3 4
{ head: [1,2], tail: 
  [3,4] }

#unconsH Source

unconsH :: forall h w w' a. Pred w w' => Pos h => Pos w => Matrix h w a -> { head :: Vec h a, tail :: Matrix h w' a }
> unconsH $ matrix22 1 2 3 4
{ head: [1,3], tail: 
  [2]
  [4] }

#snocRowVec Source

snocRowVec :: forall h h' w a. Succ h h' => Nat w => Vec w a -> Matrix h w a -> Matrix h' w a

#snocColVec Source

snocColVec :: forall h w w' a. Succ w w' => Nat h => Vec h a -> Matrix h w a -> Matrix h w' a

#findMaxIndex Source

findMaxIndex :: forall s a. Ord a => Pos s => Vec s a -> Int

#removeRow Source

removeRow :: forall w w' h a. Nat h => Nat w' => Nat w => Pred w w' => Int -> Matrix h w a -> Matrix h w' a

remove row at index. If index is out of bounds, there will be no change

> m
 [1,2]
 [3,4]

> removeRow 0 m
 [2]
 [4]

#removeColumn Source

removeColumn :: forall w h h' a. Nat w => Nat h => Nat h' => Pred h h' => Int -> Matrix h w a -> Matrix h' w a

remove column at index. If index is out of bounds, there will be no change

> m
  [1,2]
  [3,4]

> removeColumn 1 m
  [1,2]

#removeCross Source

removeCross :: forall w w' h h' a. Nat w => Nat w' => Nat h => Nat h' => Pred w w' => Pred h h' => Int -> Int -> Matrix h w a -> Matrix h' w' a

#replaceWithIdBlock Source

replaceWithIdBlock :: forall h w a. CommutativeRing a => Nat w => Nat h => Int -> Int -> Matrix h w a -> Matrix h w a