summaryrefslogtreecommitdiff
path: root/packages/base/src/Data
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2014-05-28 12:16:34 +0200
committerAlberto Ruiz <aruiz@um.es>2014-05-28 12:16:34 +0200
commit2734dd1ddc6b31aba6377ef969a33967babca519 (patch)
tree5a353499f64d2c4defba6d517628c904cbc82036 /packages/base/src/Data
parent3c1c5e59e3d699f3e17519f19d47f7dab2403879 (diff)
fix static blocks, GMatrix
Diffstat (limited to 'packages/base/src/Data')
-rw-r--r--packages/base/src/Data/Packed/Numeric.hs28
1 files changed, 2 insertions, 26 deletions
diff --git a/packages/base/src/Data/Packed/Numeric.hs b/packages/base/src/Data/Packed/Numeric.hs
index 7d88cbc..e324ab6 100644
--- a/packages/base/src/Data/Packed/Numeric.hs
+++ b/packages/base/src/Data/Packed/Numeric.hs
@@ -40,9 +40,9 @@ module Data.Packed.Numeric (
40 step, cond, find, assoc, accum, 40 step, cond, find, assoc, accum,
41 Transposable(..), Linear(..), 41 Transposable(..), Linear(..),
42 -- * Matrix product 42 -- * Matrix product
43 Product(..), udot, dot, (◇), (<·>), (#>), 43 Product(..), udot, dot, (<·>), (#>),
44 Mul(..), 44 Mul(..),
45 Contraction(..),(<.>), 45 (<.>),
46 optimiseMult, 46 optimiseMult,
47 mXm,mXv,vXm,LSDiv,(<\>), 47 mXm,mXv,vXm,LSDiv,(<\>),
48 outer, kronecker, 48 outer, kronecker,
@@ -140,25 +140,6 @@ fromList [10.0 :+ 4.0,12.0 :+ 4.0,14.0 :+ 4.0,16.0 :+ 4.0]
140-} 140-}
141 141
142 142
143
144
145class Contraction a b c | a b -> c
146 where
147 -- | Matrix product, matrix - vector product, and dot product
148 contraction :: a -> b -> c
149
150instance (Product t, Container Vector t) => Contraction (Vector t) (Vector t) t where
151 u `contraction` v = conj u `udot` v
152
153instance Product t => Contraction (Matrix t) (Vector t) (Vector t) where
154 contraction = mXv
155
156instance (Container Vector t, Product t) => Contraction (Vector t) (Matrix t) (Vector t) where
157 contraction v m = (conj v) `vXm` m
158
159instance Product t => Contraction (Matrix t) (Matrix t) (Matrix t) where
160 contraction = mXm
161
162-------------------------------------------------------------------------------- 143--------------------------------------------------------------------------------
163 144
164infixl 7 <.> 145infixl 7 <.>
@@ -265,11 +246,6 @@ instance Container Matrix e => Build (Int,Int) (e -> e -> e) Matrix e
265 246
266-------------------------------------------------------------------------------- 247--------------------------------------------------------------------------------
267 248
268-- | alternative unicode symbol (25c7) for 'contraction'
269(◇) :: Contraction a b c => a -> b -> c
270infixl 7 ◇
271(◇) = contraction
272
273-- | dot product: @cdot u v = 'udot' ('conj' u) v@ 249-- | dot product: @cdot u v = 'udot' ('conj' u) v@
274dot :: (Container Vector t, Product t) => Vector t -> Vector t -> t 250dot :: (Container Vector t, Product t) => Vector t -> Vector t -> t
275dot u v = udot (conj u) v 251dot u v = udot (conj u) v