/// <summary> /// N(mu, sigma) /// </summary> /// <param name="l">lower bound</param> /// <param name="u">upper bound</param> public MultivariateNormalDistribution(PZMath_vector m, PZMath_matrix s) { dimension = m.Size; mu = new PZMath_vector(dimension); mu.MemCopyFrom(m); sigma = new PZMath_matrix(dimension, dimension); sigma.MemCopyFrom(s); if (dimension != sigma.RowCount || dimension != sigma.ColumnCount) throw new ApplicationException("MultivariateNormalDistribution::MultivariateNormalDistribution(), mu and sigma in different dimension!"); Init(); }
/// <summary> /// sigma is a diagonal matrix /// </summary> /// <param name="m"></param> /// <param name="diag"></param> public MultivariateNormalDistribution(PZMath_vector m, PZMath_vector diag) { if (m.Size != diag.Size) throw new ApplicationException("MultivariateNormalDistribution::MultivariateNormalDistribution(), mu and sigma in different dimension!"); dimension = m.Size; mu = new PZMath_vector(dimension); mu.MemCopyFrom(m); sigma = new PZMath_matrix(dimension, dimension); for (int i = 0; i < dimension; i ++) sigma[i, i] = diag[i]; Init(); }