diff options
author | Vivian McPhail <haskell.vivian.mcphail@gmail.com> | 2010-09-18 12:20:19 +0000 |
---|---|---|
committer | Vivian McPhail <haskell.vivian.mcphail@gmail.com> | 2010-09-18 12:20:19 +0000 |
commit | 0fc87fd99db80b81521a51c8abf4b8b151efb9da (patch) | |
tree | a2ab793f8801af131101757788bf0b6bf303e409 /lib/Numeric | |
parent | b1c372da927651887a46b6c47880acd0814fa01a (diff) |
fix matrix min/maxElement
Diffstat (limited to 'lib/Numeric')
-rw-r--r-- | lib/Numeric/Container.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Numeric/Container.hs b/lib/Numeric/Container.hs index e9a8f22..0fecf86 100644 --- a/lib/Numeric/Container.hs +++ b/lib/Numeric/Container.hs | |||
@@ -203,10 +203,10 @@ instance (Container Vector a) => Container Matrix a where | |||
203 | atIndex = (@@>) | 203 | atIndex = (@@>) |
204 | minIndex m = let (r,c) = (rows m,cols m) | 204 | minIndex m = let (r,c) = (rows m,cols m) |
205 | i = (minIndex $ flatten m) | 205 | i = (minIndex $ flatten m) |
206 | in (i `div` c,(i `mod` c) + 1) | 206 | in (i `div` c,i `mod` c) |
207 | maxIndex m = let (r,c) = (rows m,cols m) | 207 | maxIndex m = let (r,c) = (rows m,cols m) |
208 | i = (maxIndex $ flatten m) | 208 | i = (maxIndex $ flatten m) |
209 | in (i `div` c,(i `mod` c) + 1) | 209 | in (i `div` c,i `mod` c) |
210 | minElement = ap (@@>) minIndex | 210 | minElement = ap (@@>) minIndex |
211 | maxElement = ap (@@>) maxIndex | 211 | maxElement = ap (@@>) maxIndex |
212 | sumElements = sumElements . flatten | 212 | sumElements = sumElements . flatten |