diff options
Diffstat (limited to 'packages/base/src/Internal/Container.hs')
-rw-r--r-- | packages/base/src/Internal/Container.hs | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/packages/base/src/Internal/Container.hs b/packages/base/src/Internal/Container.hs index 1520489..d64523d 100644 --- a/packages/base/src/Internal/Container.hs +++ b/packages/base/src/Internal/Container.hs | |||
@@ -38,9 +38,14 @@ import Prelude hiding ((<>)) | |||
38 | {- | Creates a real vector containing a range of values: | 38 | {- | Creates a real vector containing a range of values: |
39 | 39 | ||
40 | >>> linspace 5 (-3,7::Double) | 40 | >>> linspace 5 (-3,7::Double) |
41 | fromList [-3.0,-0.5,2.0,4.5,7.0]@ | 41 | [-3.0,-0.5,2.0,4.5,7.0] |
42 | it :: Vector Double | ||
42 | 43 | ||
43 | >>> linspace 5 (8,2+i) :: Vector (Complex Double) | 44 | >>> linspace 5 (8,2+i) :: Vector (Complex Double) |
45 | |||
46 | <interactive>:6:17: ERROR: | ||
47 | Variable not in scope: i :: Complex Double | ||
48 | |||
44 | fromList [8.0 :+ 0.0,6.5 :+ 0.25,5.0 :+ 0.5,3.5 :+ 0.75,2.0 :+ 1.0] | 49 | fromList [8.0 :+ 0.0,6.5 :+ 0.25,5.0 :+ 0.5,3.5 :+ 0.75,2.0 :+ 1.0] |
45 | 50 | ||
46 | Logarithmic spacing can be defined as follows: | 51 | Logarithmic spacing can be defined as follows: |
@@ -85,7 +90,8 @@ infixr 8 <.> | |||
85 | >>> let v = vector [10,20,30] | 90 | >>> let v = vector [10,20,30] |
86 | 91 | ||
87 | >>> m #> v | 92 | >>> m #> v |
88 | fromList [140.0,320.0] | 93 | [140.0,320.0] |
94 | it :: Vector Numeric.LinearAlgebra.Data.R | ||
89 | 95 | ||
90 | -} | 96 | -} |
91 | infixr 8 #> | 97 | infixr 8 #> |
@@ -134,10 +140,12 @@ v = vector [13.0,27.0,1.0] | |||
134 | 140 | ||
135 | >>> let x = a <\> v | 141 | >>> let x = a <\> v |
136 | >>> x | 142 | >>> x |
137 | fromList [3.0799999999999996,5.159999999999999] | 143 | [3.0799999999999996,5.159999999999999] |
144 | it :: Vector Numeric.LinearAlgebra.Data.R | ||
138 | 145 | ||
139 | >>> a #> x | 146 | >>> a #> x |
140 | fromList [13.399999999999999,26.799999999999997,1.0] | 147 | [13.399999999999999,26.799999999999997,0.9999999999999991] |
148 | it :: Vector Numeric.LinearAlgebra.Data.R | ||
141 | 149 | ||
142 | It also admits multiple right-hand sides stored as columns in a matrix. | 150 | It also admits multiple right-hand sides stored as columns in a matrix. |
143 | 151 | ||
@@ -165,7 +173,8 @@ class Build d f c e | d -> c, c -> d, f -> e, f -> d, f -> c, c e -> f, d e -> f | |||
165 | where | 173 | where |
166 | -- | | 174 | -- | |
167 | -- >>> build 5 (**2) :: Vector Double | 175 | -- >>> build 5 (**2) :: Vector Double |
168 | -- fromList [0.0,1.0,4.0,9.0,16.0] | 176 | -- [0.0,1.0,4.0,9.0,16.0] |
177 | -- it :: Vector Double | ||
169 | -- | 178 | -- |
170 | -- Hilbert matrix of order N: | 179 | -- Hilbert matrix of order N: |
171 | -- | 180 | -- |
@@ -203,6 +212,17 @@ optimiseMult = mconcat | |||
203 | {- | Compute mean vector and covariance matrix of the rows of a matrix. | 212 | {- | Compute mean vector and covariance matrix of the rows of a matrix. |
204 | 213 | ||
205 | >>> meanCov $ gaussianSample 666 1000 (fromList[4,5]) (diagl[2,3]) | 214 | >>> meanCov $ gaussianSample 666 1000 (fromList[4,5]) (diagl[2,3]) |
215 | |||
216 | <interactive>:4:52: ERROR: | ||
217 | • Couldn't match expected type ‘Herm Double’ | ||
218 | with actual type ‘Matrix Double’ | ||
219 | • In the fourth argument of ‘gaussianSample’, namely | ||
220 | ‘(diagl [2, 3])’ | ||
221 | In the second argument of ‘($)’, namely | ||
222 | ‘gaussianSample 666 1000 (fromList [4, 5]) (diagl [2, 3])’ | ||
223 | In the expression: | ||
224 | meanCov $ gaussianSample 666 1000 (fromList [4, 5]) (diagl [2, 3]) | ||
225 | |||
206 | (fromList [4.010341078059521,5.0197204699640405], | 226 | (fromList [4.010341078059521,5.0197204699640405], |
207 | (2><2) | 227 | (2><2) |
208 | [ 1.9862461923890056, -1.0127225830525157e-2 | 228 | [ 1.9862461923890056, -1.0127225830525157e-2 |