From 167ee54f28248d55da72bcb22c3335f8448efcfa Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Sun, 17 Mar 2013 23:12:05 -0400 Subject: Matrix: Whitespace cleanup --- lib/Data/Packed/Matrix.hs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lib/Data') diff --git a/lib/Data/Packed/Matrix.hs b/lib/Data/Packed/Matrix.hs index 68971ff..c1a9b24 100644 --- a/lib/Data/Packed/Matrix.hs +++ b/lib/Data/Packed/Matrix.hs @@ -157,7 +157,7 @@ adaptBlocks ms = ms' where ----------------------------------------------------------- --- | Reverse rows +-- | Reverse rows flipud :: Element t => Matrix t -> Matrix t flipud m = fromRows . reverse . toRows $ m @@ -272,7 +272,7 @@ Hilbert matrix of order N: buildMatrix :: Element a => Int -> Int -> ((Int, Int) -> a) -> Matrix a buildMatrix rc cc f = fromLists $ map (map f) - $ map (\ ri -> map (\ ci -> (ri, ci)) [0 .. (cc - 1)]) [0 .. (rc - 1)] + $ map (\ ri -> map (\ ci -> (ri, ci)) [0 .. (cc - 1)]) [0 .. (rc - 1)] ----------------------------------------------------- @@ -283,7 +283,7 @@ fromArray2D m = (r> [Int] -> Matrix t -> Matrix t extractRows l m = fromRows $ extract (toRows m) l where extract l' is = [l'!!i |i<-is] @@ -351,9 +351,9 @@ toBlocksEvery r c m = toBlocks rs cs m where ------------------------------------------------------------------- -mk c g = \k v -> g (divMod k c) v +mk c g = \k v -> g (divMod k c) v -{- | +{- | @ghci> mapMatrixWithIndexM_ (\\(i,j) v -> printf \"m[%.0f,%.0f] = %.f\\n\" i j v :: IO()) ((2><3)[1 :: Double ..]) m[0,0] = 1 @@ -367,7 +367,7 @@ mapMatrixWithIndexM_ :: (Element a, Num a, Functor f, Monad f) => ((Int, Int) -> a -> f ()) -> Matrix a -> f () -mapMatrixWithIndexM_ g m = mapVectorWithIndexM_ (mk c g) . flatten $ m +mapMatrixWithIndexM_ g m = mapVectorWithIndexM_ (mk c g) . flatten $ m where c = cols m @@ -380,11 +380,11 @@ Just (3><3) , 20.0, 21.0, 122.0 ]@ -} mapMatrixWithIndexM - :: (Foreign.Storable.Storable t, + :: (Foreign.Storable.Storable t, Element a, Num a, Functor f, Monad f) => ((Int, Int) -> a -> f t) -> Matrix a -> f (Matrix t) -mapMatrixWithIndexM g m = fmap (reshape c) . mapVectorWithIndexM (mk c g) . flatten $ m +mapMatrixWithIndexM g m = fmap (reshape c) . mapVectorWithIndexM (mk c g) . flatten $ m where c = cols m -- cgit v1.2.3