summaryrefslogtreecommitdiff
path: root/lib/Data/Packed/Internal
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2010-08-26 17:49:45 +0000
committerAlberto Ruiz <aruiz@um.es>2010-08-26 17:49:45 +0000
commit6058e1b17c005be1ea95ebb7d98d9fd15bb538d2 (patch)
treec4277e00c2c92a0ed8f3750255154fa8e2b6fe2d /lib/Data/Packed/Internal
parentf541d7dbdc8338b1dd1c0538751d837a16740bd8 (diff)
Float matrix product
Diffstat (limited to 'lib/Data/Packed/Internal')
-rw-r--r--lib/Data/Packed/Internal/Signatures.hs4
-rw-r--r--lib/Data/Packed/Internal/Vector.hs20
2 files changed, 23 insertions, 1 deletions
diff --git a/lib/Data/Packed/Internal/Signatures.hs b/lib/Data/Packed/Internal/Signatures.hs
index 8c1c5f6..b81efa4 100644
--- a/lib/Data/Packed/Internal/Signatures.hs
+++ b/lib/Data/Packed/Internal/Signatures.hs
@@ -24,12 +24,15 @@ type PQ = Ptr (Complex Float) --
24type PC = Ptr (Complex Double) -- 24type PC = Ptr (Complex Double) --
25type TF = CInt -> PF -> IO CInt -- 25type TF = CInt -> PF -> IO CInt --
26type TFF = CInt -> PF -> TF -- 26type TFF = CInt -> PF -> TF --
27type TFV = CInt -> PF -> TV --
28type TVF = CInt -> PD -> TF --
27type TFFF = CInt -> PF -> TFF -- 29type TFFF = CInt -> PF -> TFF --
28type TV = CInt -> PD -> IO CInt -- 30type TV = CInt -> PD -> IO CInt --
29type TVV = CInt -> PD -> TV -- 31type TVV = CInt -> PD -> TV --
30type TVVV = CInt -> PD -> TVV -- 32type TVVV = CInt -> PD -> TVV --
31type TFM = CInt -> CInt -> PF -> IO CInt -- 33type TFM = CInt -> CInt -> PF -> IO CInt --
32type TFMFM = CInt -> CInt -> PF -> TFM -- 34type TFMFM = CInt -> CInt -> PF -> TFM --
35type TFMFMFM = CInt -> CInt -> PF -> TFMFM --
33type TM = CInt -> CInt -> PD -> IO CInt -- 36type TM = CInt -> CInt -> PD -> IO CInt --
34type TMM = CInt -> CInt -> PD -> TM -- 37type TMM = CInt -> CInt -> PD -> TM --
35type TVMM = CInt -> PD -> TMM -- 38type TVMM = CInt -> PD -> TMM --
@@ -61,6 +64,7 @@ type TQVQVQV = CInt -> PQ -> TQVQV --
61type TQVF = CInt -> PQ -> TF -- 64type TQVF = CInt -> PQ -> TF --
62type TQM = CInt -> CInt -> PQ -> IO CInt -- 65type TQM = CInt -> CInt -> PQ -> IO CInt --
63type TQMQM = CInt -> CInt -> PQ -> TQM -- 66type TQMQM = CInt -> CInt -> PQ -> TQM --
67type TQMQMQM = CInt -> CInt -> PQ -> TQMQM --
64type TCMCV = CInt -> CInt -> PC -> TCV -- 68type TCMCV = CInt -> CInt -> PC -> TCV --
65type TVCV = CInt -> PD -> TCV -- 69type TVCV = CInt -> PD -> TCV --
66type TCVM = CInt -> PC -> TM -- 70type TCVM = CInt -> PC -> TM --
diff --git a/lib/Data/Packed/Internal/Vector.hs b/lib/Data/Packed/Internal/Vector.hs
index ac2d0d7..c8cc2c2 100644
--- a/lib/Data/Packed/Internal/Vector.hs
+++ b/lib/Data/Packed/Internal/Vector.hs
@@ -21,7 +21,7 @@ module Data.Packed.Internal.Vector (
21 mapVectorM, mapVectorM_, 21 mapVectorM, mapVectorM_,
22 foldVector, foldVectorG, foldLoop, 22 foldVector, foldVectorG, foldLoop,
23 createVector, vec, 23 createVector, vec,
24 asComplex, asReal, 24 asComplex, asReal, float2DoubleV, double2FloatV,
25 fwriteVector, freadVector, fprintfVector, fscanfVector, 25 fwriteVector, freadVector, fprintfVector, fscanfVector,
26 cloneVector, 26 cloneVector,
27 unsafeToForeignPtr, 27 unsafeToForeignPtr,
@@ -274,6 +274,24 @@ asComplex :: (RealFloat a, Storable a) => Vector a -> Vector (Complex a)
274asComplex v = unsafeFromForeignPtr (castForeignPtr fp) (i `div` 2) (n `div` 2) 274asComplex v = unsafeFromForeignPtr (castForeignPtr fp) (i `div` 2) (n `div` 2)
275 where (fp,i,n) = unsafeToForeignPtr v 275 where (fp,i,n) = unsafeToForeignPtr v
276 276
277---------------------------------------------------------------
278
279float2DoubleV :: Vector Float -> Vector Double
280float2DoubleV v = unsafePerformIO $ do
281 r <- createVector (dim v)
282 app2 c_float2double vec v vec r "float2double"
283 return r
284
285double2FloatV :: Vector Double -> Vector Float
286double2FloatV v = unsafePerformIO $ do
287 r <- createVector (dim v)
288 app2 c_double2float vec v vec r "double2float2"
289 return r
290
291
292foreign import ccall "float2double" c_float2double:: TFV
293foreign import ccall "double2float" c_double2float:: TVF
294
277---------------------------------------------------------------- 295----------------------------------------------------------------
278 296
279cloneVector :: Storable t => Vector t -> IO (Vector t) 297cloneVector :: Storable t => Vector t -> IO (Vector t)