summaryrefslogtreecommitdiff
path: root/packages/hmatrix/src/Numeric/GSL/Vector.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2014-05-14 20:25:30 +0200
committerAlberto Ruiz <aruiz@um.es>2014-05-14 20:25:30 +0200
commitbdd718066eeb1dffc790d7f48398f24b9201c6ea (patch)
tree4a342f01ce372659c0e7757cecd821de157d411b /packages/hmatrix/src/Numeric/GSL/Vector.hs
parentce03cbdf416db2af2830b4b3b7d1722bb26f6546 (diff)
moved prod
Diffstat (limited to 'packages/hmatrix/src/Numeric/GSL/Vector.hs')
-rw-r--r--packages/hmatrix/src/Numeric/GSL/Vector.hs36
1 files changed, 1 insertions, 35 deletions
diff --git a/packages/hmatrix/src/Numeric/GSL/Vector.hs b/packages/hmatrix/src/Numeric/GSL/Vector.hs
index 33bd778..38c138b 100644
--- a/packages/hmatrix/src/Numeric/GSL/Vector.hs
+++ b/packages/hmatrix/src/Numeric/GSL/Vector.hs
@@ -26,6 +26,7 @@ import Data.Packed
26import Numeric.GSL.Internal hiding (TV,TM,TCV,TCM) 26import Numeric.GSL.Internal hiding (TV,TM,TCV,TCM)
27import Numeric.Vectorized( 27import Numeric.Vectorized(
28 sumF, sumR, sumQ, sumC, 28 sumF, sumR, sumQ, sumC,
29 prodF, prodR, prodQ, prodC,
29 FunCodeS(..), 30 FunCodeS(..),
30 FunCodeV(..), 31 FunCodeV(..),
31 FunCodeSV(..), 32 FunCodeSV(..),
@@ -45,41 +46,6 @@ fromei x = fromIntegral (fromEnum x) :: CInt
45 46
46------------------------------------------------------------------ 47------------------------------------------------------------------
47 48
48-- | product of elements
49prodF :: Vector Float -> Float
50prodF x = unsafePerformIO $ do
51 r <- createVector 1
52 app2 c_prodF vec x vec r "prodF"
53 return $ r @> 0
54
55-- | product of elements
56prodR :: Vector Double -> Double
57prodR x = unsafePerformIO $ do
58 r <- createVector 1
59 app2 c_prodR vec x vec r "prodR"
60 return $ r @> 0
61
62-- | product of elements
63prodQ :: Vector (Complex Float) -> Complex Float
64prodQ x = unsafePerformIO $ do
65 r <- createVector 1
66 app2 c_prodQ vec x vec r "prodQ"
67 return $ r @> 0
68
69-- | product of elements
70prodC :: Vector (Complex Double) -> Complex Double
71prodC x = unsafePerformIO $ do
72 r <- createVector 1
73 app2 c_prodC vec x vec r "prodC"
74 return $ r @> 0
75
76foreign import ccall unsafe "gsl-aux.h prodF" c_prodF :: TFF
77foreign import ccall unsafe "gsl-aux.h prodR" c_prodR :: TVV
78foreign import ccall unsafe "gsl-aux.h prodQ" c_prodQ :: TQVQV
79foreign import ccall unsafe "gsl-aux.h prodC" c_prodC :: TCVCV
80
81------------------------------------------------------------------
82
83toScalarAux fun code v = unsafePerformIO $ do 49toScalarAux fun code v = unsafePerformIO $ do
84 r <- createVector 1 50 r <- createVector 1
85 app2 (fun (fromei code)) vec v vec r "toScalarAux" 51 app2 (fun (fromei code)) vec v vec r "toScalarAux"