summaryrefslogtreecommitdiff
path: root/lib/Numeric/IO.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Numeric/IO.hs')
-rw-r--r--lib/Numeric/IO.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Numeric/IO.hs b/lib/Numeric/IO.hs
index 57275ac..836f352 100644
--- a/lib/Numeric/IO.hs
+++ b/lib/Numeric/IO.hs
@@ -60,6 +60,9 @@ disps d x = sdims x ++ " " ++ formatScaled d x
603.00 3.50 4.00 4.50 603.00 3.50 4.00 4.50
615.00 5.50 6.00 6.50 615.00 5.50 6.00 6.50
62 62
63>>> putStr . unlines . tail . lines . dispf 2 . asRow $ linspace 10 (0,1)
640.00 0.11 0.22 0.33 0.44 0.56 0.67 0.78 0.89 1.00
65
63-} 66-}
64dispf :: Int -> Matrix Double -> String 67dispf :: Int -> Matrix Double -> String
65dispf d x = sdims x ++ "\n" ++ formatFixed (if isInt x then 0 else d) x 68dispf d x = sdims x ++ "\n" ++ formatFixed (if isInt x then 0 else d) x
@@ -74,7 +77,8 @@ formatScaled dec t = "E"++show o++"\n" ++ ss
74 where ss = format " " (printf fmt. g) t 77 where ss = format " " (printf fmt. g) t
75 g x | o >= 0 = x/10^(o::Int) 78 g x | o >= 0 = x/10^(o::Int)
76 | otherwise = x*10^(-o) 79 | otherwise = x*10^(-o)
77 o = floor $ maximum $ map (logBase 10 . abs) $ toList $ flatten t 80 o | rows t == 0 || cols t == 0 = 0
81 | otherwise = floor $ maximum $ map (logBase 10 . abs) $ toList $ flatten t
78 fmt = '%':show (dec+3) ++ '.':show dec ++"f" 82 fmt = '%':show (dec+3) ++ '.':show dec ++"f"
79 83
80{- | Show a vector using a function for showing matrices. 84{- | Show a vector using a function for showing matrices.