From 3797b187d1747f1971c112084976fb2808fc87b0 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Fri, 2 Sep 2011 12:35:22 +0000 Subject: require vector >= 0.8 --- lib/Numeric/Vector.hs | 52 ++++++--------------------------------------------- 1 file changed, 6 insertions(+), 46 deletions(-) (limited to 'lib') diff --git a/lib/Numeric/Vector.hs b/lib/Numeric/Vector.hs index 5b72951..1717e7b 100644 --- a/lib/Numeric/Vector.hs +++ b/lib/Numeric/Vector.hs @@ -6,7 +6,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Numeric.Vector --- Copyright : (c) Alberto Ruiz 2010 +-- Copyright : (c) Alberto Ruiz 2011 -- License : GPL-style -- -- Maintainer : Alberto Ruiz @@ -18,8 +18,7 @@ -- ----------------------------------------------------------------------------- -module Numeric.Vector ( - ) where +module Numeric.Vector () where import Numeric.GSL.Vector import Numeric.Container @@ -37,30 +36,19 @@ import Foreign(Storable) instance (Show a, Storable a) => (Show (Vector a)) where show v = (show (dim v))++" |> " ++ show (toList v) -#endif - -#ifdef VECTOR - -#if !MIN_VERSION_vector(0,8,0) -instance (Element a, Read a) => Read (Vector a) where - readsPrec _ s = [(fromList . read $ listnums, rest)] - where (thing,trest) = breakAt ']' s - (dims,listnums) = breakAt ' ' (dropWhile (==' ') thing) - rest = drop 31 trest -#endif -#else +instance Container Vector a => Eq (Vector a) where + (==) = equal instance (Element a, Read a) => Read (Vector a) where readsPrec _ s = [((d |>) . read $ listnums, rest)] where (thing,rest) = breakAt ']' s (dims,listnums) = breakAt '>' thing d = read . init . fst . breakAt '|' $ dims + breakAt c l = (a++[c],tail b) where + (a,b) = break (==c) l #endif -breakAt c l = (a++[c],tail b) where - (a,b) = break (==c) l - ------------------------------------------------------------------ @@ -71,13 +59,6 @@ adaptScalar f1 f2 f3 x y ------------------------------------------------------------------ -#ifndef VECTOR - -instance Container Vector a => Eq (Vector a) where - (==) = equal - -#endif - instance Num (Vector Float) where (+) = adaptScalar addConstant add (flip addConstant) negate = scale (-1) @@ -202,24 +183,3 @@ instance Floating (Vector (Complex Float)) where (**) = adaptScalar (vectorMapValQ PowSV) (vectorZipQ Pow) (flip (vectorMapValQ PowVS)) pi = fromList [pi] ------------------------------------------------------------ - - --- instance (Storable a, Num (Vector a)) => Monoid (Vector a) where --- mempty = 0 { idim = 0 } --- mappend a b = mconcat [a,b] --- mconcat = j . filter ((>0).dim) --- where j [] = mempty --- j l = join l - ---------------------------------------------------------------- - --- instance (NFData a, Storable a) => NFData (Vector a) where --- rnf = rnf . (@>0) --- --- instance (NFData a, Element a) => NFData (Matrix a) where --- rnf = rnf . flatten - - --------------------------------------------------------------------------- - -- cgit v1.2.3