If there are no values in the dataset, then 1 is returned.
If any of the values are
NaN, then NaN is returned.
Note that this implementation is not synchronized. If
multiple threads access an instance of this class concurrently, and at least
one of the threads invokes the increment() or
clear() method, it must be synchronized externally.
| Modifier and Type | Field and Description |
|---|---|
| private long | n
The number of values that have been added |
| private static final long | serialVersionUID
Serializable version identifier |
| private double | value
The current Running Product. |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | clear()
Implements abstract org. Implements org. Clears the internal state of the Statistic |
| public Product | copy()
Implements abstract org. Implements org. Returns a copy of the statistic with the same internal state. |
| public static void | |
| public double | Returns: the product of the values or 1 if length = 0the input array values, final int index of the first array element to include begin, final int the number of elements to include length)Overrides org. Implements org. Returns the product of the entries in the specified portion of
the input array, or |
| public double | Returns: the product of the values or 1 if length = 0the input array values, final double[] the weights array weights, final int index of the first array element to include begin, final int the number of elements to include length)Implements org. Returns the weighted product of the entries in the specified portion of
the input array, or |
| public double | Returns: the product of the values or Double.NaN if length = 0the input array values, final double[] the weights array weights)Implements org. Returns the weighted product of the entries in the input array. |
| public long | getN()
Implements org. Returns the number of values that have been added. |
| public double | getResult()
Implements abstract org. Implements org. Returns the current value of the Statistic. |
| public void | increment(final double
the new value. d)Implements abstract org. Implements org. Updates the internal state of the statistic to reflect the addition of the new value. |
| n | back to summary |
|---|---|
| private long n The number of values that have been added | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Serializable version identifier | |
| value | back to summary |
|---|---|
| private double value The current Running Product. | |
| Product | back to summary |
|---|---|
| public Product() Create a Product instance | |
| Product | back to summary |
|---|---|
| public Product(Product original) throws NullArgumentException Copy constructor, creates a new
| |
| clear | back to summary |
|---|---|
| public void clear() Implements abstract org. Implements org. Doc from org. Clears the internal state of the Statistic
| |
| copy | back to summary |
|---|---|
| public Product copy() Implements abstract org. Implements org. Doc from org. Returns a copy of the statistic with the same internal state.
| |
| copy | back to summary |
|---|---|
| public static void copy(Product source, Product dest) throws NullArgumentException Copies source to dest. Neither source nor dest can be null.
| |
| evaluate | back to summary |
|---|---|
| public double evaluate(final double[] values, final int begin, final int length) throws MathIllegalArgumentException Overrides org. Implements org. Returns the product of the entries in the specified portion of
the input array, or
Throws
| |
| evaluate | back to summary |
|---|---|
| public double evaluate(final double[] values, final double[] weights, final int begin, final int length) throws MathIllegalArgumentException Implements org. Returns the weighted product of the entries in the specified portion of
the input array, or Throws
Uses the formula, weighted product = ∏values[i]weights[i]that is, the weights are applied as exponents when computing the weighted product.
| |
| evaluate | back to summary |
|---|---|
| public double evaluate(final double[] values, final double[] weights) throws MathIllegalArgumentException Implements org. Returns the weighted product of the entries in the input array. Throws
Uses the formula, weighted product = ∏values[i]weights[i]that is, the weights are applied as exponents when computing the weighted product.
| |
| getN | back to summary |
|---|---|
| public long getN() Implements org. Doc from org. Returns the number of values that have been added.
| |
| getResult | back to summary |
|---|---|
| public double getResult() Implements abstract org. Implements org. Doc from org. Returns the current value of the Statistic.
| |
| increment | back to summary |
|---|---|
| public void increment(final double d) Implements abstract org. Implements org. Doc from org. Updates the internal state of the statistic to reflect the addition of the new value.
| |