public final class MultiplyingFunc extends java.lang.Object implements Func
Product from several numbers:
f(x0, x1, ..., xn-1) =
scale*x0x1...xn-1,
where scale is a constant, passed to getInstance(double)
method.
The get(double...)
method of the instance of this class may process any number of arguments.
If the number of arguments is 0, it returns scale value.
All calculations are performed in strictfp mode, so the result
is absolutely identical on all platforms.
This class is immutable and thread-safe: there are no ways to modify settings of the created instance.
Func.Updatable
ABS, ABS_DIFF, HALF_X_MINUS_Y, HALF_X_PLUS_Y, HALF_Y_MINUS_X, IDENTITY, MAX, MIN, POSITIVE_DIFF, REVERSE, SELECT, SELECT_FROM_8_DIRECTIONS_2D, SELECT_IF_GREATER, SELECT_IF_GREATER_OR_EQUAL, SHIFTS_ALONG_8_DIRECTIONS_2D, UPDATABLE_IDENTITY, X_MINUS_Y, X_PLUS_Y, Y_MINUS_X
Modifier and Type | Method and Description |
---|---|
double |
get()
Equivalent to
get (new double[0]). |
double |
get(double... x)
Returns the result of this function for the given arguments:
f(x0, x1, ..., xx.length-1).
|
double |
get(double x0)
Equivalent to
get (new double[] {x0}). |
double |
get(double x0,
double x1)
Equivalent to
get (new double[] {x0, x1}). |
double |
get(double x0,
double x1,
double x2)
Equivalent to
get (new double[] {x0, x1, x2}). |
double |
get(double x0,
double x1,
double x2,
double x3)
Equivalent to
get (new double[] {x0, x1, x2, x3}). |
static MultiplyingFunc |
getInstance(double scale)
Returns an instance of this class.
|
java.lang.String |
toString()
Returns a brief string description of this object.
|
public static MultiplyingFunc getInstance(double scale)
scale
- the scale: additional constant multiplier.public double get(double... x)
Func
This method must not change the values of x elements!
public double get()
Func
get
(new double[0]).
Provides better performance because it does not require Java array creation.public double get(double x0)
Func
get
(new double[] {x0}).
Provides better performance because it does not require Java array creation.public double get(double x0, double x1)
Func
get
(new double[] {x0, x1}).
Provides better performance because it does not require Java array creation.public double get(double x0, double x1, double x2)
Func
get
(new double[] {x0, x1, x2}).
Provides better performance because it does not require Java array creation.public double get(double x0, double x1, double x2, double x3)
Func
get
(new double[] {x0, x1, x2, x3}).
Provides better performance because it does not require Java array creation.public java.lang.String toString()
toString
in class java.lang.Object