cern.colt.matrix.DoubleMatrix2D.zAssign8Neighbors()
ighbors cern.colt.function.Double9Function f = new cern.colt.function.Double9Function() { public final double apply( double a00, double a01, double a02, double a10, double a11, double a12, double a20, double a21, double a22) { return beta*a11 + alpha*(a00+a01+a02 + a10+a12 + a20+a21+a22); } }; A.zAssign8Neighbors(B,f); // 4 neighbors cern.colt.function.Double9Function g = new cern.colt.function.Double9Function() { public final double apply( double a00, double a01, double a02, double a10, double a11, double a12, double a20, double a21, double a22) { return beta*a11 + alpha*(a01+a10+a12+a21); } C.zAssign8Neighbors(B,g); // fast, even though it doesn't look like it };
@param B the matrix to hold the results.
@param function the function to be applied to the 9 cells.
@throws NullPointerException if function==null.
@throws IllegalArgumentException if rows() != B.rows() || columns() != B.columns().