diff --git a/src/LinearAlgebra/Matrix.purs b/src/LinearAlgebra/Matrix.purs index f9e8338..9118dc8 100644 --- a/src/LinearAlgebra/Matrix.purs +++ b/src/LinearAlgebra/Matrix.purs @@ -1,5 +1,5 @@ module LinearAlgebra.Matrix - ( Matrix + ( Matrix -- * Constructors , fromArray , fromColumn @@ -44,6 +44,9 @@ instance showMatrix :: Show a => Show (Matrix a) where <> ", ncols=" <> show c <> ", data=" <> show ds +instance functorMatrix :: Functor (Matrix a) where + map f (Dense n m vs) = Dense n m (map f vs) + -- | Number of rows in matrix nrows :: ∀ a. Matrix a -> Int @@ -191,4 +194,4 @@ add :: Matrix Number -> Matrix Number -> Matrix Number add (Dense r1 c1 vs1) (Dense r2 c2 vs2) | r1 /= r2 || c1 /= c2 = zeros 1 1 | otherwise = Dense r1 c1 $ V.add vs1 vs2 - \ No newline at end of file +