Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add AddM instance for dense matrices

  • Loading branch information...
commit 6463de24a130d33e391e213a9f8b9e4deba5c6d5 1 parent e96008b
@Shimuuar authored
Showing with 7 additions and 0 deletions.
  1. +7 −0 Numeric/BLAS/Expression.hs
View
7 Numeric/BLAS/Expression.hs
@@ -595,6 +595,13 @@ instance BLAS1 a => AddM MV.MVector a where
instance BLAS1 a => AddM MS.MVector a where
addM x y = addVecScaled 1 y x
subM x y = addVecScaled (-1) y x
+instance BLAS1 a => AddM MMatD.MMatrix a where
+ addM x y = do
+ forM_ [0 .. MMat.cols x - 1] $ \i -> do
+ addVecScaled 1 (MMatD.unsafeGetCol y i) (MMatD.unsafeGetCol x i)
+ subM x y = do
+ forM_ [0 .. MMat.cols x - 1] $ \i -> do
+ addVecScaled (-1) (MMatD.unsafeGetCol y i) (MMatD.unsafeGetCol x i)
Please sign in to comment.
Something went wrong with that request. Please try again.