/** * <tt>A = A<sup>B</sup> <=> A[i] = Math.pow(A[i], B[i])</tt>. * @param A the matrix to modify. * @param B the matrix to stay unaffected. * @return <tt>A</tt> (for convenience only). */ public static DoubleMatrix1D pow(DoubleMatrix1D A, DoubleMatrix1D B) { return A.assign(B,F.pow); } /**
/** * <tt>A = A / B <=> A[i] = A[i] / B[i]</tt>. * @param A the matrix to modify. * @param B the matrix to stay unaffected. * @return <tt>A</tt> (for convenience only). */ public static DoubleMatrix1D div(DoubleMatrix1D A, DoubleMatrix1D B) { return A.assign(B,F.div); } /**
/** * <tt>A = A + B <=> A[i] = A[i] + B[i]</tt>. * @param A the matrix to modify. * @param B the matrix to stay unaffected. * @return <tt>A</tt> (for convenience only). */ public static DoubleMatrix1D plus(DoubleMatrix1D A, DoubleMatrix1D B) { return A.assign(B,F.plus); } /**
/** * <tt>A = A * B <=> A[i] = A[i] * B[i]</tt>. * @param A the matrix to modify. * @param B the matrix to stay unaffected. * @return <tt>A</tt> (for convenience only). */ public static DoubleMatrix1D mult(DoubleMatrix1D A, DoubleMatrix1D B) { return A.assign(B,F.mult); } /**
/** * <tt>A = A / s <=> A[i] = A[i] / s</tt>. * @param A the matrix to modify. * @param s the scalar; can have any value. * @return <tt>A</tt> (for convenience only). */ public static DoubleMatrix1D div(DoubleMatrix1D A, double s) { return A.assign(F.div(s)); } /**
/** * <tt>A = A + B*s<=> A[i] = A[i] + B[i]*s</tt>. * @param A the matrix to modify. * @param B the matrix to stay unaffected. * @param s the scalar; can have any value. * @return <tt>A</tt> (for convenience only). */ public static DoubleMatrix1D plusMult(DoubleMatrix1D A, DoubleMatrix1D B, double s) { return A.assign(B,F.plusMult(s)); } /**
/** * <tt>A = A - B*s <=> A[i] = A[i] - B[i]*s</tt>. * @param A the matrix to modify. * @param B the matrix to stay unaffected. * @param s the scalar; can have any value. * @return <tt>A</tt> (for convenience only). */ public static DoubleMatrix1D minusMult(DoubleMatrix1D A, DoubleMatrix1D B, double s) { return A.assign(B,F.minusMult(s)); } /**
/** * Sets all cells to the state specified by <tt>value</tt>. * @param value the value to be filled into the cells. * @return <tt>this</tt> (for convenience only). */ public DoubleMatrix1D assign(double value) { // overriden for performance only if (this.isNoView && value==0) this.elements.clear(); else super.assign(value); return this; } /**
/** * <tt>A = A - s <=> A[i] = A[i] - s</tt>. * @param A the matrix to modify. * @param s the scalar; can have any value. * @return <tt>A</tt> (for convenience only). */ public static DoubleMatrix1D minus(DoubleMatrix1D A, double s) { return A.assign(F.minus(s)); } /**
/** * <tt>A = A * s <=> A[i] = A[i] * s</tt>. * @param A the matrix to modify. * @param s the scalar; can have any value. * @return <tt>A</tt> (for convenience only). */ public static DoubleMatrix1D mult(DoubleMatrix1D A, double s) { return A.assign(F.mult(s)); } /**
/** * <tt>A = A + s <=> A[i] = A[i] + s</tt>. * @param A the matrix to modify. * @param s the scalar; can have any value. * @return <tt>A</tt> (for convenience only). */ public static DoubleMatrix1D plus(DoubleMatrix1D A, double s) { return A.assign(F.plus(s)); } /**
/** * Constructs a matrix with the given shape, each cell initialized with the given value. */ public DoubleMatrix1D make(int size, double initialValue) { return make(size).assign(initialValue); } /**
/** * Constructs a matrix with uniformly distributed values in <tt>(0,1)</tt> (exclusive). */ public DoubleMatrix1D random(int size) { return make(size).assign(cern.jet.math.Functions.random()); } /**
/** * Constructs a matrix with uniformly distributed values in <tt>(0,1)</tt> (exclusive). */ public DoubleMatrix1D random(int size) { return make(size).assign(cern.jet.math.Functions.random()); } /**
/** Constructs a matrix with cells having ascending values. For debugging purposes. Example: <tt>0 1 2</tt> */ public DoubleMatrix1D ascending(int size) { cern.jet.math.Functions F = cern.jet.math.Functions.functions; return descending(size).assign(F.chain(F.neg,F.minus(size))); } /**
public void dger(double alpha, DoubleMatrix1D x, DoubleMatrix1D y, DoubleMatrix2D A) { cern.jet.math.PlusMult fun = cern.jet.math.PlusMult.plusMult(0); for (int i=A.rows(); --i >= 0; ) { fun.multiplicator = alpha * x.getQuick(i); A.viewRow(i).assign(y,fun); } } public double dnrm2(DoubleMatrix1D x) {