/** * Replaces all cell values of the receiver with the values of another matrix. * Both matrices must have the same number of slices, rows and columns. * 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>slices() != other.slices() || rows() != other.rows() || columns() != other.columns()</tt> */ public DoubleMatrix3D assign(DoubleMatrix3D other) { if (other==this) return this; checkShape(other); if (haveSharedCells(other)) other = other.copy(); for (int slice=slices; --slice >= 0;) { for (int row=rows; --row >= 0;) { for (int column=columns; --column >= 0;) { setQuick(slice,row,column,other.getQuick(slice,row,column)); } } } return this; } /**
/** * Replaces all cell values of the receiver with the values of another matrix. * Both matrices must have the same number of slices, rows and columns. * 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>slices() != other.slices() || rows() != other.rows() || columns() != other.columns()</tt> */ public DoubleMatrix3D assign(DoubleMatrix3D other) { if (other==this) return this; checkShape(other); if (haveSharedCells(other)) other = other.copy(); for (int slice=slices; --slice >= 0;) { for (int row=rows; --row >= 0;) { for (int column=columns; --column >= 0;) { setQuick(slice,row,column,other.getQuick(slice,row,column)); } } } return this; } /**
checkShape(y); for (int slice=slices; --slice >= 0; ) { for (int row=rows; --row >= 0; ) {
checkShape(y); for (int slice=slices; --slice >= 0; ) { for (int row=rows; --row >= 0; ) {
checkShape(other); if (size()==0) return Double.NaN; double a = f.apply(getQuick(slices-1,rows-1,columns-1),other.getQuick(slices-1,rows-1,columns-1));
checkShape(other); if (size()==0) return Double.NaN; double a = f.apply(getQuick(slices-1,rows-1,columns-1),other.getQuick(slices-1,rows-1,columns-1));
checkShape(B); if (rows<3 || columns<3 || slices<3) return; // nothing to do int r = rows-1;
checkShape(B); if (rows<3 || columns<3 || slices<3) return; // nothing to do int r = rows-1;