summaryrefslogtreecommitdiff
path: root/lib/Data
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Data')
-rw-r--r--lib/Data/Packed/Matrix.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Data/Packed/Matrix.hs b/lib/Data/Packed/Matrix.hs
index 48b2279..68971ff 100644
--- a/lib/Data/Packed/Matrix.hs
+++ b/lib/Data/Packed/Matrix.hs
@@ -395,11 +395,12 @@ mapMatrixWithIndexM g m = fmap (reshape c) . mapVectorWithIndexM (mk c g) . flat
395 , 10.0, 111.0, 12.0 395 , 10.0, 111.0, 12.0
396 , 20.0, 21.0, 122.0 ]@ 396 , 20.0, 21.0, 122.0 ]@
397 -} 397 -}
398mapMatrixWithIndex :: (Foreign.Storable.Storable t, 398mapMatrixWithIndex :: (Foreign.Storable.Storable t,
399 Element a, Num a) => 399 Element a, Num a) =>
400 ((Int, Int) -> a -> t) -> Matrix a -> Matrix t 400 ((Int, Int) -> a -> t) -> Matrix a -> Matrix t
401mapMatrixWithIndex g = head . mapMatrixWithIndexM (\a b -> [g a b]) 401mapMatrixWithIndex g m = reshape c $ mapVectorWithIndex (mk c g) $ flatten m
402 where
403 c = cols m
402 404
403mapMatrix :: (Storable a, Storable b) => (a -> b) -> Matrix a -> Matrix b 405mapMatrix :: (Storable a, Storable b) => (a -> b) -> Matrix a -> Matrix b
404mapMatrix f = liftMatrix (mapVector f) 406mapMatrix f = liftMatrix (mapVector f)
405