/** * Creates the interpolation (prolongation) matrix based on the * non-smoothed aggregates */ private SparseCCDoubleMatrix2D createInterpolationMatrix(int[] pt, int c) { SparseCCMDoubleMatrix2D If = new SparseCCMDoubleMatrix2D(pt.length, c); for (int i = 0; i < pt.length; ++i) if (pt[i] != -1) If.setQuick(i, pt[i], 1); return (SparseCCDoubleMatrix2D) (new SparseCCDoubleMatrix2D(If.rows(), If.columns()).assign(If)); }
/** * Creates the interpolation (prolongation) matrix based on the * non-smoothed aggregates */ private SparseCCDoubleMatrix2D createInterpolationMatrix(int[] pt, int c) { SparseCCMDoubleMatrix2D If = new SparseCCMDoubleMatrix2D(pt.length, c); for (int i = 0; i < pt.length; ++i) if (pt[i] != -1) If.setQuick(i, pt[i], 1); return (SparseCCDoubleMatrix2D) (new SparseCCDoubleMatrix2D(If.rows(), If.columns()).assign(If)); }
/** * Returns a new matrix that has the same elements as this matrix, but is in * a column-compressed modified form. This method creates a new object (not * a view), so changes in the returned matrix are NOT reflected in this * matrix. * * @return this matrix in a column-compressed modified form */ public SparseCCMDoubleMatrix2D getColumnCompressedModified() { SparseCCMDoubleMatrix2D A = new SparseCCMDoubleMatrix2D(rows, columns); int nnz = cardinality(); long[] keys = elements.keys().elements(); double[] values = elements.values().elements(); for (int i = 0; i < nnz; i++) { int row = (int) (keys[i] / columns); int column = (int) (keys[i] % columns); A.setQuick(row, column, values[i]); } return A; }
/** * Returns a new matrix that has the same elements as this matrix, but is in * a column-compressed modified form. This method creates a new object (not * a view), so changes in the returned matrix are NOT reflected in this * matrix. * * @return this matrix in a column-compressed modified form */ public SparseCCMDoubleMatrix2D getColumnCompressedModified() { SparseCCMDoubleMatrix2D A = new SparseCCMDoubleMatrix2D(rows, columns); int nnz = cardinality(); long[] keys = elements.keys().elements(); double[] values = elements.values().elements(); for (int i = 0; i < nnz; i++) { int row = (int) (keys[i] / columns); int column = (int) (keys[i] % columns); A.setQuick(row, column, values[i]); } return A; }