summaryrefslogtreecommitdiff
path: root/packages/base/src/Numeric/LinearAlgebra
diff options
context:
space:
mode:
Diffstat (limited to 'packages/base/src/Numeric/LinearAlgebra')
-rw-r--r--packages/base/src/Numeric/LinearAlgebra/Data.hs2
-rw-r--r--packages/base/src/Numeric/LinearAlgebra/Util.hs5
2 files changed, 4 insertions, 3 deletions
diff --git a/packages/base/src/Numeric/LinearAlgebra/Data.hs b/packages/base/src/Numeric/LinearAlgebra/Data.hs
index d5ce32f..b1a31fc 100644
--- a/packages/base/src/Numeric/LinearAlgebra/Data.hs
+++ b/packages/base/src/Numeric/LinearAlgebra/Data.hs
@@ -55,7 +55,7 @@ module Numeric.LinearAlgebra.Data(
55 55
56 -- * IO 56 -- * IO
57 disp, 57 disp,
58 loadMatrix, saveMatrix, 58 loadMatrix, loadMatrix', saveMatrix,
59 latexFormat, 59 latexFormat,
60 dispf, disps, dispcf, format, 60 dispf, disps, dispcf, format,
61 dispDots, dispBlanks, dispShort, 61 dispDots, dispBlanks, dispShort,
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
417formatSparse :: String -> String -> String -> Int -> Matrix Double -> String 417formatSparse :: String -> String -> String -> Int -> Matrix Double -> String
418 418
419formatSparse zeroI zeroF sep _ (approxInt -> Just m) = format sep f m 419formatSparse 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
424formatSparse zeroI zeroF sep n m = format sep f m 424formatSparse 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
430approxInt m 431approxInt m