Module
Data.FastVect.FastVect.Matrix
- Package
- purescript-fast-vect
- Repository
- sigma-andex/purescript-fast-vect
#Matrix Source
newtype Matrix :: Int -> Int -> Type -> Type
newtype Matrix h w a
A matrix of elements of type a
, implemented as a array vector of array vectors.
The first type argument represents the height of the matrix and the second type argument represents the width.
Note that the internal implementation is a horizontal row of vertical vectors.
This is because in mathematics, matrices are often treated as a row of vertical vectors.
Constructors
Instances
(Show a, Compare h NegOne GT, Compare w NegOne GT) => Show (Matrix h w a)
(Eq a) => Eq (Matrix h w a)
(Ord a) => Ord (Matrix h w a)
Functor (Matrix h w)
FunctorWithIndex (Tuple Int Int) (Matrix h w)
Apply (Matrix h w)
(Compare h NegOne GT, Reflectable h Int, Compare w NegOne GT, Reflectable w Int) => Applicative (Matrix h w)
(Compare h Zero GT, Compare w Zero GT, Reflectable h Int, Reflectable w Int) => Bind (Matrix h w)
(Compare h Zero GT, Compare w Zero GT, Reflectable h Int, Reflectable w Int) => Monad (Matrix h w)
Foldable (Matrix h w)
FoldableWithIndex (Tuple Int Int) (Matrix h w)
(Compare h Zero GT, Compare w Zero GT) => Foldable1 (Matrix h w)
Traversable (Matrix h w)
TraversableWithIndex (Tuple Int Int) (Matrix h w)
(Compare h Zero GT, Compare w Zero GT) => Traversable1 (Matrix h w)
(Compare h Zero GT, Compare w Zero GT, Reflectable h Int, Reflectable w Int) => Distributive (Matrix h w)
(Semigroup a) => Semigroup (Matrix h w a)
(Compare h NegOne GT, Reflectable h Int, Compare w NegOne GT, Reflectable w Int, Monoid a) => Monoid (Matrix h w a)
(Compare h NegOne GT, Reflectable h Int, Compare w NegOne GT, Reflectable w Int, Semiring a) => Semiring (Matrix h w a)
(Compare h NegOne GT, Reflectable h Int, Compare w NegOne GT, Reflectable w Int, Ring a) => Ring (Matrix h w a)
(Compare h NegOne GT, Reflectable h Int, Compare w NegOne GT, Reflectable w Int, CommutativeRing a) => CommutativeRing (Matrix h w a)
#dotProduct Source
dotProduct :: forall h elem. DotProduct Vect h elem
Dot product of two vectors.
#fromVectVect Source
fromVectVect :: forall h w elem. Vect w (Vect h elem) -> Matrix h w elem
Convert a vector of vectors to a Matrix
.
#mapWithTerm Source
mapWithTerm :: forall h w elem elem'. MapWithTerm Matrix h w elem elem'
Map a function over the elements of a Matrix
with its type-level indices.
#outerProduct Source
outerProduct :: forall h w elem. OuterProduct Vect Matrix h w elem
Outer product
#toVectVect Source
toVectVect :: forall h w elem. Matrix h w elem -> Vect w (Vect h elem)
Convert a Matrix
to a vector of vectors.