public DoubleMatrix2D assign(double value) { if (value == 0) { Arrays.fill(dcs.i, 0); Arrays.fill(dcs.p, 0); Arrays.fill(dcs.x, 0); } else { int nnz = cardinality(); for (int i = 0; i < nnz; i++) { dcs.x[i] = value; } } return this; }
public DoubleMatrix2D assign(double value) { if (value == 0) { Arrays.fill(dcs.i, 0); Arrays.fill(dcs.p, 0); Arrays.fill(dcs.x, 0); } else { int nnz = cardinality(); for (int i = 0; i < nnz; i++) { dcs.x[i] = value; } } return this; }
public String toString() { StringBuilder builder = new StringBuilder(); builder.append(rows).append(" x ").append(columns).append(" sparse matrix, nnz = ").append(cardinality()) .append('\n'); for (int i = 0; i < columns; i++) { int high = dcs.p[i + 1]; for (int j = dcs.p[i]; j < high; j++) { builder.append('(').append(dcs.i[j]).append(',').append(i).append(')').append('\t').append(dcs.x[j]) .append('\n'); } } return builder.toString(); }
public String toString() { StringBuilder builder = new StringBuilder(); builder.append(rows).append(" x ").append(columns).append(" sparse matrix, nnz = ").append(cardinality()) .append('\n'); for (int i = 0; i < columns; i++) { int high = dcs.p[i + 1]; for (int j = dcs.p[i]; j < high; j++) { builder.append('(').append(dcs.i[j]).append(',').append(i).append(')').append('\t').append(dcs.x[j]) .append('\n'); } } return builder.toString(); }
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; }
if ((nthreads > 1) && (cardinality() >= ConcurrencyUtils.getThreadsBeginN_2D())) { nthreads = 2; Future<?>[] futures = new Future[nthreads]; if ((nthreads > 1) && (cardinality() >= ConcurrencyUtils.getThreadsBeginN_2D())) { Future<?>[] futures = new Future[nthreads]; int k = columns / nthreads;
if ((nthreads > 1) && (cardinality() >= ConcurrencyUtils.getThreadsBeginN_2D())) { nthreads = 2; Future<?>[] futures = new Future[nthreads]; if ((nthreads > 1) && (cardinality() >= ConcurrencyUtils.getThreadsBeginN_2D())) { Future<?>[] futures = new Future[nthreads]; int k = columns / nthreads;