public class ContinuedStreamingApertureProcessor extends StreamingApertureProcessor
The filter allowing to transform any streaming aperture procesor
to another instance of that class, which uses some nontrivial form of continuation outside the source matrix.
This object is built on the base of some parent object,
extending StreamingApertureProcessor
, 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 pseudocyclic continuation,
described in comments to StreamingApertureProcessor
.
More precisely, both
asProcessed(Class, Matrix, List, Pattern)
and
process(Matrix, Matrix, List, Pattern)
methods of this object call
the corresponding methods of the parent one.
But before calling them, the source matrix M 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
,
and all additional matrices
Matrix.ContinuationMode.ZERO_CONSTANT
).
So, all dimensions of the appended matrices are little greater than the corresponding dimensions
of the source ones, and extra elements are (virtually) filled according the given continuation mode
(the source matrix M) or by zeros (additional matrices M_{i}).
The size of extension along all coordinates depends on the pattern (aperture shape).
After this, the corresponding method of parent object processes the appended matrix.
In a case of asProcessed
method,
the corresponding submatrix of the result is extracted, with dimensions, equal
to the dimensions of the source matrix (by using Matrix.subMatrix(long[], long[])
method),
and the method returns this submatrix.
In a case of process
method,
the destination (updatable) R matrix is (virtually) extended like the source M 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 R 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: we append the additional matrices M_{k} with 0.0 constant
instead of using the selected continuation mode. It is possible (as well as appending with any other values)
because the element of the resulting matrix R
at every position x, according the basic specification of StreamingApertureProcessor
class,
should depend only on the elements
Note: Matrix.ContinuationMode.NONE
continuation mode cannot be used in this class:
such value of continuationMode argument of the instantiation method
getInstance(StreamingApertureProcessor, Matrix.ContinuationMode)
leads
to IllegalArgumentException.
Note: in an improbable case, when the dimensions of the source matrix and/or
the sizes of the pattern are extremely large (about 2^{63}),
so that the necessary appended matrices should have dimensions or total number of elements,
greater than
This class is an example of nonstandard implementation of streaming aperture processor,
which does not comply with the strict definition from the comments to
StreamingApertureProcessor
class. (But this implementation is still standard,
if continuationMode()
is PSEUDO_CYCLIC
and the parent
processor is standard.)
This class is immutable and threadsafe: there are no ways to modify settings of the created instance.
Modifier and Type  Method and Description 

<T extends PArray> 
asProcessed(java.lang.Class<? extends T> requiredType,
Matrix<? extends PArray> src,
java.util.List<? extends Matrix<? extends PArray>> additionalMatrices,
Pattern pattern)
Returns an immutable view of the passed source matrix

StreamingApertureProcessor 
context(ArrayContext newContext)
Switches the context: returns an instance, identical to this one excepting
that it uses the specified newContext for all operations.

Matrix.ContinuationMode 
continuationMode()
Returns the continuation mode, used by this object for virtual continuing the source matrix.

static ContinuedStreamingApertureProcessor 
getInstance(StreamingApertureProcessor parent,
Matrix.ContinuationMode continuationMode)
Returns new instance of this class with the passed parent
StreamingApertureProcessor object
and the specified continuation mode. 
boolean 
isStandardImplementation()
Returns true if there is a guarantee that this object is
a standard implementations of this class.

StreamingApertureProcessor 
parent()
Returns the parent
StreamingApertureProcessor object, passed to
getInstance(StreamingApertureProcessor, Matrix.ContinuationMode) method. 
void 
process(Matrix<? extends UpdatablePArray> dest,
Matrix<? extends PArray> src,
java.util.List<? extends Matrix<? extends PArray>> additionalMatrices,
Pattern pattern)
Processes the passed source matrix

asProcessed, asProcessed, asProcessed, asProcessed, checkArguments, maxTempBufferSize, process, process, process, process
context, contextPart, memoryModel
public static ContinuedStreamingApertureProcessor getInstance(StreamingApertureProcessor parent, Matrix.ContinuationMode continuationMode)
StreamingApertureProcessor
object
and the specified continuation mode.
See comments to Matrix.ContinuationMode
class
for more information about possible continuations.parent
 the instance of StreamingApertureProcessor
class
that will perform all operations.continuationMode
 the mode of continuation outside the source matrix.java.lang.NullPointerException
 if parent or continuationMode argument is null.java.lang.IllegalArgumentException
 if continuationMode==Matrix.ContinuationMode.NONE
.parent()
,
continuationMode()
public StreamingApertureProcessor parent()
StreamingApertureProcessor
object, passed to
getInstance(StreamingApertureProcessor, Matrix.ContinuationMode)
method.StreamingApertureProcessor
object.public Matrix.ContinuationMode continuationMode()
getInstance(StreamingApertureProcessor, Matrix.ContinuationMode)
method.public StreamingApertureProcessor context(ArrayContext newContext)
subtask
of the full task.context
in interface ArrayProcessorWithContextSwitching
context
in class StreamingApertureProcessor
newContext
 another context, used by the returned instance; may be null.public boolean isStandardImplementation()
StreamingApertureProcessor
StreamingApertureProcessor
class for more details.isStandardImplementation
in class StreamingApertureProcessor
public <T extends PArray> Matrix<T> asProcessed(java.lang.Class<? extends T> requiredType, Matrix<? extends PArray> src, java.util.List<? extends Matrix<? extends PArray>> additionalMatrices, Pattern pattern)
StreamingApertureProcessor
comments to this class
for more details.
The matrix, returned by this method, is immutable, and the class of its builtin array
implements one of the basic interfaces
BitArray
, CharArray
,
ByteArray
, ShortArray
,
IntArray
, LongArray
,
FloatArray
or DoubleArray
.
The class of desired interface (one of 8 possible classes) must be passed as requiredType argument.
So, it defines the element type of the returned matrix.
The rules of casting the floatingpoint result of the processing function g
to the desired element type depend on implementation.
In many (but not all) implementations they are the same as in
Arrays.asFuncArray(boolean, net.algart.math.functions.Func, Class, PArray...)
method with the argument truncateOverflows=true.
The concrete algorithm, implementing by this class, can require some number of additional arguments M_{k}. If the number of matrices in the passed list additionalMatrices is less than the required one, this method throws IllegalArgumentException. If the number of passed matrices is greater than the required one, it is not an error: the extra arguments are ignored.
Usually you should use process
method, which work
faster than this method.
asProcessed
in class StreamingApertureProcessor
requiredType
 the desired type of the builtin array in the returned matrix.src
 the source matrix M.additionalMatrices
 the additional matrices M_{0}, M_{1},
..., M_{K−1}.pattern
 the aperture shape P.public void process(Matrix<? extends UpdatablePArray> dest, Matrix<? extends PArray> src, java.util.List<? extends Matrix<? extends PArray>> additionalMatrices, Pattern pattern)
StreamingApertureProcessor
comments to this class
for more details.
This default implementations is based on one or more calls of
asProcessed
method and
copying its result into dest matrix.
The requiredType argument of asProcessed
method
is chosen as dest.type
(PArray.class).
If you need to create a nonstandard implementation (a class which does not represent
a streaming aperture processor, complying with strict definition from the comments to this class),
you must override this method. You also may override this method, if it is possible to provide
better performance than the default implementation, for example, for some specific variants of
the aperture shape pattern.
If the element type of dest matrix is not floatingpoint,
then this method casts the floatingpoint result of the processing function g
to the types of dest elements. The rules of casting depend on implementation
and usually are the same as in asProcessed
method.
The default implementation does not need casting, because all necessary casting is already performed
by asProcessed
method.
The concrete algorithm, implementing by this class, can require some number of additional arguments M_{k}. If the number of matrices in the passed list additionalMatrices is less than the required one, this method throws IllegalArgumentException. If the number of passed matrices is greater than the required one, it is not an error: the extra arguments are ignored.
The aperture shape pattern, passed to this method, is automatically rounded to the nearest
integer pattern
by the operators
round()
process
in class StreamingApertureProcessor
dest
 the resulting matrix R.src
 the source matrix M.additionalMatrices
 the additional matrices M_{0}, M_{1},
..., M_{K−1}.pattern
 the aperture shape P.