summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/Internal
diff options
context:
space:
mode:
authorVivian McPhail <haskell.vivian.mcphail@gmail.com>2010-09-21 03:05:52 +0000
committerVivian McPhail <haskell.vivian.mcphail@gmail.com>2010-09-21 03:05:52 +0000
commit7b8680256893a8624fab8d1d256773919df70068 (patch)
treeb5efd7cec14fc0cb0c8843dd5f998de64d8eebb1 /lib/Data/Packed/Internal
parent44d228ad83e876d45d1511761d7cd61bb2cd5c79 (diff)
move conjugate* to Container
The benefit of this patch is that Data.Packed.Internal.Matrix now has no numeric dependency. There is no 'optimisation' class for conjugateD, instead, different instances are directly specified in each Container instance. Unfortunately, an unsafeIO call now exists in Numeric.Container.
Diffstat (limited to 'lib/Data/Packed/Internal')
-rw-r--r--lib/Data/Packed/Internal/Matrix.hs25
1 files changed, 6 insertions, 19 deletions
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs
index f3bab76..7b823de 100644
--- a/lib/Data/Packed/Internal/Matrix.hs
+++ b/lib/Data/Packed/Internal/Matrix.hs
@@ -257,28 +257,30 @@ class (Storable a) => Element a where
257 transdata = transdataP -- transdata' 257 transdata = transdataP -- transdata'
258 constantD :: a -> Int -> Vector a 258 constantD :: a -> Int -> Vector a
259 constantD = constantP -- constant' 259 constantD = constantP -- constant'
260{-
260 conjugateD :: Vector a -> Vector a 261 conjugateD :: Vector a -> Vector a
261 conjugateD = id 262 conjugateD = id
263-}
262 264
263instance Element Float where 265instance Element Float where
264 transdata = transdataAux ctransF 266 transdata = transdataAux ctransF
265 constantD = constantAux cconstantF 267 constantD = constantAux cconstantF
266 conjugateD = id 268-- conjugateD = id
267 269
268instance Element Double where 270instance Element Double where
269 transdata = transdataAux ctransR 271 transdata = transdataAux ctransR
270 constantD = constantAux cconstantR 272 constantD = constantAux cconstantR
271 conjugateD = id 273-- conjugateD = id
272 274
273instance Element (Complex Float) where 275instance Element (Complex Float) where
274 transdata = transdataAux ctransQ 276 transdata = transdataAux ctransQ
275 constantD = constantAux cconstantQ 277 constantD = constantAux cconstantQ
276 conjugateD = conjugateQ 278-- conjugateD = conjugateQ
277 279
278instance Element (Complex Double) where 280instance Element (Complex Double) where
279 transdata = transdataAux ctransC 281 transdata = transdataAux ctransC
280 constantD = constantAux cconstantC 282 constantD = constantAux cconstantC
281 conjugateD = conjugateC 283-- conjugateD = conjugateC
282 284
283------------------------------------------------------------------- 285-------------------------------------------------------------------
284 286
@@ -390,21 +392,6 @@ constantP a n = unsafePerformIO $ do
390 return v 392 return v
391foreign import ccall "constantP" cconstantP :: Ptr () -> CInt -> Ptr () -> CInt -> IO CInt 393foreign import ccall "constantP" cconstantP :: Ptr () -> CInt -> Ptr () -> CInt -> IO CInt
392 394
393---------------------------------------
394
395conjugateAux fun x = unsafePerformIO $ do
396 v <- createVector (dim x)
397 app2 fun vec x vec v "conjugateAux"
398 return v
399
400conjugateQ :: Vector (Complex Float) -> Vector (Complex Float)
401conjugateQ = conjugateAux c_conjugateQ
402foreign import ccall "conjugateQ" c_conjugateQ :: TQVQV
403
404conjugateC :: Vector (Complex Double) -> Vector (Complex Double)
405conjugateC = conjugateAux c_conjugateC
406foreign import ccall "conjugateC" c_conjugateC :: TCVCV
407
408---------------------------------------------------------------------- 395----------------------------------------------------------------------
409 396
410-- | Extracts a submatrix from a matrix. 397-- | Extracts a submatrix from a matrix.