summaryrefslogtreecommitdiff
path: root/packages/base/src
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2015-06-05 16:45:51 +0200
committerAlberto Ruiz <aruiz@um.es>2015-06-05 16:45:51 +0200
commit1c1c0d2abfdf4e311c959a02e57e258257da8ca5 (patch)
tree2b268a46469e47f573e8687004e2d8294946a51e /packages/base/src
parent5d967adae38d7fe80443b57b40ae89cd15db5e18 (diff)
move io
Diffstat (limited to 'packages/base/src')
-rw-r--r--packages/base/src/Internal/IO.hs (renamed from packages/base/src/Data/Packed/IO.hs)23
1 files changed, 10 insertions, 13 deletions
diff --git a/packages/base/src/Data/Packed/IO.hs b/packages/base/src/Internal/IO.hs
index b0999a8..e594a1c 100644
--- a/packages/base/src/Data/Packed/IO.hs
+++ b/packages/base/src/Internal/IO.hs
@@ -1,6 +1,6 @@
1----------------------------------------------------------------------------- 1-----------------------------------------------------------------------------
2-- | 2-- |
3-- Module : Data.Packed.IO 3-- Module : Internal.IO
4-- Copyright : (c) Alberto Ruiz 2010 4-- Copyright : (c) Alberto Ruiz 2010
5-- License : BSD3 5-- License : BSD3
6-- 6--
@@ -10,19 +10,22 @@
10-- Display, formatting and IO functions for numeric 'Vector' and 'Matrix' 10-- Display, formatting and IO functions for numeric 'Vector' and 'Matrix'
11-- 11--
12----------------------------------------------------------------------------- 12-----------------------------------------------------------------------------
13{-# OPTIONS_HADDOCK hide #-}
14 13
15module Data.Packed.IO ( 14module Internal.IO (
16 dispf, disps, dispcf, vecdisp, latexFormat, format, 15 dispf, disps, dispcf, vecdisp, latexFormat, format,
17 readMatrix, fromArray2D, loadMatrix, loadMatrix', saveMatrix 16 loadMatrix, loadMatrix', saveMatrix
18) where 17) where
19 18
20import Data.Packed 19import Internal.Tools
20import Internal.Devel
21import Internal.Vector
22import Internal.Matrix
23import Internal.Vectorized
21import Text.Printf(printf) 24import Text.Printf(printf)
22import Data.List(intersperse) 25import Data.List(intersperse)
23import Data.Complex 26import Data.Complex
24import Numeric.Vectorized(vectorScan,saveMatrix) 27
25import Data.Packed.Internal 28
26 29
27{- | Creates a string from a matrix given a separator and a function to show each entry. Using 30{- | Creates a string from a matrix given a separator and a function to show each entry. Using
28this function the user can easily define any desired display function: 31this function the user can easily define any desired display function:
@@ -136,12 +139,6 @@ dispcf d m = sdims m ++ "\n" ++ format " " (showComplex d) m
136 139
137-------------------------------------------------------------------- 140--------------------------------------------------------------------
138 141
139-- | reads a matrix from a string containing a table of numbers.
140readMatrix :: String -> Matrix Double
141readMatrix = fromLists . map (map read). map words . filter (not.null) . lines
142
143--------------------------------------------------------------------------------
144
145apparentCols :: FilePath -> IO Int 142apparentCols :: FilePath -> IO Int
146apparentCols s = f . dropWhile null . map words . lines <$> readFile s 143apparentCols s = f . dropWhile null . map words . lines <$> readFile s
147 where 144 where