Matrix.randomSPD constructor
Matrix.randomSPD(})
Returns randomly filled symmetric and positive definite matrix of
size
xsize
dimension
Keep in mind that min
and max
are constraints for a random
intermediate matrix which is used to build the result matrix
Implementation
factory Matrix.randomSPD(int size,
{DType dtype = DType.float32,
num min = -1000,
num max = 1000,
int? seed}) {
final A =
Matrix.random(size, size, dtype: dtype, max: max, min: min, seed: seed);
return A * A.transpose() + Matrix.scalar(size * 1.0, size, dtype: dtype);
}