Package org.lsmp.djep.vectorJep.function
Class Size
java.lang.Object
org.nfunk.jep.function.PostfixMathCommand
org.lsmp.djep.vectorJep.function.Size
- All Implemented Interfaces:
UnaryOperatorI
,PostfixMathCommandI
Returns the size of an Scaler, Vector or Matrix.
size(7) -> 1 size([1,2,3]) -> 3 size([[1,2,3],[4,5,6]]) -> [2,3] size([[[1,2],[3,4],[5,6]],[[7,8],[9,10],[11,12]]]) -> [2,3,2]
- Author:
- Rich Morris Created on 13-Feb-2005
-
Field Summary
Fields inherited from class org.nfunk.jep.function.PostfixMathCommand
curNumberOfParameters, numberOfParameters
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncalcDim
(Dimensions ldim) Find the dimensions of this operator when applied to arguments with given dimensions.calcValue
(MatrixValueI res, MatrixValueI lhs) Calculates the value of this operator for given input with results stored in res.void
Throws an exception because this method should never be called under normal circumstances.Methods inherited from class org.nfunk.jep.function.PostfixMathCommand
checkNumberOfParameters, checkStack, getNumberOfParameters, setCurNumberOfParameters
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.nfunk.jep.function.PostfixMathCommandI
checkNumberOfParameters, getNumberOfParameters, setCurNumberOfParameters
-
Constructor Details
-
Size
public Size()
-
-
Method Details
-
calcDim
Description copied from interface:UnaryOperatorI
Find the dimensions of this operator when applied to arguments with given dimensions.- Specified by:
calcDim
in interfaceUnaryOperatorI
-
calcValue
Description copied from interface:UnaryOperatorI
Calculates the value of this operator for given input with results stored in res. res is returned. Using this method is slightly faster than the standard run method as it eliminates the construction of tempoary objects.- Specified by:
calcValue
in interfaceUnaryOperatorI
- Throws:
ParseException
-
run
Description copied from class:PostfixMathCommand
Throws an exception because this method should never be called under normal circumstances. Each function should use it's own run() method for evaluating the function. This includes popping off the parameters from the stack, and pushing the result back on the stack.- Specified by:
run
in interfacePostfixMathCommandI
- Overrides:
run
in classPostfixMathCommand
- Throws:
ParseException
-