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