/** * Constructs a matrix with a copy of the given values. <tt>values</tt> is * required to have the form <tt>values[row][column]</tt> and have exactly * the same number of columns in every row. * <p> * The values are copied. So subsequent changes in <tt>values</tt> are not * reflected in the matrix, and vice-versa. * * @param values * The values to be filled into the new matrix. * @throws IllegalArgumentException * if * <tt>for any 1 <= row < values.length: values[row].length != values[row-1].length</tt> * . */ public SparseCCDoubleMatrix2D(double[][] values) { this(values.length, values[0].length); assign(values); }
/** * Constructs a matrix with a copy of the given values. <tt>values</tt> is * required to have the form <tt>values[row][column]</tt> and have exactly * the same number of columns in every row. * <p> * The values are copied. So subsequent changes in <tt>values</tt> are not * reflected in the matrix, and vice-versa. * * @param values * The values to be filled into the new matrix. * @throws IllegalArgumentException * if * <tt>for any 1 <= row < values.length: values[row].length != values[row-1].length</tt> * . */ public SparseCCDoubleMatrix2D(double[][] values) { this(values.length, values[0].length); assign(values); }
public DoubleMatrix2D assign(final cern.colt.function.tdouble.DoubleFunction function) { if (function instanceof cern.jet.math.tdouble.DoubleMult) { // x[i] = mult*x[i] final double alpha = ((cern.jet.math.tdouble.DoubleMult) function).multiplicator; if (alpha == 1) return this; if (alpha == 0) return assign(0); if (alpha != alpha) return assign(alpha); // the funny definition of isNaN(). This should better not happen. final double[] valuesE = dcs.x; int nz = cardinality(); for (int j = 0; j < nz; j++) { valuesE[j] *= alpha; } } else { forEachNonZero(new cern.colt.function.tdouble.IntIntDoubleFunction() { public double apply(int i, int j, double value) { return function.apply(value); } }); } return this; }
public DoubleMatrix2D assign(final cern.colt.function.tdouble.DoubleFunction function) { if (function instanceof cern.jet.math.tdouble.DoubleMult) { // x[i] = mult*x[i] final double alpha = ((cern.jet.math.tdouble.DoubleMult) function).multiplicator; if (alpha == 1) return this; if (alpha == 0) return assign(0); if (alpha != alpha) return assign(alpha); // the funny definition of isNaN(). This should better not happen. final double[] valuesE = dcs.x; int nz = cardinality(); for (int j = 0; j < nz; j++) { valuesE[j] *= alpha; } } else { forEachNonZero(new cern.colt.function.tdouble.IntIntDoubleFunction() { public double apply(int i, int j, double value) { return function.apply(value); } }); } return this; }
/** * 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)); }
rowIndexesSorted = true; } else { assign(0); source.forEachNonZero(new cern.colt.function.tdouble.IntIntDoubleFunction() { public double apply(int i, int j, double value) {
rowIndexesSorted = true; } else { assign(0); source.forEachNonZero(new cern.colt.function.tdouble.IntIntDoubleFunction() { public double apply(int i, int j, double value) {
final double alpha = ((cern.jet.math.tdouble.DoublePlusMultFirst) function).multiplicator; if (alpha == 0) return assign(y); y.forEachNonZero(new cern.colt.function.tdouble.IntIntDoubleFunction() { public double apply(int i, int j, double value) {
final double alpha = ((cern.jet.math.tdouble.DoublePlusMultFirst) function).multiplicator; if (alpha == 0) return assign(y); y.forEachNonZero(new cern.colt.function.tdouble.IntIntDoubleFunction() { public double apply(int i, int j, double value) {
CC.assign(cern.jet.math.tdouble.DoubleFunctions.mult(alpha));
CC.assign(cern.jet.math.tdouble.DoubleFunctions.mult(alpha));