summaryrefslogtreecommitdiff
path: root/lib/Numeric/Container.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Numeric/Container.hs')
-rw-r--r--lib/Numeric/Container.hs15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/Numeric/Container.hs b/lib/Numeric/Container.hs
index 5339c7e..d1ce588 100644
--- a/lib/Numeric/Container.hs
+++ b/lib/Numeric/Container.hs
@@ -105,28 +105,35 @@ cdot u v = udot (conj u) v
105class Contraction a b c | a b -> c, a c -> b, b c -> a 105class Contraction a b c | a b -> c, a c -> b, b c -> a
106 where 106 where
107 infixl 7 <> 107 infixl 7 <>
108 {- | matrix-matrix product, matrix-vector product, unconjugated dot product 108 {- | Matrix-matrix product, matrix-vector product, and unconjugated dot product
109 109
110>>> let a = (3><4) [1..] :: Matrix Double 110>>> let a = (3><4) [1..] :: Matrix Double
111
112>>> a 111>>> a
113(3><4) 112(3><4)
114 [ 1.0, 2.0, 3.0, 4.0 113 [ 1.0, 2.0, 3.0, 4.0
115 , 5.0, 6.0, 7.0, 8.0 114 , 5.0, 6.0, 7.0, 8.0
116 , 9.0, 10.0, 11.0, 12.0 ] 115 , 9.0, 10.0, 11.0, 12.0 ]
117 116
117matrix × matrix:
118
118>>> disp 2 (a <> trans a) 119>>> disp 2 (a <> trans a)
1193x3 1203x3
120 30 70 110 121 30 70 110
121 70 174 278 122 70 174 278
122110 278 446 123110 278 446
123 124
125matrix × vector:
126
124>>> a <> fromList [1,0,2,-1::Double] 127>>> a <> fromList [1,0,2,-1::Double]
125fromList [3.0,11.0,19.0] 128fromList [3.0,11.0,19.0]
126 129
130vector × matrix:
131
127>>> fromList [1,2,3::Double] <> a 132>>> fromList [1,2,3::Double] <> a
128fromList [38.0,44.0,50.0,56.0] 133fromList [38.0,44.0,50.0,56.0]
129 134
135unconjugated dot product:
136
130>>> fromList [1,i] <> fromList[2*i+1,3] 137>>> fromList [1,i] <> fromList[2*i+1,3]
1311.0 :+ 5.0 1381.0 :+ 5.0
132 139
@@ -160,9 +167,9 @@ instance LSDiv Matrix Matrix where
160 167
161-------------------------------------------------------- 168--------------------------------------------------------
162 169
163{- | dot product : @u · v = 'cdot' u v@ 170{- | Dot product : @u · v = 'cdot' u v@
164 171
165 unicode 0x00b7, Alt-Gr . 172 (unicode 0x00b7, Alt-Gr .)
166 173
167>>> fromList [1,i] · fromList[2*i+1,3] 174>>> fromList [1,i] · fromList[2*i+1,3]
1681.0 :+ (-1.0) 1751.0 :+ (-1.0)