/** Swaps each element <tt>this[i]</tt> with <tt>other[i]</tt>. @throws IllegalArgumentException if <tt>size() != other.size()</tt>. */ public void swap(DoubleMatrix1D other) { checkSize(other); for (int i=size; --i >= 0; ) { double tmp = getQuick(i); setQuick(i, other.getQuick(i)); other.setQuick(i, tmp); } return; } /**
/** Swaps each element <tt>this[i]</tt> with <tt>other[i]</tt>. @throws IllegalArgumentException if <tt>size() != other.size()</tt>. */ public void swap(DoubleMatrix1D other) { checkSize(other); for (int i=size; --i >= 0; ) { double tmp = getQuick(i); setQuick(i, other.getQuick(i)); other.setQuick(i, tmp); } return; } /**
/** * Replaces all cell values of the receiver with the values of another matrix. * Both matrices must have the same size. * If both matrices share the same cells (as is the case if they are views derived from the same matrix) and intersect in an ambiguous way, then replaces <i>as if</i> using an intermediate auxiliary deep copy of <tt>other</tt>. * * @param other the source matrix to copy from (may be identical to the receiver). * @return <tt>this</tt> (for convenience only). * @throws IllegalArgumentException if <tt>size() != other.size()</tt>. */ public DoubleMatrix1D assign(DoubleMatrix1D other) { if (other==this) return this; checkSize(other); if (haveSharedCells(other)) other = other.copy(); for (int i=size; --i >= 0;) { setQuick(i,other.getQuick(i)); } return this; } /**
/** * Replaces all cell values of the receiver with the values of another matrix. * Both matrices must have the same size. * If both matrices share the same cells (as is the case if they are views derived from the same matrix) and intersect in an ambiguous way, then replaces <i>as if</i> using an intermediate auxiliary deep copy of <tt>other</tt>. * * @param other the source matrix to copy from (may be identical to the receiver). * @return <tt>this</tt> (for convenience only). * @throws IllegalArgumentException if <tt>size() != other.size()</tt>. */ public DoubleMatrix1D assign(DoubleMatrix1D other) { if (other==this) return this; checkSize(other); if (haveSharedCells(other)) other = other.copy(); for (int i=size; --i >= 0;) { setQuick(i,other.getQuick(i)); } return this; } /**
/** Assigns the result of a function to each cell; <tt>x[i] = function(x[i],y[i])</tt>. <p> <b>Example:</b> <pre> // assign x[i] = x[i]<sup>y[i]</sup> m1 = 0 1 2 3; m2 = 0 2 4 6; m1.assign(m2, cern.jet.math.Functions.pow); --> m1 == 1 1 16 729 </pre> For further examples, see the <a href="package-summary.html#FunctionObjects">package doc</a>. @param y the secondary matrix to operate on. @param function a function object taking as first argument the current cell's value of <tt>this</tt>, and as second argument the current cell's value of <tt>y</tt>, @return <tt>this</tt> (for convenience only). @throws IllegalArgumentException if <tt>size() != y.size()</tt>. @see cern.jet.math.Functions */ public DoubleMatrix1D assign(DoubleMatrix1D y, cern.colt.function.DoubleDoubleFunction function) { checkSize(y); for (int i=size; --i >= 0; ) { setQuick(i, function.apply(getQuick(i), y.getQuick(i))); } return this; } /**
/** Assigns the result of a function to each cell; <tt>x[i] = function(x[i],y[i])</tt>. <p> <b>Example:</b> <pre> // assign x[i] = x[i]<sup>y[i]</sup> m1 = 0 1 2 3; m2 = 0 2 4 6; m1.assign(m2, cern.jet.math.Functions.pow); --> m1 == 1 1 16 729 </pre> For further examples, see the <a href="package-summary.html#FunctionObjects">package doc</a>. @param y the secondary matrix to operate on. @param function a function object taking as first argument the current cell's value of <tt>this</tt>, and as second argument the current cell's value of <tt>y</tt>, @return <tt>this</tt> (for convenience only). @throws IllegalArgumentException if <tt>size() != y.size()</tt>. @see cern.jet.math.Functions */ public DoubleMatrix1D assign(DoubleMatrix1D y, cern.colt.function.DoubleDoubleFunction function) { checkSize(y); for (int i=size; --i >= 0; ) { setQuick(i, function.apply(getQuick(i), y.getQuick(i))); } return this; } /**
public void drot(DoubleMatrix1D x, DoubleMatrix1D y, double c, double s) { x.checkSize(y); DoubleMatrix1D tmp = x.copy(); x.assign(F.mult(c)); x.assign(y,F.plusMult(s)); y.assign(F.mult(c)); y.assign(tmp,F.minusMult(s)); } public void drotg(double a, double b, double rotvec[]) {
public void drot(DoubleMatrix1D x, DoubleMatrix1D y, double c, double s) { x.checkSize(y); DoubleMatrix1D tmp = x.copy(); x.assign(F.mult(c)); x.assign(y,F.plusMult(s)); y.assign(F.mult(c)); y.assign(tmp,F.minusMult(s)); } public void drotg(double a, double b, double rotvec[]) {
checkSize(other); if (size==0) return Double.NaN; double a = f.apply(getQuick(size-1),other.getQuick(size-1));
checkSize(other); if (size==0) return Double.NaN; double a = f.apply(getQuick(size-1),other.getQuick(size-1));
checkSize(y); int[] nonZeroElements = nonZeroIndexes.elements();
checkSize(y); int[] nonZeroElements = nonZeroIndexes.elements();