From 1871acb835b4fc164bcff3f6e7467884b87fbd0f Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Mon, 25 Jun 2007 07:32:56 +0000 Subject: l.a. algorithms, etc. --- lib/GSL/Vector.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/GSL/Vector.hs') diff --git a/lib/GSL/Vector.hs b/lib/GSL/Vector.hs index a772b34..a074254 100644 --- a/lib/GSL/Vector.hs +++ b/lib/GSL/Vector.hs @@ -18,7 +18,7 @@ module GSL.Vector ( FunCodeV(..), vectorMapR, vectorMapC, FunCodeSV(..), vectorMapValR, vectorMapValC, FunCodeVV(..), vectorZipR, vectorZipC, - scale, addConstant, add, mul, + scale, addConstant, add, sub, mul, ) where import Data.Packed.Internal @@ -84,6 +84,11 @@ 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) -- cgit v1.2.3