diff options
author | Alberto Ruiz <aruiz@um.es> | 2014-05-01 22:47:02 +0200 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2014-05-01 22:47:02 +0200 |
commit | e168d61eb429aa1de2d68075a4b89a8522e44038 (patch) | |
tree | 0abe0286f723b8ee27828c931102e3b9259f0a7a /lib/Numeric/Container.hs | |
parent | cf1379fed234cf99b2ccce6d9311bfc5c58ef4a3 (diff) |
top reexport module
Diffstat (limited to 'lib/Numeric/Container.hs')
-rw-r--r-- | lib/Numeric/Container.hs | 15 |
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 | |||
105 | class Contraction a b c | a b -> c, a c -> b, b c -> a | 105 | class 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 | ||
117 | matrix × matrix: | ||
118 | |||
118 | >>> disp 2 (a <> trans a) | 119 | >>> disp 2 (a <> trans a) |
119 | 3x3 | 120 | 3x3 |
120 | 30 70 110 | 121 | 30 70 110 |
121 | 70 174 278 | 122 | 70 174 278 |
122 | 110 278 446 | 123 | 110 278 446 |
123 | 124 | ||
125 | matrix × vector: | ||
126 | |||
124 | >>> a <> fromList [1,0,2,-1::Double] | 127 | >>> a <> fromList [1,0,2,-1::Double] |
125 | fromList [3.0,11.0,19.0] | 128 | fromList [3.0,11.0,19.0] |
126 | 129 | ||
130 | vector × matrix: | ||
131 | |||
127 | >>> fromList [1,2,3::Double] <> a | 132 | >>> fromList [1,2,3::Double] <> a |
128 | fromList [38.0,44.0,50.0,56.0] | 133 | fromList [38.0,44.0,50.0,56.0] |
129 | 134 | ||
135 | unconjugated dot product: | ||
136 | |||
130 | >>> fromList [1,i] <> fromList[2*i+1,3] | 137 | >>> fromList [1,i] <> fromList[2*i+1,3] |
131 | 1.0 :+ 5.0 | 138 | 1.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] |
168 | 1.0 :+ (-1.0) | 175 | 1.0 :+ (-1.0) |