From 1a9c07dd1fffdbd7eb939fa6a781793419947c08 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Fri, 19 Oct 2007 09:39:06 +0000 Subject: some refactoring --- lib/Data/Packed/Internal/Matrix.hs | 16 +--------------- lib/Data/Packed/Internal/Vector.hs | 3 --- 2 files changed, 1 insertion(+), 18 deletions(-) (limited to 'lib/Data/Packed/Internal') 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 import Foreign hiding (xor) import Complex import Control.Monad(when) -import Data.List(transpose,intersperse) import Data.Maybe(fromJust) import Foreign.C.String import Foreign.C.Types +import Data.List(transpose) ----------------------------------------------------------------- @@ -199,20 +199,6 @@ instance Field (Complex Double) where ------------------------------------------------------------------ -instance (Show a, Field a) => (Show (Matrix a)) where - show m = (sizes++) . dsp . map (map show) . toLists $ m - where sizes = "("++show (rows m)++"><"++show (cols m)++")\n" - -dsp as = (++" ]") . (" ["++) . init . drop 2 . unlines . map (" , "++) . map unwords' $ transpose mtp - where - mt = transpose as - longs = map (maximum . map length) mt - mtp = zipWith (\a b -> map (pad a) b) longs mt - pad n str = replicate (n - length str) ' ' ++ str - unwords' = concat . intersperse ", " - ------------------------------------------------------------------- - (>|<) :: (Field a) => Int -> Int -> [a] -> Matrix a r >|< c = f where 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 at v n | n >= 0 && n < dim v = at' v n | otherwise = error "vector index out of range" -instance (Show a, Storable a) => (Show (Vector a)) where - show v = (show (dim v))++" |> " ++ show (toList v) - {- | takes a number of consecutive elements from a Vector @> subVector 2 3 (fromList [1..10]) -- cgit v1.2.3