summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVivian McPhail <haskell.vivian.mcphail@gmail.com>2010-09-07 04:23:19 +0000
committerVivian McPhail <haskell.vivian.mcphail@gmail.com>2010-09-07 04:23:19 +0000
commit7e103b8ada6fa1479790eac80eda997f5fdaf33f (patch)
tree7f8ab3cb23d76fc1f624c4b947e39a9257a036db /lib
parent9004922ad91c0b4ad8498c31171a3a1a1e27d9f2 (diff)
remove v_* functions
Diffstat (limited to 'lib')
-rw-r--r--lib/Numeric/Container.hs65
-rw-r--r--lib/Numeric/Matrix.hs15
-rw-r--r--lib/Numeric/Vector.hs8
3 files changed, 0 insertions, 88 deletions
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 @@
21module Numeric.Container ( 21module Numeric.Container (
22 Linear(..), 22 Linear(..),
23 Container(..), RealElement, Precision(..), NumericContainer(..), comp, 23 Container(..), RealElement, Precision(..), NumericContainer(..), comp,
24-- Complexable(..), Precisionable(..),
25 Convert(..), --AutoReal(..), 24 Convert(..), --AutoReal(..),
26 RealOf, ComplexOf, SingleOf, DoubleOf, 25 RealOf, ComplexOf, SingleOf, DoubleOf,
27 26
@@ -123,70 +122,6 @@ type instance IndexOf Vector = Int
123type instance IndexOf Matrix = (Int,Int) 122type instance IndexOf Matrix = (Int,Int)
124 123
125------------------------------------------------------------------- 124-------------------------------------------------------------------
126{-
127-- | Supported single-double precision type pairs
128class (Element e) => V_Precision e where
129 v_double2FloatG :: Vector e -> Vector (SingleOf e)
130 v_float2DoubleG :: Vector (SingleOf e) -> Vector e
131{-
132instance V_Precision Float where
133 v_double2FloatG = double2FloatV
134 v_float2DoubleG = float2DoubleV
135-}
136instance V_Precision Double where
137 v_double2FloatG = double2FloatV
138 v_float2DoubleG = float2DoubleV
139{-
140instance V_Precision (Complex Float) where
141 v_double2FloatG = asComplex . double2FloatV . asReal
142 v_float2DoubleG = asComplex . float2DoubleV . asReal
143-}
144instance V_Precision (Complex Double) where
145 v_double2FloatG = asComplex . double2FloatV . asReal
146 v_float2DoubleG = asComplex . float2DoubleV . asReal
147-}
148-------------------------------------------------------------------
149{-
150-- | converting to/from complex containers
151class RealElement t => Complexable c t where
152 v_toComplex :: (c t, c t) -> c (Complex t)
153 v_fromComplex :: c (Complex t) -> (c t, c t)
154 v_complex' :: c t -> c (Complex t)
155 v_conj :: c (Complex t) -> c (Complex t)
156
157-- | converting to/from single/double precision numbers
158class (Element (SingleOf t), Element t, RealElement (RealOf t)) => Precisionable c t where
159 v_single' :: (V_Precision (DoubleOf t)) => c t -> c (SingleOf t)
160 v_double' :: (V_Precision (DoubleOf t)) => c t -> c (DoubleOf t)
161
162-- | generic conversion functions
163class (Element t, RealElement (RealOf t)) => V_Convert t where
164 -- | real/complex
165 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
166 v_complex :: Complexable c (RealOf t) => c t -> c (ComplexOf t)
167 -- | single/double
168 v_single :: Precisionable c t => c t -> c (SingleOf t)
169 v_double :: Precisionable c t => c t -> c (DoubleOf t)
170-}
171-------------------------------------------------------------------
172{-
173instance Precisionable Vector Float where
174 v_single' = id
175 v_double' = float2DoubleG
176
177instance Precisionable Vector Double where
178 v_single' = double2FloatG
179 v_double' = id
180
181instance Precisionable Vector (Complex Float) where
182 v_single' = id
183 v_double' = float2DoubleG
184
185instance Precisionable Vector (Complex Double) where
186 v_single' = double2FloatG
187 v_double' = id
188-}
189-------------------------------------------------------------------
190 125
191class (Element t, Element (RealOf t)) => Convert t where 126class (Element t, Element (RealOf t)) => Convert t where
192 real :: NumericContainer c => c (RealOf t) -> c t 127 real :: NumericContainer c => c (RealOf t) -> c t
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
88 double' = liftMatrix double' 88 double' = liftMatrix double'
89 89
90--------------------------------------------------------------- 90---------------------------------------------------------------
91{-
92instance (RealElement e, Complexable Vector e) => Complexable Matrix e where
93 v_toComplex = uncurry $ liftMatrix2 $ curry toComplex
94 v_fromComplex z = (reshape c *** reshape c) . fromComplex . flatten $ z
95 where c = cols z
96 v_conj = liftMatrix conj
97 v_complex' = liftMatrix complex'
98
99---------------------------------------------------------------
100
101instance (Precisionable Vector e) => Precisionable Matrix e where
102 v_single' = liftMatrix single'
103 v_double' = liftMatrix double'
104-}
105---------------------------------------------------------------
106 91
107instance (Linear Vector a, Container Matrix a) => Linear Matrix a where 92instance (Linear Vector a, Container Matrix a) => Linear Matrix a where
108 scale x = liftMatrix (scale x) 93 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
281 double' = float2DoubleG 281 double' = float2DoubleG
282 282
283-------------------------------------------------------------------------- 283--------------------------------------------------------------------------
284{-
285instance RealElement e => Complexable Vector e where
286 v_toComplex = toComplexV
287 v_fromComplex = fromComplexV
288 v_conj = conjV
289 v_complex' v = toComplex (v,constantD 0 (dim v))
290-}
291-------------------------------------------------------------------
292 284
293instance Linear Vector Float where 285instance Linear Vector Float where
294 scale = vectorMapValF Scale 286 scale = vectorMapValF Scale