summaryrefslogtreecommitdiff
path: root/lib/GSL/Vector.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2007-06-25 07:32:56 +0000
committerAlberto Ruiz <aruiz@um.es>2007-06-25 07:32:56 +0000
commit1871acb835b4fc164bcff3f6e7467884b87fbd0f (patch)
treeac1028d40778bbae532c3915276b5af21ba5f5cb /lib/GSL/Vector.hs
parent3d5d6f06598aac00906c93ac5358e68697c47fc7 (diff)
l.a. algorithms, etc.
Diffstat (limited to 'lib/GSL/Vector.hs')
-rw-r--r--lib/GSL/Vector.hs7
1 files changed, 6 insertions, 1 deletions
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 (
18 FunCodeV(..), vectorMapR, vectorMapC, 18 FunCodeV(..), vectorMapR, vectorMapC,
19 FunCodeSV(..), vectorMapValR, vectorMapValC, 19 FunCodeSV(..), vectorMapValR, vectorMapValC,
20 FunCodeVV(..), vectorZipR, vectorZipC, 20 FunCodeVV(..), vectorZipR, vectorZipC,
21 scale, addConstant, add, mul, 21 scale, addConstant, add, sub, mul,
22) where 22) where
23 23
24import Data.Packed.Internal 24import Data.Packed.Internal
@@ -84,6 +84,11 @@ add u v | isReal baseOf v = scast $ vectorZipR Add (scast u) (scast v)
84 | isComp baseOf v = scast $ vectorZipC Add (scast u) (scast v) 84 | isComp baseOf v = scast $ vectorZipC Add (scast u) (scast v)
85 | otherwise = fromList $ zipWith (+) (toList u) (toList v) 85 | otherwise = fromList $ zipWith (+) (toList u) (toList v)
86 86
87sub :: (Num a, Field a) => Vector a -> Vector a -> Vector a
88sub u v | isReal baseOf v = scast $ vectorZipR Sub (scast u) (scast v)
89 | isComp baseOf v = scast $ vectorZipC Sub (scast u) (scast v)
90 | otherwise = fromList $ zipWith (-) (toList u) (toList v)
91
87mul :: (Num a, Field a) => Vector a -> Vector a -> Vector a 92mul :: (Num a, Field a) => Vector a -> Vector a -> Vector a
88mul u v | isReal baseOf v = scast $ vectorZipR Mul (scast u) (scast v) 93mul u v | isReal baseOf v = scast $ vectorZipR Mul (scast u) (scast v)
89 | isComp baseOf v = scast $ vectorZipC Mul (scast u) (scast v) 94 | isComp baseOf v = scast $ vectorZipC Mul (scast u) (scast v)