From 01832377377142696645a2ea800af2db3d0fac15 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Thu, 12 Jun 2014 14:15:05 +0200 Subject: improved loadMatrix --- packages/base/src/Numeric/LinearAlgebra/Data.hs | 2 +- packages/base/src/Numeric/LinearAlgebra/Util.hs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'packages/base/src/Numeric/LinearAlgebra') 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( -- * IO disp, - loadMatrix, saveMatrix, + loadMatrix, loadMatrix', saveMatrix, latexFormat, dispf, disps, dispcf, format, 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) formatSparse :: String -> String -> String -> Int -> Matrix Double -> String -formatSparse zeroI zeroF sep _ (approxInt -> Just m) = format sep f m +formatSparse zeroI _zeroF sep _ (approxInt -> Just m) = format sep f m where f 0 = zeroI f x = printf "%.0f" x @@ -424,7 +424,8 @@ formatSparse zeroI zeroF sep _ (approxInt -> Just m) = format sep f m formatSparse zeroI zeroF sep n m = format sep f m where f x | abs (x::Double) < 2*peps = zeroI++zeroF - | abs (fromIntegral (round x) - x) / abs x < 2*peps = printf ("%.0f."++replicate n ' ') x + | abs (fromIntegral (round x::Int) - x) / abs x < 2*peps + = printf ("%.0f."++replicate n ' ') x | otherwise = printf ("%."++show n++"f") x approxInt m -- cgit v1.2.3