Module

Data.Matrix.Operations

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

#consRowVec Source

consRowVec :: forall a w h' h. 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 a w' w h. 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]

#consSingle Source

consSingle :: forall s' s a. Succ s s' => a -> Matrix D1 s a -> Matrix D1 s' a

#(&) Source

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

> 1 & 2 & 3 & empty
   [1, 2, 3]

#unconsV Source

unconsV :: forall a h' w h. 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 a w' w h. 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 a w h' h. Succ h h' => Nat w => Vec w a -> Matrix h w a -> Matrix h' w a

#snocColVec Source

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

#findMaxIndex Source

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

#removeRow Source

removeRow :: forall a h w' w. 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 a h' h w. 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 a h' h w' w. 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 a w h. CommutativeRing a => Nat w => Nat h => Int -> Int -> Matrix h w a -> Matrix h w a