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.hs31
1 files changed, 18 insertions, 13 deletions
diff --git a/packages/base/src/Internal/Container.hs b/packages/base/src/Internal/Container.hs
index 282163e..a498069 100644
--- a/packages/base/src/Internal/Container.hs
+++ b/packages/base/src/Internal/Container.hs
@@ -40,10 +40,12 @@ 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:+1) :: Vector (Complex Double)
46fromList [8.0 :+ 0.0,6.5 :+ 0.25,5.0 :+ 0.5,3.5 :+ 0.75,2.0 :+ 1.0] 47[8.0 :+ 0.0,6.5 :+ 0.25,5.0 :+ 0.5,3.5 :+ 0.75,2.0 :+ 1.0]
48it :: Vector (Complex Double)
47 49
48Logarithmic spacing can be defined as follows: 50Logarithmic spacing can be defined as follows:
49 51
@@ -87,7 +89,8 @@ infixr 8 <.>
87>>> let v = vector [10,20,30] 89>>> let v = vector [10,20,30]
88 90
89>>> m #> v 91>>> m #> v
90fromList [140.0,320.0] 92[140.0,320.0]
93it :: Vector Numeric.LinearAlgebra.Data.R
91 94
92-} 95-}
93infixr 8 #> 96infixr 8 #>
@@ -136,10 +139,12 @@ v = vector [13.0,27.0,1.0]
136 139
137>>> let x = a <\> v 140>>> let x = a <\> v
138>>> x 141>>> x
139fromList [3.0799999999999996,5.159999999999999] 142[3.0799999999999996,5.159999999999999]
143it :: Vector Numeric.LinearAlgebra.Data.R
140 144
141>>> a #> x 145>>> a #> x
142fromList [13.399999999999999,26.799999999999997,1.0] 146[13.399999999999999,26.799999999999997,0.9999999999999991]
147it :: Vector Numeric.LinearAlgebra.Data.R
143 148
144It also admits multiple right-hand sides stored as columns in a matrix. 149It also admits multiple right-hand sides stored as columns in a matrix.
145 150
@@ -167,7 +172,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 172 where
168 -- | 173 -- |
169 -- >>> build 5 (**2) :: Vector Double 174 -- >>> build 5 (**2) :: Vector Double
170 -- fromList [0.0,1.0,4.0,9.0,16.0] 175 -- [0.0,1.0,4.0,9.0,16.0]
176 -- it :: Vector Double
171 -- 177 --
172 -- Hilbert matrix of order N: 178 -- Hilbert matrix of order N:
173 -- 179 --
@@ -204,12 +210,11 @@ optimiseMult = mconcat
204 210
205{- | Compute mean vector and covariance matrix of the rows of a matrix. 211{- | Compute mean vector and covariance matrix of the rows of a matrix.
206 212
207>>> meanCov $ gaussianSample 666 1000 (fromList[4,5]) (diagl[2,3]) 213>>> meanCov $ gaussianSample 666 1000 (fromList[4,5]) (trustSym $ diagl [2,3])
208(fromList [4.010341078059521,5.0197204699640405], 214([3.9933155655086696,5.061409102770331],Herm (2><2)
209(2><2) 215 [ 1.9963242906624408, -4.227815571404954e-2
210 [ 1.9862461923890056, -1.0127225830525157e-2 216 , -4.227815571404954e-2, 3.2003833097832857 ])
211 , -1.0127225830525157e-2, 3.0373954915729318 ]) 217it :: (Vector Double, Herm Double)
212
213-} 218-}
214meanCov :: Matrix Double -> (Vector Double, Herm Double) 219meanCov :: Matrix Double -> (Vector Double, Herm Double)
215meanCov x = (med,cov) where 220meanCov x = (med,cov) where