diff options
author | Alberto Ruiz <aruiz@um.es> | 2014-06-12 14:15:05 +0200 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2014-06-12 14:15:05 +0200 |
commit | 01832377377142696645a2ea800af2db3d0fac15 (patch) | |
tree | 4988111123ac1e8ad4cc377bb713f8fff6ee3274 /packages/base/src/Numeric/LinearAlgebra/Util.hs | |
parent | 302a220b636d510ccf654e3671e8a93391c13523 (diff) |
improved loadMatrix
Diffstat (limited to 'packages/base/src/Numeric/LinearAlgebra/Util.hs')
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra/Util.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/packages/base/src/Numeric/LinearAlgebra/Util.hs b/packages/base/src/Numeric/LinearAlgebra/Util.hs index b6f8966..6bb9d15 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Util.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Util.hs | |||
@@ -416,7 +416,7 @@ c ~!~ msg = when c (error msg) | |||
416 | 416 | ||
417 | formatSparse :: String -> String -> String -> Int -> Matrix Double -> String | 417 | formatSparse :: String -> String -> String -> Int -> Matrix Double -> String |
418 | 418 | ||
419 | formatSparse zeroI zeroF sep _ (approxInt -> Just m) = format sep f m | 419 | formatSparse zeroI _zeroF sep _ (approxInt -> Just m) = format sep f m |
420 | where | 420 | where |
421 | f 0 = zeroI | 421 | f 0 = zeroI |
422 | f x = printf "%.0f" x | 422 | f x = printf "%.0f" x |
@@ -424,7 +424,8 @@ formatSparse zeroI zeroF sep _ (approxInt -> Just m) = format sep f m | |||
424 | formatSparse zeroI zeroF sep n m = format sep f m | 424 | formatSparse zeroI zeroF sep n m = format sep f m |
425 | where | 425 | where |
426 | f x | abs (x::Double) < 2*peps = zeroI++zeroF | 426 | f x | abs (x::Double) < 2*peps = zeroI++zeroF |
427 | | abs (fromIntegral (round x) - x) / abs x < 2*peps = printf ("%.0f."++replicate n ' ') x | 427 | | abs (fromIntegral (round x::Int) - x) / abs x < 2*peps |
428 | = printf ("%.0f."++replicate n ' ') x | ||
428 | | otherwise = printf ("%."++show n++"f") x | 429 | | otherwise = printf ("%."++show n++"f") x |
429 | 430 | ||
430 | approxInt m | 431 | approxInt m |