final double factor = FastMath.sqrt(covMatEigenvalues[row]); for (int col = 0; col < dim; col++) { tmpMatrix.multiplyEntry(row, col, factor);
/** * Find the offset of the ellipsoid. * * @param a the algebraic from of the polynomial. * @return a vector containing the offset of the ellipsoid. */ private RealVector findCenter(RealMatrix a) { RealMatrix subA = a.getSubMatrix(0, 2, 0, 2); for (int q = 0; q < subA.getRowDimension(); q++) { for (int s = 0; s < subA.getColumnDimension(); s++) { subA.multiplyEntry(q, s, -1.0); } } RealVector subV = a.getRowVector(3).getSubVector(0, 3); // inv (dtd) DecompositionSolver solver = new SingularValueDecomposition(subA) .getSolver(); RealMatrix subAi = solver.getInverse(); return subAi.operate(subV); }
/** * Elementwise multiplication of two matrices. * * @param A a matrix that is multiplied by the elements of B * @param B another matrix * @throws DimensionMismatchException */ public static void multiplyElementsBy(RealMatrix A, RealMatrix B)throws DimensionMismatchException { int nrow = A.getRowDimension(); int ncol = A.getColumnDimension(); if(nrow!= B.getRowDimension()){ throw new DimensionMismatchException(nrow, B.getRowDimension()); } if(ncol!= B.getColumnDimension()){ throw new DimensionMismatchException(ncol, B.getColumnDimension()); } RealMatrix M = new Array2DRowRealMatrix(nrow, ncol); for(int i=0;i<nrow;i++){ for(int j=0;j<ncol;j++){ A.multiplyEntry(i,j,B.getEntry(i,j)); } } }
final double factor = Math.sqrt(covMatEigenvalues[row]); for (int col = 0; col < dim; col++) { tmpMatrix.multiplyEntry(row, col, factor);
final double factor = FastMath.sqrt(covMatEigenvalues[row]); for (int col = 0; col < dim; col++) { tmpMatrix.multiplyEntry(row, col, factor);