From 4957cff8af91cbb23c12382e25f5373fe96acb95 Mon Sep 17 00:00:00 2001 From: Vivian McPhail Date: Tue, 29 Jun 2010 09:03:19 +0000 Subject: add-vector-float --- lib/Numeric/GSL/Vector.hs | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'lib/Numeric/GSL/Vector.hs') diff --git a/lib/Numeric/GSL/Vector.hs b/lib/Numeric/GSL/Vector.hs index 28c3b06..d09323b 100644 --- a/lib/Numeric/GSL/Vector.hs +++ b/lib/Numeric/GSL/Vector.hs @@ -14,10 +14,10 @@ ----------------------------------------------------------------------------- module Numeric.GSL.Vector ( - FunCodeS(..), toScalarR, - FunCodeV(..), vectorMapR, vectorMapC, - FunCodeSV(..), vectorMapValR, vectorMapValC, - FunCodeVV(..), vectorZipR, vectorZipC, + FunCodeS(..), toScalarR, toScalarF, + FunCodeV(..), vectorMapR, vectorMapC, vectorMapF, + FunCodeSV(..), vectorMapValR, vectorMapValC, vectorMapValF, + FunCodeVV(..), vectorZipR, vectorZipC, vectorZipF, RandDist(..), randomVector ) where @@ -106,6 +106,12 @@ toScalarR oper = toScalarAux c_toScalarR (fromei oper) foreign import ccall safe "gsl-aux.h toScalarR" c_toScalarR :: CInt -> TVV +-- | obtains different functions of a vector: norm1, norm2, max, min, posmax, posmin, etc. +toScalarF :: FunCodeS -> Vector Float -> Float +toScalarF oper = toScalarAux c_toScalarF (fromei oper) + +foreign import ccall safe "gsl-aux.h toScalarF" c_toScalarF :: CInt -> TFF + ------------------------------------------------------------------ -- | map of real vectors with given function @@ -120,6 +126,12 @@ vectorMapC oper = vectorMapAux c_vectorMapC (fromei oper) foreign import ccall safe "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 safe "gsl-aux.h mapF" c_vectorMapF :: CInt -> TFF + ------------------------------------------------------------------- -- | map of real vectors with given function @@ -134,6 +146,12 @@ vectorMapValC = vectorMapValAux c_vectorMapValC foreign import ccall safe "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 safe "gsl-aux.h mapValF" c_vectorMapValF :: CInt -> Ptr Float -> TFF + ------------------------------------------------------------------- -- | elementwise operation on real vectors @@ -148,6 +166,12 @@ vectorZipC = vectorZipAux c_vectorZipC foreign import ccall safe "gsl-aux.h zipC" c_vectorZipC :: CInt -> TCVCVCV +-- | elementwise operation on real vectors +vectorZipF :: FunCodeVV -> Vector Float -> Vector Float -> Vector Float +vectorZipF = vectorZipAux c_vectorZipF + +foreign import ccall safe "gsl-aux.h zipF" c_vectorZipF :: CInt -> TFFF + ----------------------------------------------------------------------- data RandDist = Uniform -- ^ uniform distribution in [0,1) -- cgit v1.2.3