Package cern.colt.matrix.doublealgo
Class Stencil
- java.lang.Object
-
- cern.colt.matrix.doublealgo.Stencil
-
public class Stencil extends java.lang.Object
Stencil operations. For efficient finite difference operations. Applies a function to a moving 3 x 3 or 3 x 3 x 3 window. Build on top of matrix.zAssignXXXNeighbors(...). You can specify how many iterations shall at most be done, a convergence condition when iteration shall be terminated, and how many iterations shall pass between convergence checks. Always does two iterations at a time for efficiency. These class is for convencience and efficiency.- Version:
- 1.0, 01/02/2000
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Stencil()
Makes this class non instantiable, but still let's others inherit from it.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
stencil27(DoubleMatrix3D A, Double27Function function, int maxIterations, DoubleMatrix3DProcedure hasConverged, int convergenceIterations)
27 point stencil operation.static int
stencil9(DoubleMatrix2D A, Double9Function function, int maxIterations, DoubleMatrix2DProcedure hasConverged, int convergenceIterations)
9 point stencil operation.
-
-
-
Method Detail
-
stencil27
public static int stencil27(DoubleMatrix3D A, Double27Function function, int maxIterations, DoubleMatrix3DProcedure hasConverged, int convergenceIterations)
27 point stencil operation. Applies a function to a moving 3 x 3 x 3 window.- Parameters:
A
- the matrix to operate on.function
- the function to be applied to each window.maxIterations
- the maximum number of times the stencil shall be applied to the matrix. Should be a multiple of 2 because two iterations are always done in one atomic step.hasConverged
- Convergence condition; will return before maxIterations are done when hasConverged.apply(A)==true. Set this parameter to null to indicate that no convergence checks shall be made.convergenceIterations
- the number of iterations to pass between each convergence check. (Since a convergence may be expensive, you may want to do it only every 2,4 or 8 iterations.)- Returns:
- the number of iterations actually executed.
-
stencil9
public static int stencil9(DoubleMatrix2D A, Double9Function function, int maxIterations, DoubleMatrix2DProcedure hasConverged, int convergenceIterations)
9 point stencil operation. Applies a function to a moving 3 x 3 window.- Parameters:
A
- the matrix to operate on.function
- the function to be applied to each window.maxIterations
- the maximum number of times the stencil shall be applied to the matrix. Should be a multiple of 2 because two iterations are always done in one atomic step.hasConverged
- Convergence condition; will return before maxIterations are done when hasConverged.apply(A)==true. Set this parameter to null to indicate that no convergence checks shall be made.convergenceIterations
- the number of iterations to pass between each convergence check. (Since a convergence may be expensive, you may want to do it only every 2,4 or 8 iterations.)- Returns:
- the number of iterations actually executed.
-
-