diff options
author | Alberto Ruiz <aruiz@um.es> | 2014-04-24 10:30:01 +0200 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2014-04-24 10:30:01 +0200 |
commit | 6fbed842525491e280448a00a4b5426e6830ccaa (patch) | |
tree | b78d2712f7ac23845fc29120d3a9fbcd7d189004 /examples | |
parent | 7c5adb83c9cb632c39eb2d844a1496e2a7a23e8b (diff) |
cdot and (×)
added cdot
dot renamed to udot
<.> changed to cdot and moved to Numeric.LinearAlgebra.Util
new general contraction operator (×)
Plot functions moved to Numeric.LinearAlgebra.Util
Diffstat (limited to 'examples')
-rw-r--r-- | examples/multiply.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/multiply.hs b/examples/multiply.hs index d7c74ee..fbfb9d7 100644 --- a/examples/multiply.hs +++ b/examples/multiply.hs | |||
@@ -6,7 +6,7 @@ | |||
6 | -- , OverlappingInstances | 6 | -- , OverlappingInstances |
7 | , UndecidableInstances #-} | 7 | , UndecidableInstances #-} |
8 | 8 | ||
9 | import Numeric.LinearAlgebra | 9 | import Numeric.LinearAlgebra hiding (Contraction(..)) |
10 | 10 | ||
11 | class Scaling a b c | a b -> c where | 11 | class Scaling a b c | a b -> c where |
12 | -- ^ 0x22C5 8901 DOT OPERATOR, scaling | 12 | -- ^ 0x22C5 8901 DOT OPERATOR, scaling |
@@ -43,7 +43,7 @@ instance Container Vector t => Scaling (Matrix t) t (Matrix t) where | |||
43 | 43 | ||
44 | 44 | ||
45 | instance Product t => Contraction (Vector t) (Vector t) t where | 45 | instance Product t => Contraction (Vector t) (Vector t) t where |
46 | (×) = dot | 46 | (×) = udot |
47 | 47 | ||
48 | instance Product t => Contraction (Matrix t) (Vector t) (Vector t) where | 48 | instance Product t => Contraction (Matrix t) (Vector t) (Vector t) where |
49 | (×) = mXv | 49 | (×) = mXv |
@@ -90,9 +90,9 @@ c = v ⊗ m ⊗ v ⊗ m | |||
90 | d = s ⋅ (3 |> [10,20..] :: Vector Double) | 90 | d = s ⋅ (3 |> [10,20..] :: Vector Double) |
91 | 91 | ||
92 | main = do | 92 | main = do |
93 | print $ scale s v <> m <.> v | 93 | print $ (scale s v <> m) `udot` v |
94 | print $ scale s v <.> (m <> v) | 94 | print $ scale s v `udot` (m <> v) |
95 | print $ s * (v <> m <.> v) | 95 | print $ s * ((v <> m) `udot` v) |
96 | print $ s ⋅ v × m × v | 96 | print $ s ⋅ v × m × v |
97 | print a | 97 | print a |
98 | print (b == c) | 98 | print (b == c) |