@@ -19,28 +19,36 @@ under the License.
1919package io .github .mandar2812 .dynaml .probability
2020
2121import breeze .linalg .{DenseMatrix , DenseVector }
22- import breeze .stats .distributions .{ContinuousDistr , Gaussian , Moments , MultivariateGaussian }
22+ import breeze .stats .distributions .{ContinuousDistr , Moments }
2323import io .github .mandar2812 .dynaml .algebra .{PartitionedPSDMatrix , PartitionedVector }
2424import io .github .mandar2812 .dynaml .analysis .{PartitionedVectorField , VectorField }
2525import io .github .mandar2812 .dynaml .pipes .DataPipe
2626import io .github .mandar2812 .dynaml .probability .distributions ._
27- import spire .implicits ._
2827import spire .algebra .Field
2928
30- abstract class AbstractGaussianRV [T , V , Distr <: ContinuousDistr [T ] with Moments [T , V ] with HasErrorBars [T ]]
31- extends ContinuousRVWithDistr [T , Distr ] {
29+ /**
30+ * <h3>Gaussian Random Variable</h3>
31+ * */
32+ abstract class AbstractGaussianRV [
33+ T , V , Distr <: ContinuousDistr [T ] with Moments [T , V ] with HasErrorBars [T ]] extends
34+ ContinuousRVWithDistr [T , Distr ] {
3235
3336 override val sample = DataPipe (() => underlyingDist.sample())
3437}
3538
3639/**
40+ * Univariate gaussian random variable
3741 * @author mandar2812 on 26/7/16.
3842 * */
3943case class GaussianRV (mu : Double , sigma : Double ) extends
4044 AbstractGaussianRV [Double , Double , UnivariateGaussian ] {
4145 override val underlyingDist = new UnivariateGaussian (mu, sigma)
4246}
4347
48+ /**
49+ * Multivariate gaussian random variable
50+ * @author mandar2812
51+ * */
4452case class MultGaussianRV (
4553 mu : DenseVector [Double ], covariance : DenseMatrix [Double ])(
4654 implicit ev : Field [DenseVector [Double ]])
@@ -63,6 +71,10 @@ object MultGaussianRV {
6371 }
6472}
6573
74+ /**
75+ * Multivariate blocked gaussian random variable
76+ * @author mandar2812
77+ * */
6678case class MultGaussianPRV (
6779 mu : PartitionedVector ,
6880 covariance : PartitionedPSDMatrix )(
@@ -87,10 +99,23 @@ object MultGaussianPRV {
8799
88100}
89101
102+ /**
103+ * Matrix gaussian random variable
104+ * */
90105case class MatrixNormalRV (
91106 m : DenseMatrix [Double ], u : DenseMatrix [Double ],
92107 v : DenseMatrix [Double ]) extends AbstractGaussianRV [
93108 DenseMatrix [Double ], (DenseMatrix [Double ], DenseMatrix [Double ]), MatrixNormal ] {
94109
95110 override val underlyingDist = MatrixNormal (m, u, v)
111+ }
112+
113+ object MatrixNormalRV {
114+
115+ def apply (
116+ m : DenseMatrix [Double ],
117+ u : DenseMatrix [Double ],
118+ v : DenseMatrix [Double ]): MatrixNormalRV =
119+ new MatrixNormalRV (m, u, v)
120+
96121}
0 commit comments