|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.numericalmethod.suanshu.stats.random.multivariate.Gaussian
public class Gaussian
This class generates multivariate Normal random numbers by implementing the "Best Approximation of Indefinite Matrices" in the reference.
In the case where the covariance matrix is not positive definite, we force the diagonal elements in the eigen decomposition to a small non-negative number, e.g., 0.
Then, we re-construct a positive definite matrix from the new diagonal elements.
The R equivalent function is rmvnorm in package mvtnorm.
| Constructor Summary | |
|---|---|
Gaussian(Vector mu,
Matrix sigma)
Construct a multivariate Gaussian random vector generator. |
|
Gaussian(Vector mu,
Matrix sigma,
RandomNumberGenerator rng,
double epsilon)
Construct a multivariate Gaussian random vector generator. |
|
| Method Summary | |
|---|---|
double[] |
nextVector()
Get the next random vector. |
void |
seed(long... seeds)
Seed the random number generator to produce repeatable sequences. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Gaussian(Vector mu,
Matrix sigma,
RandomNumberGenerator rng,
double epsilon)
mu - the meansigma - the covariance matrixrng - a uniform random number generatorepsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
public Gaussian(Vector mu,
Matrix sigma)
mu - the meansigma - the covariance matrix| Method Detail |
|---|
public void seed(long... seeds)
RandomVectorGenerator
seed in interface RandomVectorGeneratorseeds - the seedspublic double[] nextVector()
RandomVectorGenerator
nextVector in interface RandomVectorGenerator
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||