From 34380f2b5d7b048a4d68197f16a8db0e53742030 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Sat, 8 Sep 2007 09:46:33 +0000 Subject: type classes --- lib/GSL/Vector.hs | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) (limited to 'lib/GSL/Vector.hs') diff --git a/lib/GSL/Vector.hs b/lib/GSL/Vector.hs index 0b3c3a9..b405ff8 100644 --- a/lib/GSL/Vector.hs +++ b/lib/GSL/Vector.hs @@ -17,8 +17,7 @@ module GSL.Vector ( FunCodeS(..), toScalarR, FunCodeV(..), vectorMapR, vectorMapC, FunCodeSV(..), vectorMapValR, vectorMapValC, - FunCodeVV(..), vectorZipR, vectorZipC, - scale, addConstant, add, sub, mul, + FunCodeVV(..), vectorZipR, vectorZipC ) where import Data.Packed.Internal.Common @@ -70,34 +69,6 @@ data FunCodeS = Norm2 | Min deriving Enum - -scale :: (Num a, Field a) => a -> Vector a -> Vector a -scale x v | isReal baseOf v = scast $ vectorMapValR Scale (scast x) (scast v) - | isComp baseOf v = scast $ vectorMapValC Scale (scast x) (scast v) - | otherwise = fromList $ map (*x) $ toList v - -addConstant :: (Num a, Field a) => a -> Vector a -> Vector a -addConstant x v | isReal baseOf v = scast $ vectorMapValR AddConstant (scast x) (scast v) - | isComp baseOf v = scast $ vectorMapValC AddConstant (scast x) (scast v) - | otherwise = fromList $ map (*x) $ toList v - -add :: (Num a, Field a) => Vector a -> Vector a -> Vector a -add u v | isReal baseOf v = scast $ vectorZipR Add (scast u) (scast v) - | isComp baseOf v = scast $ vectorZipC Add (scast u) (scast v) - | otherwise = fromList $ zipWith (+) (toList u) (toList v) - -sub :: (Num a, Field a) => Vector a -> Vector a -> Vector a -sub u v | isReal baseOf v = scast $ vectorZipR Sub (scast u) (scast v) - | isComp baseOf v = scast $ vectorZipC Sub (scast u) (scast v) - | otherwise = fromList $ zipWith (-) (toList u) (toList v) - -mul :: (Num a, Field a) => Vector a -> Vector a -> Vector a -mul u v | isReal baseOf v = scast $ vectorZipR Mul (scast u) (scast v) - | isComp baseOf v = scast $ vectorZipC Mul (scast u) (scast v) - | otherwise = fromList $ zipWith (*) (toList u) (toList v) - - - ------------------------------------------------------------------ toScalarAux fun code v = unsafePerformIO $ do -- cgit v1.2.3