public void setParameters(DoubleMatrix2D A, DoubleMatrix2D B) { // do not allocate mem for "D" --> safe some mem this.A = A; this.B = B; this.C = A.copy(); } public void init() { C.assign(0); }
/** * Returns the lower-triangular matrix * <SPAN CLASS="MATH"><B>A</B></SPAN> in the * Cholesky decomposition of * <SPAN CLASS="MATH"><I><B>Σ</B></I></SPAN>. * * @return the Cholesky decomposition of the covariance matrix. * */ public DoubleMatrix2D getCholeskyDecompSigma() { return sqrtSigma.copy(); }
/** * Returns the matrix * <SPAN CLASS="MATH"><B>A</B> = <B>V</B>()<SUP>1/2</SUP></SPAN> of this object. * * @return the PCA square root of the covariance matrix * */ public DoubleMatrix2D getPCADecompSigma() { return sqrtSigma.copy(); }
/** Returns a copy of the combined lower and upper triangular factor, <tt>LU</tt>. @return <tt>LU</tt> */ public DoubleMatrix2D getLU() { return LU.copy(); } /**
/** * Returns the covariance matrix * <SPAN CLASS="MATH"><I><B>Σ</B></I></SPAN> * used by this generator. * * @return the used covariance matrix. * */ public DoubleMatrix2D getSigma() { return sigma.copy(); }
/** Returns the Householder vectors <tt>H</tt>. @return A lower trapezoidal matrix whose columns define the householder reflections. */ public DoubleMatrix2D getH () { return Algebra.DEFAULT.trapezoidalLower(QR.copy()); } /**
/** Returns the upper triangular factor, <tt>U</tt>. @return <tt>U</tt> */ public DoubleMatrix2D getU() { return upperTriangular(LU.copy()); } /**
/** Returns the lower triangular factor, <tt>L</tt>. @return <tt>L</tt> */ public DoubleMatrix2D getL() { return lowerTriangular(LU.copy()); } /**
/** Returns the Householder vectors <tt>H</tt>. @return A lower trapezoidal matrix whose columns define the householder reflections. */ public DoubleMatrix2D getH () { return Algebra.DEFAULT.trapezoidalLower(QR.copy()); } /**
/** Returns the lower triangular factor, <tt>L</tt>. @return <tt>L</tt> */ public DoubleMatrix2D getL() { return lowerTriangular(LU.copy()); } /**
/** Returns the upper triangular factor, <tt>U</tt>. @return <tt>U</tt> */ public DoubleMatrix2D getU() { return upperTriangular(LU.copy()); } /**
/** Constructs and returns a new LU Decomposition object; The decomposed matrices can be retrieved via instance methods of the returned decomposition object. @param A Rectangular matrix @return Structure to access L, U and piv. */ public LUDecomposition(DoubleMatrix2D A) { quick = new LUDecompositionQuick(0); // zero tolerance for compatibility with Jama quick.decompose(A.copy()); } /**
/** Constructs and returns a new LU Decomposition object; The decomposed matrices can be retrieved via instance methods of the returned decomposition object. @param A Rectangular matrix @return Structure to access L, U and piv. */ public LUDecomposition(DoubleMatrix2D A) { quick = new LUDecompositionQuick(0); // zero tolerance for compatibility with Jama quick.decompose(A.copy()); } /**
/** * @TODO: check this!!! * @see "http://mathworld.wolfram.com/PositiveDefiniteMatrix.html" */ public static DoubleMatrix2D randomValuesPositiveMatrix(int rows, int cols, double min, double max, Long seed) { DoubleMatrix2D Q = Utils.randomValuesMatrix(rows, cols, min, max, seed); DoubleMatrix2D P = Algebra.DEFAULT.mult(Q, Algebra.DEFAULT.transpose(Q.copy())); return Algebra.DEFAULT.mult(P, P); }