diff options
Diffstat (limited to 'lib/Data/Packed/Internal')
-rw-r--r-- | lib/Data/Packed/Internal/Matrix.hs | 16 | ||||
-rw-r--r-- | lib/Data/Packed/Internal/Vector.hs | 3 |
2 files changed, 1 insertions, 18 deletions
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs index bf7f0ec..77906dc 100644 --- a/lib/Data/Packed/Internal/Matrix.hs +++ b/lib/Data/Packed/Internal/Matrix.hs | |||
@@ -22,10 +22,10 @@ import Data.Packed.Internal.Vector | |||
22 | import Foreign hiding (xor) | 22 | import Foreign hiding (xor) |
23 | import Complex | 23 | import Complex |
24 | import Control.Monad(when) | 24 | import Control.Monad(when) |
25 | import Data.List(transpose,intersperse) | ||
26 | import Data.Maybe(fromJust) | 25 | import Data.Maybe(fromJust) |
27 | import Foreign.C.String | 26 | import Foreign.C.String |
28 | import Foreign.C.Types | 27 | import Foreign.C.Types |
28 | import Data.List(transpose) | ||
29 | 29 | ||
30 | ----------------------------------------------------------------- | 30 | ----------------------------------------------------------------- |
31 | 31 | ||
@@ -199,20 +199,6 @@ instance Field (Complex Double) where | |||
199 | 199 | ||
200 | ------------------------------------------------------------------ | 200 | ------------------------------------------------------------------ |
201 | 201 | ||
202 | instance (Show a, Field a) => (Show (Matrix a)) where | ||
203 | show m = (sizes++) . dsp . map (map show) . toLists $ m | ||
204 | where sizes = "("++show (rows m)++"><"++show (cols m)++")\n" | ||
205 | |||
206 | dsp as = (++" ]") . (" ["++) . init . drop 2 . unlines . map (" , "++) . map unwords' $ transpose mtp | ||
207 | where | ||
208 | mt = transpose as | ||
209 | longs = map (maximum . map length) mt | ||
210 | mtp = zipWith (\a b -> map (pad a) b) longs mt | ||
211 | pad n str = replicate (n - length str) ' ' ++ str | ||
212 | unwords' = concat . intersperse ", " | ||
213 | |||
214 | ------------------------------------------------------------------ | ||
215 | |||
216 | (>|<) :: (Field a) => Int -> Int -> [a] -> Matrix a | 202 | (>|<) :: (Field a) => Int -> Int -> [a] -> Matrix a |
217 | r >|< c = f where | 203 | r >|< c = f where |
218 | f l | dim v == r*c = matrixFromVector ColumnMajor c v | 204 | f l | dim v == r*c = matrixFromVector ColumnMajor c v |
diff --git a/lib/Data/Packed/Internal/Vector.hs b/lib/Data/Packed/Internal/Vector.hs index 9557206..76bd4d1 100644 --- a/lib/Data/Packed/Internal/Vector.hs +++ b/lib/Data/Packed/Internal/Vector.hs | |||
@@ -103,9 +103,6 @@ at :: Storable a => Vector a -> Int -> a | |||
103 | at v n | n >= 0 && n < dim v = at' v n | 103 | at v n | n >= 0 && n < dim v = at' v n |
104 | | otherwise = error "vector index out of range" | 104 | | otherwise = error "vector index out of range" |
105 | 105 | ||
106 | instance (Show a, Storable a) => (Show (Vector a)) where | ||
107 | show v = (show (dim v))++" |> " ++ show (toList v) | ||
108 | |||
109 | {- | takes a number of consecutive elements from a Vector | 106 | {- | takes a number of consecutive elements from a Vector |
110 | 107 | ||
111 | @> subVector 2 3 (fromList [1..10]) | 108 | @> subVector 2 3 (fromList [1..10]) |