Package com.singularsys.jep.functions
Class VSum
java.lang.Object
com.singularsys.jep.functions.PostfixMathCommand
com.singularsys.jep.functions.ArrayFunctionBase
com.singularsys.jep.functions.VSum
- All Implemented Interfaces:
PostfixMathCommandI,Serializable
Summation function which expands the arguments. The VSum function
will expand any arrays given as arguments so vsum([1,2],[3,4]) will be 10.
This differs from the standard
Sum function which does not expand
them. The result of sum([1,2],[3,4]) in contrast would be [4,6].- Since:
- 3.4
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.singularsys.jep.functions.ArrayFunctionBase
ArrayFunctionBase.ZeroLengthErrorBehaviour -
Field Summary
FieldsFields inherited from class com.singularsys.jep.functions.PostfixMathCommand
curNumberOfParameters, name, NaN, numberOfParameters -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.singularsys.jep.functions.ArrayFunctionBase
addToArray, checkNumberOfParameters, getZeroLengthErrorBehaviour, run, setZeroLengthErrorBehaviour, throwAtLeastOneExcepMethods inherited from class com.singularsys.jep.functions.PostfixMathCommand
asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, getName, getNumberOfParameters, setCurNumberOfParameters, setName, toString, toString
-
Field Details
-
add
-
-
Constructor Details
-
VSum
public VSum()
-
-
Method Details
-
sum
Returns the sum of a set of values. Depends on the Add classes to perform the calculation.- Parameters:
vals- Values to be averaged- Returns:
- the sum of values
- Throws:
EvaluationException- if the calculation cannot be performed
-
calc
Description copied from class:ArrayFunctionBaseAbstract method for performing the array calculation.- Specified by:
calcin classArrayFunctionBase- Parameters:
v- The list to operate on. Note this is in reverse order of the arguments of the function.- Returns:
- The result of the calculation.
- Throws:
EvaluationException- if the calculation cannot be performed
-