Class ContinuedConvolution

java.lang.Object
net.algart.matrices.linearfiltering.ContinuedConvolution
All Implemented Interfaces:
ArrayProcessor, ArrayProcessorWithContextSwitching, Convolution

public class ContinuedConvolution extends Object implements Convolution

The filter allowing to transform any Convolution object to another instance of that interface, which uses some non-trivial form of continuation outside the source matrix.

This object is built on the base of some parent object, implementing Convolution, and some continuation mode. This object works almost identically to the parent object with the only exception, that it uses the specified continuation model instead of the default pseudo-cyclic continuation.

More precisely, all methods of this object call the corresponding methods of the parent one. But before calling any processing method, the source matrix is appended (outside its bounds) by some area of additional values with help of Matrix.subMatrix(long[], long[], net.algart.arrays.Matrix.ContinuationMode) method, using the continuation mode of this filter. So, all dimensions of the appended matrix are little greater than the corresponding dimensions of the source one, and extra elements are (virtually) filled by some values according the given continuation mode. The size of extension along all coordinates depends on the pattern and the performed operation. After this, the corresponding method of parent object processes the appended matrix, and the method of this class returns the corresponding submatrix of the result, with dimensions, equal to the dimensions of the source matrix.

The processing is little different for the method convolution(Matrix, Matrix, WeightedPattern), placing the result into the first argument. In this case, the destination (updatable) matrix is (virtually) extended like the source matrix before calculations with help of Matrix.subMatrix(long[], long[], net.algart.arrays.Matrix.ContinuationMode) method; so, the calculated data are correctly stored into the original destination matrix.

The appending along all coordinates is performed in such a way, that the resulting matrix is the same, as if the source matrix would be virtually appended until the infinity along all directions, according the selected continuation mode.

Note: Matrix.ContinuationMode.NONE continuation mode cannot be used in this class: such value of continuationMode argument of the instantiation method getInstance(Convolution, Matrix.ContinuationMode) leads to IllegalArgumentException.

Note: in improbable cases, when the dimensions of the source matrix and/or the sizes of the pattern are extremely large (about 263), so that the necessary appended matrices should have dimensions or total number of elements, greater than Long.MAX_VALUE, the methods of this class throw IndexOutOfBoundsException and do nothing. Of course, these are very improbable cases.

This class is immutable and thread-safe: there are no ways to modify settings of the created instance.

Author:
Daniel Alievsky
  • Method Details