From 7e103b8ada6fa1479790eac80eda997f5fdaf33f Mon Sep 17 00:00:00 2001 From: Vivian McPhail Date: Tue, 7 Sep 2010 04:23:19 +0000 Subject: remove v_* functions --- lib/Numeric/Container.hs | 65 ------------------------------------------------ lib/Numeric/Matrix.hs | 15 ----------- lib/Numeric/Vector.hs | 8 ------ 3 files changed, 88 deletions(-) (limited to 'lib/Numeric') diff --git a/lib/Numeric/Container.hs b/lib/Numeric/Container.hs index a0e489b..d6b1342 100644 --- a/lib/Numeric/Container.hs +++ b/lib/Numeric/Container.hs @@ -21,7 +21,6 @@ module Numeric.Container ( Linear(..), Container(..), RealElement, Precision(..), NumericContainer(..), comp, --- Complexable(..), Precisionable(..), Convert(..), --AutoReal(..), RealOf, ComplexOf, SingleOf, DoubleOf, @@ -122,70 +121,6 @@ type family IndexOf c type instance IndexOf Vector = Int type instance IndexOf Matrix = (Int,Int) -------------------------------------------------------------------- -{- --- | Supported single-double precision type pairs -class (Element e) => V_Precision e where - v_double2FloatG :: Vector e -> Vector (SingleOf e) - v_float2DoubleG :: Vector (SingleOf e) -> Vector e -{- -instance V_Precision Float where - v_double2FloatG = double2FloatV - v_float2DoubleG = float2DoubleV --} -instance V_Precision Double where - v_double2FloatG = double2FloatV - v_float2DoubleG = float2DoubleV -{- -instance V_Precision (Complex Float) where - v_double2FloatG = asComplex . double2FloatV . asReal - v_float2DoubleG = asComplex . float2DoubleV . asReal --} -instance V_Precision (Complex Double) where - v_double2FloatG = asComplex . double2FloatV . asReal - v_float2DoubleG = asComplex . float2DoubleV . asReal --} -------------------------------------------------------------------- -{- --- | converting to/from complex containers -class RealElement t => Complexable c t where - v_toComplex :: (c t, c t) -> c (Complex t) - v_fromComplex :: c (Complex t) -> (c t, c t) - v_complex' :: c t -> c (Complex t) - v_conj :: c (Complex t) -> c (Complex t) - --- | converting to/from single/double precision numbers -class (Element (SingleOf t), Element t, RealElement (RealOf t)) => Precisionable c t where - v_single' :: (V_Precision (DoubleOf t)) => c t -> c (SingleOf t) - v_double' :: (V_Precision (DoubleOf t)) => c t -> c (DoubleOf t) - --- | generic conversion functions -class (Element t, RealElement (RealOf t)) => V_Convert t where - -- | real/complex - v_real :: Complexable c (RealOf t) => c (RealOf t) -> c t -- from the instances, this looks like it turns a real object into a complex object WHEN the context is a complex object - v_complex :: Complexable c (RealOf t) => c t -> c (ComplexOf t) - -- | single/double - v_single :: Precisionable c t => c t -> c (SingleOf t) - v_double :: Precisionable c t => c t -> c (DoubleOf t) --} -------------------------------------------------------------------- -{- -instance Precisionable Vector Float where - v_single' = id - v_double' = float2DoubleG - -instance Precisionable Vector Double where - v_single' = double2FloatG - v_double' = id - -instance Precisionable Vector (Complex Float) where - v_single' = id - v_double' = float2DoubleG - -instance Precisionable Vector (Complex Double) where - v_single' = double2FloatG - v_double' = id --} ------------------------------------------------------------------- class (Element t, Element (RealOf t)) => Convert t where diff --git a/lib/Numeric/Matrix.hs b/lib/Numeric/Matrix.hs index 73515c1..fa3f94a 100644 --- a/lib/Numeric/Matrix.hs +++ b/lib/Numeric/Matrix.hs @@ -88,21 +88,6 @@ instance NumericContainer Matrix where double' = liftMatrix double' --------------------------------------------------------------- -{- -instance (RealElement e, Complexable Vector e) => Complexable Matrix e where - v_toComplex = uncurry $ liftMatrix2 $ curry toComplex - v_fromComplex z = (reshape c *** reshape c) . fromComplex . flatten $ z - where c = cols z - v_conj = liftMatrix conj - v_complex' = liftMatrix complex' - ---------------------------------------------------------------- - -instance (Precisionable Vector e) => Precisionable Matrix e where - v_single' = liftMatrix single' - v_double' = liftMatrix double' --} ---------------------------------------------------------------- instance (Linear Vector a, Container Matrix a) => Linear Matrix a where scale x = liftMatrix (scale x) diff --git a/lib/Numeric/Vector.hs b/lib/Numeric/Vector.hs index 5cc51ac..55d645a 100644 --- a/lib/Numeric/Vector.hs +++ b/lib/Numeric/Vector.hs @@ -281,14 +281,6 @@ instance NumericContainer Vector where double' = float2DoubleG -------------------------------------------------------------------------- -{- -instance RealElement e => Complexable Vector e where - v_toComplex = toComplexV - v_fromComplex = fromComplexV - v_conj = conjV - v_complex' v = toComplex (v,constantD 0 (dim v)) --} -------------------------------------------------------------------- instance Linear Vector Float where scale = vectorMapValF Scale -- cgit v1.2.3