public interface RankMorphology extends Morphology
Rank operations over ndimensional matrices
:
percentile, rank, mean between given percentiles or values, etc.,
calculated on all matrix elements in an aperture with the fixed shape, represented by Pattern
class.
It is supposed that the type of matrix elements is one of primitive Java types
(boolean, char, byte, short, int,
long, float, double) and, so, represents an integer or a real number,
according to comments to PFixedArray.getLong(long)
and PArray.getDouble(long)
methods.
In 2dimensional case, these operations can be used for processing grayscale digital images.
The simplest rank operation is a percentile, for example, minimum, maximum or median.
In the case of maximum, the percentile is strictly equivalent to dilation — the basic
operation of the mathematical morphology, offered by Morphology
interface.
In the case of minimum, the percentile by some pattern P is equivalent to erosion
by the symmetric pattern P.symmetric()
.
It allows to consider rank operations as an extension of the operation set of
the traditional mathematical morphology. Really, this interface extends
Morphology
interface, and it is supposed, by definition, that
dilation
(m,pattern)percentile
(m,c*N,pattern)erosion
(m,pattern)percentile
(m,c*N,pattern.symmetric()
)pointCount()
1BasicRankMorphology.getInstance
method).
Below is the formal definition of 5 basic rank operations with the given pattern P and matrix M: percentile, rank, mean between 2 percentiles, mean between 2 ranks and aperture sum, calculated by this class.
dimCount()
points
of the pattern P).
We always consider that the point x lies inside M matrix
(dim
(k)dim
(k)PFixedArray.getLong(long)
, if the type of the matrix elements is boolean, char,
byte, short, int or long, or real: PArray.getDouble(long)
,
if the element type is float or double) of the underlying array
array()
index
(x'_{0}, x'_{1}, ..., x'_{n−1})dim
(k)BasicRankMorphology
implementation, v_{i} is the value of the element
(PFixedArray.getLong(long)
for the fixedpoint case or PArray.getDouble(long)
for the floatingpoint case) of the underlying array array()
pseudoCyclicIndex
(x'_{0}, x'_{1}, ...,
x'_{n−1})ContinuedRankMorphology
implementation, v_{i} is the
calculated according to the continuation mode, passed to
ContinuedRankMorphology.getInstance(RankMorphology, Matrix.ContinuationMode)
method;pointCount()
Matrix.elementType()
array()
.bitsPerElement()
BasicRankMorphology
, then
Matrix.elementType()
bit levels
, specified while instantiating
this class via the last argument of
BasicRankMorphology.getInstance(ArrayContext, double, CustomRankPrecision)
method;array()
.bitsPerElement()
Arrays.maxPossibleValue
(M.elementType()
,1.0)Histogram
and SummingHistogram
classes.
Namely, we define the following rank characteristics:
Histogram
class;Histogram
class;SummingHistogram
class;Histogram
class and
SummingHistogram
class.
If the conditions CountOfValues.isLeftBound()
CountOfValues.isRightBound()
Histogram
and SummingHistogram
classes).
The used model is chosen while instantiating this class, usually via
CustomRankPrecision.interpolated()
flag in the argument of CustomRankPrecision
class:
true value ("interpolated") means the precise model, false means the simple one.
This interface provides method for calculating the described 5 rank characteristics for every
integer point x lying in the matrix M. The resulting characteristics are returned
in the result matrix with the same dimensions as M. The necessary arguments —
the real index r for the percentile, the real value v for the rank,
the real indexes r_{1} and r_{2} for the mean between percentiles
or the real values v_{1} and v_{2} for the mean between values —
are retrieved from the corresponding element (with the index
index
(x_{0}, x_{1}, ..., x_{n−1})builtin array
of some additional matrix or pair of matrices,
passed to the methods, by PArray.getDouble(long)
method. It is supposed that those matrices
have the same dimensions as M. For the percentile and the mean between percentiles,
there are simplified versions of the methods, which use the constant rank indexes instead of matrices of
indexes.
Most of methods of this interface allow to return not only floatingpoint, but also integer result matrix. In this case, the real rank characteristics, defined above in the section 4, are rounded by some rules, that are specified in comments to the concrete methods.
For every rank characteristics this interface offers 3 methods for calculating it. Below are some comments about them.
asPercentile
.
This method returns an immutable view of the passed source matrix,
such that any reading data from it calculates and returns the necessary rank characteristic
of the source matrix with the specified pattern (aperture shape).
The result of such method is usually "lazy", that means that this method finishes immediately and all
actual calculations are performed while getting elements of the returned matrix.
It is true for all implementations provided by this package.
However, some implementations may not support lazy execution;
then the method may be equivalent to the second version described below.
Note that the sequential access to the lazy result, returned by this method
(via Array.getData
method, called for the
builtin array
of the returned matrix), usually works much faster
than the random access to elements of the matrix.percentile
.
This method always returns actual (nonlazy) updatable result:
array()
instanceof DirectAccessible
&&
((DirectAccessible)src.array()
).hasJavaArray()
. If the source matrix is not direct accessible,
the implementations, offered by this package, use StreamingApertureProcessor
technique
to accelerate processing. Calculating aperture sums is an exception:
functionOfSum
method uses some optimization for some kinds of
patterns and can work much faster than accessing to asFunctionOfSum
result.percentile(Matrix, Matrix, Matrix, Pattern)
.
The result matrix is passed via first argument named dest and supposed to be allocated
before calling the method. This way allows to save memory and time, if you need to perform several
rank operation, because you can use the same matrices for temporary results.
In addition, these methods allow to choose the type of element of the resulting matrix for any
operation. The precise rules of type conversions are described in comments to concrete methods.
This package provides the following basic methods for creating objects, implementing this interface:
BasicRankMorphology.getInstance(ArrayContext, double, CustomRankPrecision)
;ContinuedRankMorphology.getInstance(RankMorphology, Matrix.ContinuationMode)
.Warning: all implementations of this interface, provided by this package, can process only patterns
where pointCount()
≤Integer.MAX_VALUEMorphology
), implemented by classes of this package, which have Pattern
argument,
can throw TooManyPointsInPatternError
or OutOfMemoryError in the same situations as Pattern.points()
method.
Warning: the methods of this interface, which save results into the passed dest
matrix (like percentile(Matrix, Matrix, Matrix, Pattern)
),
as well as any attempts to read the "lazy" results (of the methods
like asPercentile(Matrix, Matrix, Pattern)
),
can be nonatomic regarding the failure, if the arguments of the calculated rank characteristics —
the real index r for the percentile, the real value v for the rank,
the real indexes r_{1} and r_{2} for the mean between percentiles
or the real values v_{1} and v_{2} for the mean between values —
are floatingpoint NaN values for some aperture positions. In this case,
it is possible that the result will be partially filled, and only after this the NaN value will lead to
IllegalArgumentException.
The floatingpoint calculations in the implementations of this interface are usually performed not in strictfp, but in the usual mode. So, there is no guarantee that the results are absolutely identical on all platforms. Moreover, there is no guarantee that the same results, got by different ways, are absolutely identical: little mismatches in the last digits after the decimal point are possible.
The classes, implementing this interface, are immutable and threadsafe: there are no ways to modify settings of the created instance.
Morphology.SubtractionMode
Modifier and Type  Field and Description 

static double 
FILL_MAX_VALUE
Special value of filler argument of methods, calculating mean between 2 values,
which activates the mode C of calculation:
if

static double 
FILL_MIN_VALUE
Special value of filler argument of methods, calculating mean between 2 values,
which activates the mode B of calculation:
if

static double 
FILL_NEAREST_VALUE
Special value of filler argument of methods, calculating mean between 2 values,
which activates the mode D of calculation.

Modifier and Type  Method and Description 

Matrix<? extends PArray> 
asFunctionOfPercentilePair(Matrix<? extends PArray> src,
double percentileIndex1,
double percentileIndex2,
Pattern pattern,
Func processingFunc)
Returns an immutable view of the passed source matrix,
such that any reading data from it calculates and returns the result of some given function

Matrix<? extends PArray> 
asFunctionOfPercentilePair(Matrix<? extends PArray> src,
Matrix<? extends PArray> percentileIndexes1,
Matrix<? extends PArray> percentileIndexes2,
Pattern pattern,
Func processingFunc)
Returns an immutable view of the passed source matrix,
such that any reading data from it calculates and returns the result of some given function

Matrix<? extends PArray> 
asFunctionOfSum(Matrix<? extends PArray> src,
Pattern pattern,
Func processingFunc)
Returns an immutable view of the passed source matrix,
such that any reading data from it calculates and returns the result of some given function

Matrix<? extends PArray> 
asMean(Matrix<? extends PArray> src,
Pattern pattern)
Returns an immutable view of the passed source matrix,
such that any reading data from it calculates and returns the mean
of the source matrix by the specified pattern.

Matrix<? extends PArray> 
asMeanBetweenPercentiles(Matrix<? extends PArray> src,
double fromPercentileIndex,
double toPercentileIndex,
Pattern pattern,
double filler)
Returns an immutable view of the passed source matrix,
such that any reading data from it calculates and returns the mean between 2 percentiles
of the source matrix by the specified pattern.

Matrix<? extends PArray> 
asMeanBetweenPercentiles(Matrix<? extends PArray> src,
Matrix<? extends PArray> fromPercentileIndexes,
Matrix<? extends PArray> toPercentileIndexes,
Pattern pattern,
double filler)
Returns an immutable view of the passed source matrix,
such that any reading data from it calculates and returns the mean between 2 percentiles
of the source matrix by the specified pattern.

Matrix<? extends PArray> 
asMeanBetweenValues(Matrix<? extends PArray> src,
Matrix<? extends PArray> minValues,
Matrix<? extends PArray> maxValues,
Pattern pattern,
double filler)
Returns an immutable view of the passed source matrix,
such that any reading data from it calculates and returns the mean between 2 values
of the source matrix by the specified pattern.

Matrix<? extends PArray> 
asPercentile(Matrix<? extends PArray> src,
double percentileIndex,
Pattern pattern)
Returns an immutable view of the passed source matrix,
such that any reading data from it calculates and returns the percentile
of the source matrix by the specified pattern.

Matrix<? extends PArray> 
asPercentile(Matrix<? extends PArray> src,
Matrix<? extends PArray> percentileIndexes,
Pattern pattern)
Returns an immutable view of the passed source matrix,
such that any reading data from it calculates and returns the percentile
of the source matrix by the specified pattern.

<T extends PArray> 
asRank(java.lang.Class<? extends T> requiredType,
Matrix<? extends PArray> baseMatrix,
Matrix<? extends PArray> rankedMatrix,
Pattern pattern)
Returns an immutable view of the passed baseMatrix matrix,
such that any reading data from it calculates and returns the ranks
of some given values v regarding the source matrix baseMatrix with the specified pattern.

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

Matrix<? extends UpdatablePArray> 
functionOfPercentilePair(Matrix<? extends PArray> src,
double percentileIndex1,
double percentileIndex2,
Pattern pattern,
Func processingFunc)
Returns a new updatable matrix, containing the result of some given function

Matrix<? extends UpdatablePArray> 
functionOfPercentilePair(Matrix<? extends PArray> src,
Matrix<? extends PArray> percentileIndexes1,
Matrix<? extends PArray> percentileIndexes2,
Pattern pattern,
Func processingFunc)
Returns a new updatable matrix, containing the result of some given function

void 
functionOfPercentilePair(Matrix<? extends UpdatablePArray> dest,
Matrix<? extends PArray> src,
double percentileIndex1,
double percentileIndex2,
Pattern pattern,
Func processingFunc)
Equivalent to
functionOfPercentilePair(Matrix, double, double, Pattern, Func) method,
but the result matrix will be placed in the dest argument. 
void 
functionOfPercentilePair(Matrix<? extends UpdatablePArray> dest,
Matrix<? extends PArray> src,
Matrix<? extends PArray> percentileIndexes1,
Matrix<? extends PArray> percentileIndexes2,
Pattern pattern,
Func processingFunc)
Equivalent to
functionOfPercentilePair(Matrix, Matrix, Matrix, Pattern, Func) method,
but the result matrix will be placed in the dest argument. 
Matrix<? extends UpdatablePArray> 
functionOfSum(Matrix<? extends PArray> src,
Pattern pattern,
Func processingFunc)
Returns a new updatable matrix, containing the result of some given function

void 
functionOfSum(Matrix<? extends UpdatablePArray> dest,
Matrix<? extends PArray> src,
Pattern pattern,
Func processingFunc)
Equivalent to
functionOfSum(Matrix, Pattern, Func) method,
but the result matrix will be placed in the dest argument. 
Matrix<? extends UpdatablePArray> 
mean(Matrix<? extends PArray> src,
Pattern pattern)
Returns a new updatable matrix, containing the mean
of the source matrix by the specified pattern.

void 
mean(Matrix<? extends UpdatablePArray> dest,
Matrix<? extends PArray> src,
Pattern pattern)
Equivalent to
mean(Matrix, Pattern) method,
but the result matrix will be placed in the dest argument. 
Matrix<? extends UpdatablePArray> 
meanBetweenPercentiles(Matrix<? extends PArray> src,
double fromPercentileIndex,
double toPercentileIndex,
Pattern pattern,
double filler)
Returns a new updatable matrix, containing the mean between 2 percentiles
of the source matrix by the specified pattern.

Matrix<? extends UpdatablePArray> 
meanBetweenPercentiles(Matrix<? extends PArray> src,
Matrix<? extends PArray> fromPercentileIndexes,
Matrix<? extends PArray> toPercentileIndexes,
Pattern pattern,
double filler)
Returns a new updatable matrix, containing the mean between 2 percentiles
of the source matrix by the specified pattern.

void 
meanBetweenPercentiles(Matrix<? extends UpdatablePArray> dest,
Matrix<? extends PArray> src,
double fromPercentileIndex,
double toPercentileIndex,
Pattern pattern,
double filler)
Equivalent to
meanBetweenPercentiles(Matrix, double, double, Pattern, double) method,
but the result matrix will be placed in the dest argument. 
void 
meanBetweenPercentiles(Matrix<? extends UpdatablePArray> dest,
Matrix<? extends PArray> src,
Matrix<? extends PArray> fromPercentileIndexes,
Matrix<? extends PArray> toPercentileIndexes,
Pattern pattern,
double filler)
Equivalent to
meanBetweenPercentiles(Matrix, Matrix, Matrix, Pattern, double) method,
but the result matrix will be placed in the dest argument. 
Matrix<? extends UpdatablePArray> 
meanBetweenValues(Matrix<? extends PArray> src,
Matrix<? extends PArray> minValues,
Matrix<? extends PArray> maxValues,
Pattern pattern,
double filler)
Returns a new updatable matrix, containing the mean between 2 values
of the source matrix by the specified pattern.

void 
meanBetweenValues(Matrix<? extends UpdatablePArray> dest,
Matrix<? extends PArray> src,
Matrix<? extends PArray> minValues,
Matrix<? extends PArray> maxValues,
Pattern pattern,
double filler)
Equivalent to
meanBetweenValues(Matrix, Matrix, Matrix, Pattern, double) method, but the result matrix
will be placed in the dest argument. 
Matrix<? extends UpdatablePArray> 
percentile(Matrix<? extends PArray> src,
double percentileIndex,
Pattern pattern)
Returns a new updatable matrix, containing the percentile
of the source matrix by the specified pattern.

Matrix<? extends UpdatablePArray> 
percentile(Matrix<? extends PArray> src,
Matrix<? extends PArray> percentileIndexes,
Pattern pattern)
Returns a new updatable matrix, containing the percentile
of the source matrix by the specified pattern.

void 
percentile(Matrix<? extends UpdatablePArray> dest,
Matrix<? extends PArray> src,
double percentileIndex,
Pattern pattern)
Equivalent to
percentile(Matrix, double, Pattern) method, but the result matrix
will be placed in the dest argument. 
void 
percentile(Matrix<? extends UpdatablePArray> dest,
Matrix<? extends PArray> src,
Matrix<? extends PArray> percentileIndexes,
Pattern pattern)
Equivalent to
percentile(Matrix, Matrix, Pattern) method, but the result matrix
will be placed in the dest argument. 
<T extends PArray> 
rank(java.lang.Class<? extends T> requiredType,
Matrix<? extends PArray> baseMatrix,
Matrix<? extends PArray> rankedMatrix,
Pattern pattern)
Returns a new updatable matrix, containing the rank
of some given values v regarding the source matrix baseMatrix with the specified pattern.

void 
rank(Matrix<? extends UpdatablePArray> dest,
Matrix<? extends PArray> baseMatrix,
Matrix<? extends PArray> rankedMatrix,
Pattern pattern)
Equivalent to
rank(Class, Matrix, Matrix, Pattern) method, but the result matrix
will be placed in the dest argument and the required type will be chosen automatically
as type (PArray.class) 
asDilation, asErosion, beucherGradient, closing, dilation, dilation, dilation, dilation, dilationErosion, erosion, erosion, erosion, erosion, erosionDilation, isPseudoCyclic, maskedDilationErosion, maskedErosionDilation, opening, weakDilation, weakErosion
context
static final double FILL_MIN_VALUE
comments to this class
, section 4 about the
"mean between 2 values" term.
This constant can be used with asMeanBetweenValues(Matrix, Matrix, Matrix, Pattern, double)
,
meanBetweenValues(Matrix, Matrix, Matrix, Pattern, double)
and
meanBetweenValues(Matrix, Matrix, Matrix, Matrix, Pattern, double)
methods.
This constant contains Double.NEGATIVE_INFINITY value, which is usually useless in a role of the ordinary filler for the mode A of calculations.
static final double FILL_MAX_VALUE
comments to this class
, section 4 about the
"mean between 2 values" term.
This constant can be used with asMeanBetweenValues(Matrix, Matrix, Matrix, Pattern, double)
,
meanBetweenValues(Matrix, Matrix, Matrix, Pattern, double)
and
meanBetweenValues(Matrix, Matrix, Matrix, Matrix, Pattern, double)
methods.
This constant contains Double.POSITIVE_INFINITY value, which is usually useless in a role of the ordinary filler for the mode A of calculations.
static final double FILL_NEAREST_VALUE
CountOfValues.isLeftBound()
CountOfValues.isRightBound()
comments to this class
, section 4 about the
"mean between 2 values" term.
This constant can be used with asMeanBetweenValues(Matrix, Matrix, Matrix, Pattern, double)
,
meanBetweenValues(Matrix, Matrix, Matrix, Pattern, double)
and
meanBetweenValues(Matrix, Matrix, Matrix, Matrix, Pattern, double)
methods.
This constant contains Double.NaN value, which is usually useless in a role of the ordinary filler for the mode A of calculations.
Warning: because this constant is Double.NaN, according to rules of Java language, you must not compare any numbers with this constant! A check like
if (x == RankMorphology.FILL_NEAREST_VALUE) { ... }always returns false. You should use Double.isNaN(x) call instead.
RankMorphology context(ArrayContext newContext)
ArrayProcessorWithContextSwitching
subtask
of the full task.context
in interface ArrayProcessorWithContextSwitching
context
in interface Morphology
newContext
 another context, used by the returned instance; may be null.Matrix<? extends PArray> asPercentile(Matrix<? extends PArray> src, Matrix<? extends PArray> percentileIndexes, Pattern pattern)
comments to this class
, section 4 about the "percentile" term.
The real index r of the percentile for every element of the result is equal
to the corresponding element of percentileIndexes matrix.
The element type
of the created matrix is the same as the element type of the source one.
If the element type of the source matrix (and, thus, of the result) is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real percentile
Histogram.iValue
(b, (long)Math.floor(r))Histogram.iPreciseValue
(b, r)array()
.bitsPerElement()
comments to this class
, section 3.
So, if μ is chosen less than the precision of this matrix β
(8 for byte, 16 for short, etc.), then BasicRankMorphology
object, μ is chosen while
instantiating this object
as src
 the source matrix.percentileIndexes
 the matrix containing r argument: the indexes of the percentile
for every element of the result.pattern
 the pattern: the shape of the aperture.java.lang.NullPointerException
 if one of the arguments is null.SizeMismatchException
 if the passed matrices have different dimensions.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.asPercentile(Matrix, double, Pattern)
,
percentile(Matrix, Matrix, Pattern)
,
percentile(Matrix, Matrix, Matrix, Pattern)
Matrix<? extends PArray> asPercentile(Matrix<? extends PArray> src, double percentileIndex, Pattern pattern)
comments to this class
, section 4 about the "percentile" term.
The real index r of the percentile is equal to percentileIndex argument for
all aperture positions. The element type
of the created matrix is the same as the element type of the source one.
This method is equivalent to
asPercentile
(src, src.matrix(Arrays.nDoubleCopies
(src.size(), percentileIndex), pattern)
If the element type of the source matrix (and, thus, of the result) is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real percentile
Histogram.iValue
(b, (long)Math.floor(r))Histogram.iPreciseValue
(b, r)array()
.bitsPerElement()
comments to this class
, section 3.
So, if μ is chosen less than the precision of this matrix β
(8 for byte, 16 for short, etc.), then BasicRankMorphology
object, μ is chosen while
instantiating this object
as src
 the source matrix.percentileIndex
 r argument of the percentile.pattern
 the pattern: the shape of the aperture.java.lang.NullPointerException
 if one of the arguments is null.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.asPercentile(Matrix, Matrix, Pattern)
,
percentile(Matrix, double, Pattern)
,
percentile(Matrix, Matrix, double, Pattern)
Matrix<? extends UpdatablePArray> percentile(Matrix<? extends PArray> src, Matrix<? extends PArray> percentileIndexes, Pattern pattern)
comments to this class
, section 4 about the "percentile" term.
The real index r of the percentile for every element of the result is equal
to the corresponding element of percentileIndexes matrix.
The element type
of the created matrix is the same as the element type of the source one.
If the element type of the source matrix (and, thus, of the result) is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real percentile
Histogram.iValue
(b, (long)Math.floor(r))Histogram.iPreciseValue
(b, r)array()
.bitsPerElement()
comments to this class
, section 3.
So, if μ is chosen less than the precision of this matrix β
(8 for byte, 16 for short, etc.), then BasicRankMorphology
object, μ is chosen while
instantiating this object
as src
 the source matrix.percentileIndexes
 the matrix containing r argument: the indexes of the percentile
for every element of the result.pattern
 the pattern: the shape of the aperture.java.lang.NullPointerException
 if one of the arguments is null.SizeMismatchException
 if the passed matrices have different dimensions.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.percentile(Matrix, double, Pattern)
,
asPercentile(Matrix, Matrix, Pattern)
,
percentile(Matrix, Matrix, Matrix, Pattern)
Matrix<? extends UpdatablePArray> percentile(Matrix<? extends PArray> src, double percentileIndex, Pattern pattern)
comments to this class
, section 4 about the "percentile" term.
The real index r of the percentile is equal to percentileIndex argument for
all aperture positions. The element type
of the created matrix is the same as the element type of the source one.
This method is equivalent to
percentile
(src, src.matrix(Arrays.nDoubleCopies
(src.size(), percentileIndex), pattern)
If the element type of the source matrix (and, thus, of the result) is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real percentile
Histogram.iValue
(b, (long)Math.floor(r))Histogram.iPreciseValue
(b, r)array()
.bitsPerElement()
comments to this class
, section 3.
So, if μ is chosen less than the precision of this matrix β
(8 for byte, 16 for short, etc.), then BasicRankMorphology
object, μ is chosen while
instantiating this object
as src
 the source matrix.percentileIndex
 r argument of the percentile.pattern
 the pattern: the shape of the aperture.java.lang.NullPointerException
 if one of the arguments is null.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.percentile(Matrix, Matrix, Pattern)
,
asPercentile(Matrix, double, Pattern)
,
percentile(Matrix, Matrix, double, Pattern)
void percentile(Matrix<? extends UpdatablePArray> dest, Matrix<? extends PArray> src, Matrix<? extends PArray> percentileIndexes, Pattern pattern)
percentile(Matrix, Matrix, Pattern)
method, but the result matrix
will be placed in the dest argument.
If the element type
of the passed dest matrix
is the same as the element type of the source one, the result, saved in dest, will be identically
equal to the result of percentile(Matrix, Matrix, Pattern)
method with the same
src, percentileIndexes and pattern arguments. In other case,
the result, saved in dest, will be equal to
Matrices.asFuncMatrix
(true,Func.IDENTITY
, dest.array().type()
,percentile
(src, percentileIndexes, pattern))
So, even if the precision of dest matrix is better than the precision of src —
for example, if elementType()
elementType()
asPercentile(Matrix, Matrix, Pattern)
percentile(Matrix, Matrix, Pattern)
dest
 the target matrix.src
 the source matrix.percentileIndexes
 the matrix containing r argument: the indexes of the percentile
for every element of the result.pattern
 the pattern: the shape of the aperture.java.lang.NullPointerException
 if one of the arguments is null.SizeMismatchException
 if the passed matrices have different dimensions.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.percentile(Matrix, Matrix, double, Pattern)
,
asPercentile(Matrix, Matrix, Pattern)
,
percentile(Matrix, Matrix, Pattern)
void percentile(Matrix<? extends UpdatablePArray> dest, Matrix<? extends PArray> src, double percentileIndex, Pattern pattern)
percentile(Matrix, double, Pattern)
method, but the result matrix
will be placed in the dest argument.
This method is equivalent to
percentile
(dest, src, src.matrix(Arrays.nDoubleCopies
(src.size(), percentileIndex), pattern)
dest
 the target matrix.src
 the source matrix.percentileIndex
 r argument of the percentile.pattern
 the pattern: the shape of the aperture.java.lang.NullPointerException
 if one of the arguments is null.SizeMismatchException
 if the passed matrices have different dimensions.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.percentile(Matrix, Matrix, Matrix, Pattern)
,
asPercentile(Matrix, double, Pattern)
,
percentile(Matrix, double, Pattern)
<T extends PArray> Matrix<T> asRank(java.lang.Class<? extends T> requiredType, Matrix<? extends PArray> baseMatrix, Matrix<? extends PArray> rankedMatrix, Pattern pattern)
comments to this class
, section 4 about the "rank" term.
The real value v for every element of the result is equal
to the corresponding element of rankedMatrix matrix.
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 ranks to the desired element type are the same as in
Arrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true.
The element types of baseMatrix and rankedMatrix are usually equal.
If they are different (elementType()
!=rankedMatrix.elementType()
Matrices.asFuncMatrix
(true,Func.IDENTITY
, baseMatrix.array().type()
, rankedMatrix)
before all other calculations. In other words, this method always casts the type of
the ranked elements to the type of baseMatrix elements.
As a result, we can be sure, that if the source baseMatrix matrix is fixedpoint
(boolean, char, byte, short, int or long elements),
then the rank pointCount()
requiredType
 the desired type of the builtin array in the returned matrix.baseMatrix
 the source matrix.rankedMatrix
 the matrix containing v argument: the values,
the rank of which should be calculated.pattern
 the pattern: the shape of the aperture.java.lang.NullPointerException
 if one of the arguments is null.SizeMismatchException
 if the passed matrices have different dimensions.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to baseMatrix.dimCount()
,
or if requiredType is not one of classes
BitArray
.class, CharArray
.class,
ByteArray
.class, ShortArray
.class,
IntArray
.class, LongArray
.class,
FloatArray
.class or DoubleArray
.class.rank(Class, Matrix, Matrix, Pattern)
,
rank(Matrix, Matrix, Matrix, Pattern)
<T extends PArray> Matrix<? extends T> rank(java.lang.Class<? extends T> requiredType, Matrix<? extends PArray> baseMatrix, Matrix<? extends PArray> rankedMatrix, Pattern pattern)
comments to this class
, section 4 about the "rank" term.
The real value v for every element of the result is equal
to the corresponding element of rankedMatrix matrix.
The matrix, returned by this method, is updatable, and the class of its builtin array
implements one of the basic interfaces
UpdatableBitArray
, UpdatableCharArray
,
UpdatableByteArray
, UpdatableShortArray
,
UpdatableIntArray
, UpdatableLongArray
,
UpdatableFloatArray
or UpdatableDoubleArray
.
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.
Instead of these classes, you can also pass one of corresponding immutable interfaces
BitArray
, CharArray
,
ByteArray
, ShortArray
,
IntArray
, LongArray
,
FloatArray
or DoubleArray
:
the result will be the same.
The rules of casting the floatingpoint ranks to the desired element type are the same as in
Arrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true.
The element types of baseMatrix and rankedMatrix are usually equal.
If they are different (elementType()
!=rankedMatrix.elementType()
Matrices.asFuncMatrix
(true,Func.IDENTITY
, baseMatrix.array().type()
, rankedMatrix)
before all other calculations. In other words, this method always casts the type of
the ranked elements to the type of baseMatrix elements.
As a result, we can be sure, that if the source baseMatrix matrix is fixedpoint
(boolean, char, byte, short, int or long elements),
then the rank pointCount()
requiredType
 the desired type of the builtin array in the returned matrix.baseMatrix
 the source matrix.rankedMatrix
 the matrix containing v argument: the values,
the rank of which should be calculated.pattern
 the pattern: the shape of the aperture.java.lang.NullPointerException
 if one of the arguments is null.SizeMismatchException
 if the passed matrices have different dimensions.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to baseMatrix.dimCount()
,
or if requiredType is not one of classes
UpdatableBitArray
.class / BitArray
.class,
UpdatableCharArray
.class / CharArray
.class,
UpdatableByteArray
.class / ByteArray
.class,
UpdatableShortArray
.class / ShortArray
.class,
UpdatableIntArray
.class / IntArray
.class,
UpdatableLongArray
.class / LongArray
.class,
UpdatableFloatArray
.class / FloatArray
.class
or UpdatableDoubleArray
.class /
DoubleArray
.class.asRank(Class, Matrix, Matrix, Pattern)
,
rank(Matrix, Matrix, Matrix, Pattern)
void rank(Matrix<? extends UpdatablePArray> dest, Matrix<? extends PArray> baseMatrix, Matrix<? extends PArray> rankedMatrix, Pattern pattern)
rank(Class, Matrix, Matrix, Pattern)
method, but the result matrix
will be placed in the dest argument and the required type will be chosen automatically
as type
(PArray.class)rank
(dest.array().type()
, baseMatrix, rankedMatrix, pattern)
The element types of baseMatrix and rankedMatrix are usually equal.
If they are different (elementType()
!=rankedMatrix.elementType()
Matrices.asFuncMatrix
(true,Func.IDENTITY
, baseMatrix.array().type()
, rankedMatrix)
before all other calculations. In other words, this method always casts the type of
the ranked elements to the type of baseMatrix elements.
As a result, we can be sure, that if the source baseMatrix matrix is fixedpoint
(boolean, char, byte, short, int or long elements),
then the rank pointCount()
dest
 the target matrix.baseMatrix
 the source matrix.rankedMatrix
 the matrix containing v argument: the values,
the rank of which should be calculated.pattern
 the pattern: the shape of the aperture.java.lang.NullPointerException
 if one of the arguments is null.SizeMismatchException
 if the passed matrices have different dimensions.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to baseMatrix.dimCount()
.asRank(Class, Matrix, Matrix, Pattern)
,
rank(Class, Matrix, Matrix, Pattern)
Matrix<? extends PArray> asMeanBetweenPercentiles(Matrix<? extends PArray> src, Matrix<? extends PArray> fromPercentileIndexes, Matrix<? extends PArray> toPercentileIndexes, Pattern pattern, double filler)
comments to this class
, section 4 about the
"mean between 2 percentiles" term.
The real indexes r_{1} and r_{2} of the percentiles
for every element of the result are equal to the corresponding elements of
fromPercentileIndexes and toPercentileIndexes matrices.
The reserved value filler is specified by the last argument of this method.
The element type
of the created matrix is the same as the element type of the source one.
If the element type of the source matrix (and, thus, of the result) is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real mean, defined in the comments to this class.
In this case, the found mean value m is usually truncated to its integer part
Arrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true.
src
 the source matrix.fromPercentileIndexes
 the matrix containing r_{1} argument: the indexes of
the less percentile of the averaged range for every element of the result.toPercentileIndexes
 the matrix containing r_{2} argument: the indexes of
the greater percentile of the averaged range for every element of the result.pattern
 the pattern: the shape of the aperture.filler
 the reserved value, returned when
java.lang.NullPointerException
 if one of the arguments is null.SizeMismatchException
 if the passed matrices have different dimensions.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.asMeanBetweenPercentiles(Matrix, double, double, Pattern, double)
,
meanBetweenPercentiles(Matrix, Matrix, Matrix, Pattern, double)
,
meanBetweenPercentiles(Matrix, Matrix, Matrix, Matrix, Pattern, double)
Matrix<? extends PArray> asMeanBetweenPercentiles(Matrix<? extends PArray> src, double fromPercentileIndex, double toPercentileIndex, Pattern pattern, double filler)
comments to this class
, section 4 about the
"mean between 2 percentiles" term.
The real indexes r_{1} and r_{2} of the percentiles
for every element of the result are equal to fromPercentileIndex
and toPercentileIndex arguments for all aperture positions.
The reserved value filler is specified by the last argument of this method.
The element type
of the created matrix is the same as the element type of the source one.
This method is equivalent to
asMeanBetweenPercentiles
(src, src.matrix(Arrays.nDoubleCopies
(src.size(), fromPercentileIndex), src.matrix(Arrays.nDoubleCopies
(src.size(), toPercentileIndex), pattern, filler)
If the element type of the source matrix (and, thus, of the result) is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real mean, defined in the comments to this class.
In this case, the found mean value m is usually truncated to its integer part
Arrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true.
src
 the source matrix.fromPercentileIndex
 r_{1} argument: the index of
the less percentile of the averaged range for every element of the result.toPercentileIndex
 r_{2} argument: the indexes of
the greater percentile of the averaged range for every element of the result.pattern
 the pattern: the shape of the aperture.filler
 the reserved value, returned when
java.lang.NullPointerException
 if one of the arguments is null.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.asMeanBetweenPercentiles(Matrix, Matrix, Matrix, Pattern, double)
,
meanBetweenPercentiles(Matrix, double, double, Pattern, double)
,
meanBetweenPercentiles(Matrix, Matrix, double, double, Pattern, double)
Matrix<? extends UpdatablePArray> meanBetweenPercentiles(Matrix<? extends PArray> src, Matrix<? extends PArray> fromPercentileIndexes, Matrix<? extends PArray> toPercentileIndexes, Pattern pattern, double filler)
comments to this class
, section 4 about the
"mean between 2 percentiles" term.
The real indexes r_{1} and r_{2} of the percentiles
for every element of the result are equal to the corresponding elements of
fromPercentileIndexes and toPercentileIndexes matrices.
The reserved value filler is specified by the last argument of this method.
The element type
of the created matrix is the same as the element type of the source one.
If the element type of the source matrix (and, thus, of the result) is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real mean, defined in the comments to this class.
In this case, the found mean value m is usually truncated to its integer part
Arrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true.
src
 the source matrix.fromPercentileIndexes
 the matrix containing r_{1} argument: the indexes of
the less percentile of the averaged range for every element of the result.toPercentileIndexes
 the matrix containing r_{2} argument: the indexes of
the greater percentile of the averaged range for every element of the result.pattern
 the pattern: the shape of the aperture.filler
 the reserved value, returned when
java.lang.NullPointerException
 if one of the arguments is null.SizeMismatchException
 if the passed matrices have different dimensions.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.meanBetweenPercentiles(Matrix, double, double, Pattern, double)
,
asMeanBetweenPercentiles(Matrix, Matrix, Matrix, Pattern, double)
,
meanBetweenPercentiles(Matrix, Matrix, Matrix, Matrix, Pattern, double)
Matrix<? extends UpdatablePArray> meanBetweenPercentiles(Matrix<? extends PArray> src, double fromPercentileIndex, double toPercentileIndex, Pattern pattern, double filler)
comments to this class
, section 4 about the
"mean between 2 percentiles" term.
The real indexes r_{1} and r_{2} of the percentiles
for every element of the result are equal to fromPercentileIndex
and toPercentileIndex arguments for all aperture positions.
The reserved value filler is specified by the last argument of this method.
The element type
of the created matrix is the same as the element type of the source one.
This method is equivalent to
meanBetweenPercentiles
(src, src.matrix(Arrays.nDoubleCopies
(src.size(), fromPercentileIndex), src.matrix(Arrays.nDoubleCopies
(src.size(), toPercentileIndex), pattern, filler)
If the element type of the source matrix (and, thus, of the result) is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real mean, defined in the comments to this class.
In this case, the found mean value m is usually truncated to its integer part
Arrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true.
src
 the source matrix.fromPercentileIndex
 r_{1} argument: the index of
the less percentile of the averaged range for every element of the result.toPercentileIndex
 r_{2} argument: the indexes of
the greater percentile of the averaged range for every element of the result.pattern
 the pattern: the shape of the aperture.filler
 the reserved value, returned when
java.lang.NullPointerException
 if one of the arguments is null.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.meanBetweenPercentiles(Matrix, Matrix, Matrix, Pattern, double)
,
asMeanBetweenPercentiles(Matrix, double, double, Pattern, double)
,
meanBetweenPercentiles(Matrix, Matrix, double, double, Pattern, double)
void meanBetweenPercentiles(Matrix<? extends UpdatablePArray> dest, Matrix<? extends PArray> src, Matrix<? extends PArray> fromPercentileIndexes, Matrix<? extends PArray> toPercentileIndexes, Pattern pattern, double filler)
meanBetweenPercentiles(Matrix, Matrix, Matrix, Pattern, double)
method,
but the result matrix will be placed in the dest argument.
If the element type of dest matrix is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real mean, defined in the comments to this class.
In this case, the found mean value m is usually truncated to its integer part
Arrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true.
dest
 the target matrix.src
 the source matrix.fromPercentileIndexes
 the matrix containing r_{1} argument: the indexes of
the less percentile of the averaged range for every element of the result.toPercentileIndexes
 the matrix containing r_{2} argument: the indexes of
the greater percentile of the averaged range for every element of the result.pattern
 the pattern: the shape of the aperture.filler
 the reserved value, returned when
java.lang.NullPointerException
 if one of the arguments is null.SizeMismatchException
 if the passed matrices have different dimensions.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.meanBetweenPercentiles(Matrix, Matrix, double, double, Pattern, double)
,
asMeanBetweenPercentiles(Matrix, Matrix, Matrix, Pattern, double)
,
meanBetweenPercentiles(Matrix, Matrix, Matrix, Pattern, double)
void meanBetweenPercentiles(Matrix<? extends UpdatablePArray> dest, Matrix<? extends PArray> src, double fromPercentileIndex, double toPercentileIndex, Pattern pattern, double filler)
meanBetweenPercentiles(Matrix, double, double, Pattern, double)
method,
but the result matrix will be placed in the dest argument.
If the element type of dest matrix is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real mean, defined in the comments to this class.
In this case, the found mean value m is usually truncated to its integer part
Arrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true.
dest
 the target matrix.src
 the source matrix.fromPercentileIndex
 r_{1} argument: the index of
the less percentile of the averaged range for every element of the result.toPercentileIndex
 r_{2} argument: the indexes of
the greater percentile of the averaged range for every element of the result.pattern
 the pattern: the shape of the aperture.filler
 the reserved value, returned when
java.lang.NullPointerException
 if one of the arguments is null.SizeMismatchException
 if the passed matrices have different dimensions.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.meanBetweenPercentiles(Matrix, Matrix, Matrix, Matrix, Pattern, double)
,
asMeanBetweenPercentiles(Matrix, double, double, Pattern, double)
,
meanBetweenPercentiles(Matrix, double, double, Pattern, double)
Matrix<? extends PArray> asMeanBetweenValues(Matrix<? extends PArray> src, Matrix<? extends PArray> minValues, Matrix<? extends PArray> maxValues, Pattern pattern, double filler)
comments to this class
, section 4 about the
"mean between 2 values" term.
The real numbers v_{1} and v_{2}
for every element of the result are equal to the corresponding elements of
minValues and maxValues matrices.
The reserved value filler and the mode of calculation (for the case
FILL_MIN_VALUE
(Double.NEGATIVE_INFINITY),
the mode B is used;FILL_MAX_VALUE
(Double.POSITIVE_INFINITY),
the mode C is used;FILL_NEAREST_VALUE
(Double.NaN),
the mode D is used;element type
of the created matrix is the same as the element type of the source one.
If the element type of the source matrix (and, thus, of the result) is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real mean, defined in the comments to this class.
In this case, the found mean value m is usually truncated to its integer part
Arrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true.
src
 the source matrix.minValues
 the matrix containing v_{1} argument: the low bound
of the averaged range of values for every element of the result.maxValues
 the matrix containing v_{2} argument: the high bound
of the averaged range of values for every element of the result.pattern
 the pattern: the shape of the aperture.filler
 the reserved value, returned when
FILL_MIN_VALUE
, FILL_MAX_VALUE
,
FILL_NEAREST_VALUE
, which mean using of special calculation modes B, C, D.java.lang.NullPointerException
 if one of the arguments is null.SizeMismatchException
 if the passed matrices have different dimensions.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.meanBetweenValues(Matrix, Matrix, Matrix, Pattern, double)
,
meanBetweenValues(Matrix, Matrix, Matrix, Matrix, Pattern, double)
Matrix<? extends UpdatablePArray> meanBetweenValues(Matrix<? extends PArray> src, Matrix<? extends PArray> minValues, Matrix<? extends PArray> maxValues, Pattern pattern, double filler)
comments to this class
, section 4 about the
"mean between 2 values" term.
The real numbers v_{1} and v_{2}
for every element of the result are equal to the corresponding elements of
minValues and maxValues matrices.
The reserved value filler and the mode of calculation (for the case
FILL_MIN_VALUE
(Double.NEGATIVE_INFINITY),
the mode B is used;FILL_MAX_VALUE
(Double.POSITIVE_INFINITY),
the mode C is used;FILL_NEAREST_VALUE
(Double.NaN),
the mode D is used;element type
of the created matrix is the same as the element type of the source one.
If the element type of the source matrix (and, thus, of the result) is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real mean, defined in the comments to this class.
In this case, the found mean value m is usually truncated to its integer part
Arrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true.
src
 the source matrix.minValues
 the matrix containing v_{1} argument: the low bound
of the averaged range of values for every element of the result.maxValues
 the matrix containing v_{2} argument: the high bound
of the averaged range of values for every element of the result.pattern
 the pattern: the shape of the aperture.filler
 the reserved value, returned when
FILL_MIN_VALUE
, FILL_MAX_VALUE
,
FILL_NEAREST_VALUE
, which mean using of special calculation modes B, C, D.java.lang.NullPointerException
 if one of the arguments is null.SizeMismatchException
 if the passed matrices have different dimensions.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.asMeanBetweenValues(Matrix, Matrix, Matrix, Pattern, double)
,
meanBetweenValues(Matrix, Matrix, Matrix, Matrix, Pattern, double)
void meanBetweenValues(Matrix<? extends UpdatablePArray> dest, Matrix<? extends PArray> src, Matrix<? extends PArray> minValues, Matrix<? extends PArray> maxValues, Pattern pattern, double filler)
meanBetweenValues(Matrix, Matrix, Matrix, Pattern, double)
method, but the result matrix
will be placed in the dest argument.
If the element type of dest matrix is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real mean, defined in the comments to this class.
In this case, the found mean value m is usually truncated to its integer part
Arrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true.
dest
 the target matrix.src
 the source matrix.minValues
 the matrix containing v_{1} argument: the low bound
of the averaged range of values for every element of the result.maxValues
 the matrix containing v_{2} argument: the high bound
of the averaged range of values for every element of the result.pattern
 the pattern: the shape of the aperture.filler
 the reserved value, returned when
FILL_MIN_VALUE
, FILL_MAX_VALUE
,
FILL_NEAREST_VALUE
, which mean using of special calculation modes B, C, D.java.lang.NullPointerException
 if one of the arguments is null.SizeMismatchException
 if the passed matrices have different dimensions.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.asMeanBetweenValues(Matrix, Matrix, Matrix, Pattern, double)
,
meanBetweenValues(Matrix, Matrix, Matrix, Pattern, double)
Matrix<? extends PArray> asMean(Matrix<? extends PArray> src, Pattern pattern)
More precisely, this method is equivalent to
asFunctionOfSum
(src, pattern, meanFunc)
LinearFunc.getInstance
(0.0, 1.0/N),
pointCount()
elementType()
LinearFunc.getInstance
(0.5, 1.0/N),
pointCount()
elementType()
If the element type of the source matrix (and, thus, of the result) is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real mean, defined above.
In this case, the found mean value m is usually truncated to its integer part
Arrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true.
The described rounding rule explains, why we add 0.5 to the mean in the case of a fixedpoint source
elements. Namely, in this case the combination of adding 0.5 and further truncation to the integer part
works as rounding to the nearest integer:
Note: the behaviour of this method is similar to
asMeanBetweenPercentiles
(src, 0, N, pattern, anyFiller),
where pointCount()
comments to SummingHistogram class
).
Really, in this case the mean between 2 percentiles is equal to
(S(r_{2})−S(r_{1})) / ((r_{2}−r_{1})*σ) = S(N) / (N*σ) = (Σ _{0≤j<M}(j+0.5)*b[j]) / (N*σ)
In the simplest case, when the source elements are real numbers in the "standard" allowed range
(Σ _{0≤i<N}(a_{i}+0.5)) / (NM) = (v'_{0}+v'_{1}+...+v'_{N−1}) / N + 0.5 / M ≈ (v_{0}+v_{1}+...+v_{N−1}) / N
where
In another simplest case, when the source elements are integer numbers, σ=1 and
the elements v_{i} are nonnegative integers,
we have
(Σ _{0≤i<N}(v_{i}+0.5)) / N = (v_{0}+v_{1}+...+v_{N−1}) / N + 0.5
src
 the source matrix.pattern
 the pattern: the shape of the aperture.java.lang.NullPointerException
 if one of the arguments is null.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.mean(Matrix, Pattern)
,
mean(Matrix, Matrix, Pattern)
Matrix<? extends UpdatablePArray> mean(Matrix<? extends PArray> src, Pattern pattern)
More precisely, this method is equivalent to
functionOfSum
(src, pattern, meanFunc)
LinearFunc.getInstance
(0.0, 1.0/N),
pointCount()
elementType()
LinearFunc.getInstance
(0.5, 1.0/N),
pointCount()
elementType()
If the element type of the source matrix (and, thus, of the result) is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real mean, defined above.
In this case, the found mean value m is usually truncated to its integer part
Arrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true.
The described rounding rule explains, why we add 0.5 to the mean in the case of a fixedpoint source
elements. Namely, in this case the combination of adding 0.5 and further truncation to the integer part
works as rounding to the nearest integer:
Note: the behaviour of this method is similar to
meanBetweenPercentiles
(src, 0, N, pattern, anyFiller),
where pointCount()
comments to SummingHistogram class
).
Really, in this case the mean between 2 percentiles is equal to
(S(r_{2})−S(r_{1})) / ((r_{2}−r_{1})*σ) = S(N) / (N*σ) = (Σ _{0≤j<M}(j+0.5)*b[j]) / (N*σ)
In the simplest case, when the source elements are real numbers in the "standard" allowed range
(Σ _{0≤i<N}(a_{i}+0.5)) / (NM) = (v'_{0}+v'_{1}+...+v'_{N−1}) / N + 0.5 / M ≈ (v_{0}+v_{1}+...+v_{N−1}) / N
where
In another simplest case, when the source elements are integer numbers, σ=1 and
the elements v_{i} are nonnegative integers,
we have
(Σ _{0≤i<N}(v_{i}+0.5)) / N = (v_{0}+v_{1}+...+v_{N−1}) / N + 0.5
src
 the source matrix.pattern
 the pattern: the shape of the aperture.java.lang.NullPointerException
 if one of the arguments is null.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.asMean(Matrix, Pattern)
,
mean(Matrix, Matrix, Pattern)
void mean(Matrix<? extends UpdatablePArray> dest, Matrix<? extends PArray> src, Pattern pattern)
mean(Matrix, Pattern)
method,
but the result matrix will be placed in the dest argument.
If the element type of dest matrix is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real mean, defined above.
In this case, the found mean value m is usually truncated to its integer part
Arrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true.
The described rounding rule explains, why we add 0.5 to the mean in the case of a fixedpoint source
elements. Namely, in this case the combination of adding 0.5 and further truncation to the integer part
works as rounding to the nearest integer:
Note: the behaviour of this method is similar to
meanBetweenPercentiles
(src, 0, N, pattern, anyFiller),
where pointCount()
comments to SummingHistogram class
).
Really, in this case the mean between 2 percentiles is equal to
(S(r_{2})−S(r_{1})) / ((r_{2}−r_{1})*σ) = S(N) / (N*σ) = (Σ _{0≤j<M}(j+0.5)*b[j]) / (N*σ)
In the simplest case, when the source elements are real numbers in the "standard" allowed range
(Σ _{0≤i<N}(a_{i}+0.5)) / (NM) = (v'_{0}+v'_{1}+...+v'_{N−1}) / N + 0.5 / M ≈ (v_{0}+v_{1}+...+v_{N−1}) / N
where
In another simplest case, when the source elements are integer numbers, σ=1 and
the elements v_{i} are nonnegative integers,
we have
(Σ _{0≤i<N}(v_{i}+0.5)) / N = (v_{0}+v_{1}+...+v_{N−1}) / N + 0.5
dest
 the target matrix.src
 the source matrix.pattern
 the pattern: the shape of the aperture.java.lang.NullPointerException
 if one of the arguments is null.SizeMismatchException
 if the passed matrices have different dimensions.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.asMean(Matrix, Pattern)
,
mean(Matrix, Pattern)
Matrix<? extends PArray> asFunctionOfSum(Matrix<? extends PArray> src, Pattern pattern, Func processingFunc)
comments to this class
, section 4 about the
"aperture sum" term.
The element type
of the created matrix is the same as the element type of the source one.
The function, applied to each calculated aperture sum S, is specified via
processingFunc argument. Namely, for each aperture position this method
calculates the aperture sum S of the source matrix and returns
get
(S)
If the element type of the source matrix (and, thus, of the result) is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real function result.
In this case, the found function result f is usually truncated to its integer part
Arrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true.
This method can be considered as a generalization of asMean(Matrix, Pattern)
.
src
 the source matrix.pattern
 the pattern: the shape of the aperture.processingFunc
 the function, which should be applied to every calculated aperture sum.java.lang.NullPointerException
 if one of the arguments is null.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.functionOfSum(Matrix, Pattern, Func)
,
functionOfSum(Matrix, Matrix, Pattern, Func)
Matrix<? extends UpdatablePArray> functionOfSum(Matrix<? extends PArray> src, Pattern pattern, Func processingFunc)
comments to this class
, section 4 about the
"aperture sum" term.
The element type
of the created matrix is the same as the element type of the source one.
The function, applied to each calculated aperture sum S, is specified via
processingFunc argument. Namely, for each aperture position this method
calculates the aperture sum S of the source matrix and returns
get
(S)
If the element type of the source matrix (and, thus, of the result) is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real function result.
In this case, the found function result f is usually truncated to its integer part
Arrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true.
This method can be considered as a generalization of mean(Matrix, Pattern)
.
src
 the source matrix.pattern
 the pattern: the shape of the aperture.processingFunc
 the function, which should be applied to every calculated aperture sum.java.lang.NullPointerException
 if one of the arguments is null.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.asFunctionOfSum(Matrix, Pattern, Func)
,
functionOfSum(Matrix, Matrix, Pattern, Func)
void functionOfSum(Matrix<? extends UpdatablePArray> dest, Matrix<? extends PArray> src, Pattern pattern, Func processingFunc)
functionOfSum(Matrix, Pattern, Func)
method,
but the result matrix will be placed in the dest argument.
If the element type of dest matrix is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real function result.
In this case, the found function result f is usually truncated to its integer part
Arrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true.
This method can be considered as a generalization of mean(Matrix, Matrix, Pattern)
.
dest
 the target matrix.src
 the source matrix.pattern
 the pattern: the shape of the aperture.processingFunc
 the function, which should be applied to every calculated aperture sum.java.lang.NullPointerException
 if one of the arguments is null.SizeMismatchException
 if the passed matrices have different dimensions.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.asFunctionOfSum(Matrix, Pattern, Func)
,
functionOfSum(Matrix, Pattern, Func)
Matrix<? extends PArray> asFunctionOfPercentilePair(Matrix<? extends PArray> src, Matrix<? extends PArray> percentileIndexes1, Matrix<? extends PArray> percentileIndexes2, Pattern pattern, Func processingFunc)
comments to this class
, section 4 about the "percentile" term.
The real indexes r of two percentiles for every element of the result are equal
to the corresponding elements of percentileIndexes1 (for v_{1})
or percentileIndexes2 matrix (for v_{2}).
The element type
of the created matrix is the same as the element type of the source one.
The function, applied to each calculated three
get
(v,v_{1},v_{2})
If the element type of the source matrix (and, thus, of the result) is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real function result.
In this case, the found function result f is usually truncated to its integer part
Arrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true.
You can get the same results by 2 calls of asPercentile(Matrix, Matrix, Pattern)
method
for both matrices of percentile indexes and applying the function to them and to the source matrix via
Matrices.asFuncMatrix(Func, Class, Matrix, Matrix, Matrix)
ContrastingFunc
object as processingFunc argument.
src
 the source matrix.percentileIndexes1
 the 1st matrix containing r argument: the indexes of the 1st percentile
v_{1} for every element of the result.percentileIndexes2
 the 2nd matrix containing r argument: the indexes of the 2nd percentile
v_{2} for every element of the result.pattern
 the pattern: the shape of the aperture.processingFunc
 the function, which should be applied to every calculated three
java.lang.NullPointerException
 if one of the arguments is null.SizeMismatchException
 if the passed matrices have different dimensions.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.asFunctionOfPercentilePair(Matrix, double, double, Pattern, Func)
,
functionOfPercentilePair(Matrix, Matrix, Matrix, Pattern, Func)
,
functionOfPercentilePair(Matrix, Matrix, Matrix, Matrix, Pattern, Func)
Matrix<? extends PArray> asFunctionOfPercentilePair(Matrix<? extends PArray> src, double percentileIndex1, double percentileIndex2, Pattern pattern, Func processingFunc)
comments to this class
, section 4 about the "percentile" term.
The real indexes r of two percentiles for every element of the result are equal
to percentileIndex1 (for v_{1})
or percentileIndex2 argument (for v_{2}).
The element type
of the created matrix is the same as the element type of the source one.
This method is equivalent to
asFunctionOfPercentilePair
(src, src.matrix(Arrays.nDoubleCopies
(src.size(), percentileIndex1), src.matrix(Arrays.nDoubleCopies
(src.size(), percentileIndex1), pattern, processingFunc)
If the element type of the source matrix (and, thus, of the result) is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real function result.
In this case, the found function result f is usually truncated to its integer part
Arrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true.
You can get the same results by 2 calls of asPercentile(Matrix, double, Pattern)
method
for both matrices of percentile indexes and applying the function to them and to the source matrix via
Matrices.asFuncMatrix(Func, Class, Matrix, Matrix, Matrix)
ContrastingFunc
object as processingFunc argument.
src
 the source matrix.percentileIndex1
 the 1st r argument: the index of the 1st percentile v_{1}.percentileIndex2
 the 2nd r argument: the index of the 2nd percentile v_{2}.pattern
 the pattern: the shape of the aperture.processingFunc
 the function, which should be applied to every calculated three
java.lang.NullPointerException
 if one of the arguments is null.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.asFunctionOfPercentilePair(Matrix, Matrix, Matrix, Pattern, Func)
,
functionOfPercentilePair(Matrix, double, double, Pattern, Func)
,
functionOfPercentilePair(Matrix, Matrix, double, double, Pattern, Func)
Matrix<? extends UpdatablePArray> functionOfPercentilePair(Matrix<? extends PArray> src, Matrix<? extends PArray> percentileIndexes1, Matrix<? extends PArray> percentileIndexes2, Pattern pattern, Func processingFunc)
comments to this class
, section 4 about the "percentile" term.
The real indexes r of two percentiles for every element of the result are equal
to the corresponding elements of percentileIndexes1 (for v_{1})
or percentileIndexes2 matrix (for v_{2}).
The element type
of the created matrix is the same as the element type of the source one.
The function, applied to each calculated three
get
(v,v_{1},v_{2})
If the element type of the source matrix (and, thus, of the result) is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real function result.
In this case, the found function result f is usually truncated to its integer part
Arrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true.
You can get the same results by 2 calls of percentile(Matrix, Matrix, Pattern)
method
for both matrices of percentile indexes and applying the function to them and to the source matrix via
Matrices.asFuncMatrix(Func, Class, Matrix, Matrix, Matrix)
ContrastingFunc
object as processingFunc argument.
src
 the source matrix.percentileIndexes1
 the 1st matrix containing r argument: the indexes of the 1st percentile
v_{1} for every element of the result.percentileIndexes2
 the 2nd matrix containing r argument: the indexes of the 2nd percentile
v_{2} for every element of the result.pattern
 the pattern: the shape of the aperture.processingFunc
 the function, which should be applied to every calculated three
java.lang.NullPointerException
 if one of the arguments is null.SizeMismatchException
 if the passed matrices have different dimensions.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.functionOfPercentilePair(Matrix, double, double, Pattern, Func)
,
asFunctionOfPercentilePair(Matrix, Matrix, Matrix, Pattern, Func)
,
functionOfPercentilePair(Matrix, Matrix, Matrix, Matrix, Pattern, Func)
Matrix<? extends UpdatablePArray> functionOfPercentilePair(Matrix<? extends PArray> src, double percentileIndex1, double percentileIndex2, Pattern pattern, Func processingFunc)
comments to this class
, section 4 about the "percentile" term.
The real indexes r of two percentiles for every element of the result are equal
to percentileIndex1 (for v_{1})
or percentileIndex2 argument (for v_{2}).
The element type
of the created matrix is the same as the element type of the source one.
This method is equivalent to
functionOfPercentilePair
(src, src.matrix(Arrays.nDoubleCopies
(src.size(), percentileIndex1), src.matrix(Arrays.nDoubleCopies
(src.size(), percentileIndex1), pattern, processingFunc)
If the element type of the source matrix (and, thus, of the result) is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real function result.
In this case, the found function result f is usually truncated to its integer part
Arrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true.
You can get the same results by 2 calls of percentile(Matrix, double, Pattern)
method
for both matrices of percentile indexes and applying the function to them and to the source matrix via
Matrices.asFuncMatrix(Func, Class, Matrix, Matrix, Matrix)
ContrastingFunc
object as processingFunc argument.
src
 the source matrix.percentileIndex1
 the 1st r argument: the index of the 1st percentile v_{1}.percentileIndex2
 the 2nd r argument: the index of the 2nd percentile v_{2}.pattern
 the pattern: the shape of the aperture.processingFunc
 the function, which should be applied to every calculated three
java.lang.NullPointerException
 if one of the arguments is null.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.functionOfPercentilePair(Matrix, Matrix, Matrix, Pattern, Func)
,
asFunctionOfPercentilePair(Matrix, double, double, Pattern, Func)
,
functionOfPercentilePair(Matrix, Matrix, double, double, Pattern, Func)
void functionOfPercentilePair(Matrix<? extends UpdatablePArray> dest, Matrix<? extends PArray> src, Matrix<? extends PArray> percentileIndexes1, Matrix<? extends PArray> percentileIndexes2, Pattern pattern, Func processingFunc)
functionOfPercentilePair(Matrix, Matrix, Matrix, Pattern, Func)
method,
but the result matrix will be placed in the dest argument.
If the element type of dest matrix is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real function result.
In this case, the found function result f is usually truncated to its integer part
Arrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true.
dest
 the target matrix.src
 the source matrix.percentileIndexes1
 the 1st matrix containing r argument: the indexes of the 1st percentile
v_{1} for every element of the result.percentileIndexes2
 the 2nd matrix containing r argument: the indexes of the 2nd percentile
v_{2} for every element of the result.pattern
 the pattern: the shape of the aperture.processingFunc
 the function, which should be applied to every calculated three
java.lang.NullPointerException
 if one of the arguments is null.SizeMismatchException
 if the passed matrices have different dimensions.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.functionOfPercentilePair(Matrix, Matrix, double, double, Pattern, Func)
,
asFunctionOfPercentilePair(Matrix, Matrix, Matrix, Pattern, Func)
,
functionOfPercentilePair(Matrix, Matrix, Matrix, Pattern, Func)
void functionOfPercentilePair(Matrix<? extends UpdatablePArray> dest, Matrix<? extends PArray> src, double percentileIndex1, double percentileIndex2, Pattern pattern, Func processingFunc)
functionOfPercentilePair(Matrix, double, double, Pattern, Func)
method,
but the result matrix will be placed in the dest argument.
If the element type of dest matrix is fixedpoint —
boolean, char, byte, short, int or long —
then we need to round the real function result.
In this case, the found function result f is usually truncated to its integer part
Arrays.asFuncArray(boolean, Func, Class, PArray...)
method with the argument truncateOverflows=true.
dest
 the target matrix.src
 the source matrix.percentileIndex1
 the 1st r argument: the index of the 1st percentile v_{1}.percentileIndex2
 the 2nd r argument: the index of the 2nd percentile v_{2}.pattern
 the pattern: the shape of the aperture.processingFunc
 the function, which should be applied to every calculated three
java.lang.NullPointerException
 if one of the arguments is null.SizeMismatchException
 if the passed matrices have different dimensions.java.lang.IllegalArgumentException
 if the number of the pattern dimensions
pattern.dimCount()
is not equal
to src.dimCount()
.functionOfPercentilePair(Matrix, Matrix, Matrix, Matrix, Pattern, Func)
,
asFunctionOfPercentilePair(Matrix, double, double, Pattern, Func)
,
functionOfPercentilePair(Matrix, double, double, Pattern, Func)