public interface WeightedPattern extends Pattern
MAX_COORDINATE
Modifier and Type  Method and Description 

boolean 
isConstant()
Returns true if the weights of all points are the same.

WeightedPattern 
multiply(double multiplier)
Returns the pattern consisting of points, generated from points of this instance
by multiplying on the mult argument via
IPoint.multiply(double) method. 
java.util.List<WeightedPattern> 
productDecomposition(int minimalPointCount)
Returns the product decomposition:
the list of patterns such that the convolution with this pattern
is equivalent to sequential convolution with all patterns from the list.

WeightedPattern 
scale(double... multipliers)
Returns this pattern, scaled by the specified multipliers along all coordinates.

WeightedPattern 
shift(IPoint shift)
Returns the pattern shifted by the argument, that is consisting of points
with the same
weights ,
generated from points of this instance by adding the argument via IPoint.add(IPoint) method. 
WeightedPattern 
symmetric()
Returns the symmetric pattern: equivalent to
multiply(1.0) . 
double 
weight(IPoint point)
Returns the weight of the given point of the pattern.

Range 
weightRange()
Returns the minimal and maximal weights of all points of this pattern.

allUnionDecompositions, carcass, coordArea, coordMax, coordMin, coordRange, dimCount, hasMinkowskiDecomposition, isSurelyInteger, isSurelyOriginPoint, isSurelySinglePoint, largePointCount, maxBound, maxCarcassMultiplier, minBound, minkowskiAdd, minkowskiDecomposition, minkowskiSubtract, pointCount, points, projectionAlongAxis, round, roundedCoordArea, roundedCoordRange, roundedPoints, shift, unionDecomposition
double weight(IPoint point)
point
 some integer point
.java.lang.NullPointerException
 if the argument is null.java.lang.IllegalArgumentException
 if point.coordCount()
!=Pattern.dimCount()
.Range weightRange()
boolean isConstant()
weightRange()
.size()
==0.0.WeightedPattern shift(IPoint shift)
weights
,
generated from points of this instance by adding the argument via IPoint.add(IPoint)
method.shift
 the shift.java.lang.NullPointerException
 if the argument is null.java.lang.IllegalArgumentException
 if point.coordCount()
!=Pattern.dimCount()
.WeightedPattern multiply(double multiplier)
IPoint.multiply(double)
method.
If mult is not an integer, the generated real coordinates are rounded to integer values.
If several source points are rounded to the same integer point, the weights
of the resulting points may differ from the weights of the source ones,
but the sum of all weights will be approximately same.
If the all source points are transformed to different points,
their weights are preserved.
Please note: if mult is not an integer, the algorithm of rounding is not strictly specified! However, you can be sure that the new pattern will be near from the precise result.
multiply
in interface Pattern
multiplier
 the multiplier.Pattern.scale(double...)
WeightedPattern scale(double... multipliers)
Pattern
More precisely, the resulting pattern consists of the points,
obtained from all points of this pattern by the call
point.scale
(multipliers).
The returned pattern always implements DirectPointSetPattern
if this pattern implements DirectPointSetPattern
The returned pattern always implements RectangularPattern
if this pattern implements RectangularPattern
.
The returned pattern always implements UniformGridPattern
if this pattern implements UniformGridPattern
.
There is a guarantee, that this method does not try to allocate much more memory,
that it is required for storing this pattern itself, and that it
never throws TooManyPointsInPatternError
.
For comparison, an attempt to do the same operation via getting all points (Pattern.points()
method),
correcting them and forming a new pattern via Patterns.newPattern(java.util.Collection)
will lead to TooManyPointsInPatternError
/ OutOfMemoryError for some forms of large patterns.
Warning: this method can fail with TooLargePatternCoordinatesException
, if some of new points
violate restrictions, described in the comments to this interface
,
section "Coordinate restrictions" (for example, due to very large multipliers).
However, such failure is obviously impossible, if all multipliers are
in range 1.0<=multipliers[k]<=1.0.
scale
in interface Pattern
multipliers
 the scales along coordinates.Pattern.multiply(double)
WeightedPattern symmetric()
multiply(1.0)
.java.util.List<WeightedPattern> productDecomposition(int minimalPointCount)
Let the pattern consists of ndimensional points p_{1}, p_{2}, ...
with weights
w_{1}, w_{2}, ...,
and let the integer vector i defines the position of some element of the ndimensional
numeric matrix A.
Here the convolution by this pattern means transforming
the matrix A to another matrix B by the following rules:
B[i] = ∑ w_{k}A[ip_{k}]
This method allows to optimize calculation of this convolution with help of several passes: first you calculate the convolution with the 1st element of the returned list, then you calculate the convolution of the new matrix with the 2nd element of the returned list, etc. The last convolution will be equal (or almost equal, due to possible rounding errors) to the convolution of the source matrix with full this pattern.
The simplest example of such decomposition is a case of the
rectangular
constant
pattern.
In this case, this method should return a list of Pattern.dimCount()
linear constant patterns
(onedimensional segments), the minkowski sum of which is equal to this one.
The linear constant segments should not be further decomposed, because there is an optimal algorithm
for convolution of any matrix with a linear constant segment, requiring 2 operations per element only.
There is no guarantee that this method returns a good decomposition. If this method cannot find required decomposition, it returns the list containing this instance as the only element.
The number of space dimensions in all returned patterns (Pattern.dimCount()
is the same as in this one.
The result of this method is immutable (Collections.unmodifiableList).
minimalPointCount
 this method does not try to decompose patterns that contain
less than minimalPointCount points.java.lang.IllegalArgumentException
 if the argument is negative.