From 4b0a700c6a39d34bb85c4a1609ab0e6893b1fc5d Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Wed, 14 May 2014 21:20:41 +0200 Subject: moved map real --- packages/base/src/C/vector-aux.c | 16 +++--- packages/hmatrix/src/Numeric/GSL/Vector.hs | 29 +--------- packages/hmatrix/src/Numeric/GSL/gsl-vector.c | 82 --------------------------- 3 files changed, 10 insertions(+), 117 deletions(-) diff --git a/packages/base/src/C/vector-aux.c b/packages/base/src/C/vector-aux.c index 978d6b4..034fa6a 100644 --- a/packages/base/src/C/vector-aux.c +++ b/packages/base/src/C/vector-aux.c @@ -351,13 +351,13 @@ int mapR(int code, KDVEC(x), DVEC(r)) { OP(3,fabs) OP(4,asin) OP(5,acos) - OP(6,atan) /* atan2 mediante vectorZip */ + OP(6,atan) /* atan2 using vectorZip */ OP(7,sinh) OP(8,cosh) OP(9,tanh) -// OP(10,gsl_asinh) -// OP(11,gsl_acosh) -// OP(12,gsl_atanh) + OP(10,asinh) + OP(11,acosh) + OP(12,atanh) OP(13,exp) OP(14,log) OP(15,sign) @@ -377,13 +377,13 @@ int mapF(int code, KFVEC(x), FVEC(r)) { OP(3,fabs) OP(4,asin) OP(5,acos) - OP(6,atan) /* atan2 mediante vectorZip */ + OP(6,atan) /* atan2 using vectorZip */ OP(7,sinh) OP(8,cosh) OP(9,tanh) -// OP(10,gsl_asinh) -// OP(11,gsl_acosh) -// OP(12,gsl_atanh) + OP(10,asinh) + OP(11,acosh) + OP(12,atanh) OP(13,exp) OP(14,log) OP(15,sign) diff --git a/packages/hmatrix/src/Numeric/GSL/Vector.hs b/packages/hmatrix/src/Numeric/GSL/Vector.hs index 27db6ae..7197924 100644 --- a/packages/hmatrix/src/Numeric/GSL/Vector.hs +++ b/packages/hmatrix/src/Numeric/GSL/Vector.hs @@ -28,8 +28,8 @@ import Numeric.Vectorized( sumF, sumR, sumQ, sumC, prodF, prodR, prodQ, prodC, FunCodeS(..), toScalarR, toScalarF, toScalarC, toScalarQ, - FunCodeV(..), - FunCodeSV(..), + FunCodeV(..), vectorMapR, vectorMapF, + FunCodeSV(..), vectorMapValR, vectorMapValF, FunCodeVV(..) ) @@ -65,25 +65,12 @@ vectorZipAux fun code u v = unsafePerformIO $ do --------------------------------------------------------------------- - --- | map of real vectors with given function -vectorMapR :: FunCodeV -> Vector Double -> Vector Double -vectorMapR = vectorMapAux c_vectorMapR - -foreign import ccall unsafe "gsl-aux.h mapR" c_vectorMapR :: CInt -> TVV - -- | map of complex vectors with given function vectorMapC :: FunCodeV -> Vector (Complex Double) -> Vector (Complex Double) vectorMapC oper = vectorMapAux c_vectorMapC (fromei oper) foreign import ccall unsafe "gsl-aux.h mapC" c_vectorMapC :: CInt -> TCVCV --- | map of real vectors with given function -vectorMapF :: FunCodeV -> Vector Float -> Vector Float -vectorMapF = vectorMapAux c_vectorMapF - -foreign import ccall unsafe "gsl-aux.h mapF" c_vectorMapF :: CInt -> TFF - -- | map of real vectors with given function vectorMapQ :: FunCodeV -> Vector (Complex Float) -> Vector (Complex Float) vectorMapQ = vectorMapAux c_vectorMapQ @@ -92,24 +79,12 @@ foreign import ccall unsafe "gsl-aux.h mapQ" c_vectorMapQ :: CInt -> TQVQV ------------------------------------------------------------------- --- | map of real vectors with given function -vectorMapValR :: FunCodeSV -> Double -> Vector Double -> Vector Double -vectorMapValR oper = vectorMapValAux c_vectorMapValR (fromei oper) - -foreign import ccall unsafe "gsl-aux.h mapValR" c_vectorMapValR :: CInt -> Ptr Double -> TVV - -- | map of complex vectors with given function vectorMapValC :: FunCodeSV -> Complex Double -> Vector (Complex Double) -> Vector (Complex Double) vectorMapValC = vectorMapValAux c_vectorMapValC foreign import ccall unsafe "gsl-aux.h mapValC" c_vectorMapValC :: CInt -> Ptr (Complex Double) -> TCVCV --- | map of real vectors with given function -vectorMapValF :: FunCodeSV -> Float -> Vector Float -> Vector Float -vectorMapValF oper = vectorMapValAux c_vectorMapValF (fromei oper) - -foreign import ccall unsafe "gsl-aux.h mapValF" c_vectorMapValF :: CInt -> Ptr Float -> TFF - -- | map of complex vectors with given function vectorMapValQ :: FunCodeSV -> Complex Float -> Vector (Complex Float) -> Vector (Complex Float) vectorMapValQ oper = vectorMapValAux c_vectorMapValQ (fromei oper) diff --git a/packages/hmatrix/src/Numeric/GSL/gsl-vector.c b/packages/hmatrix/src/Numeric/GSL/gsl-vector.c index 1eaf66c..99891d4 100644 --- a/packages/hmatrix/src/Numeric/GSL/gsl-vector.c +++ b/packages/hmatrix/src/Numeric/GSL/gsl-vector.c @@ -132,57 +132,6 @@ inline gsl_complex complex_signum(gsl_complex z) { #define OP(C,F) case C: { for(k=0;k