Class MatrixEle
- java.lang.Object
-
- com.singularsys.jep.functions.PostfixMathCommand
-
- com.singularsys.jep.functions.NaryFunction
-
- com.singularsys.jep.functions.Ele
-
- com.singularsys.extensions.matrix.functions.MatrixEle
-
- All Implemented Interfaces:
MatrixFunctionI
,SymbolicLValueI
,LValueI
,PostfixMathCommandI
,java.io.Serializable
public class MatrixEle extends Ele implements MatrixFunctionI, SymbolicLValueI
Gets and sets the elements of a matrix or vector using a MatrixFactory.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.singularsys.jep.functions.Ele
indexShift
-
Fields inherited from class com.singularsys.jep.functions.PostfixMathCommand
curNumberOfParameters, name, NaN, numberOfParameters
-
-
Constructor Summary
Constructors Constructor Description MatrixEle(MatrixFactoryI mfact, IntegerConvertor conv)
MatrixEle(MatrixFactoryI mfact, IntegerConvertor conv, boolean javaIndex)
Element access, either java convention (first element has index 0) or mathematical convention (first element has index 1) can be specified.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Dimensions
calcDims(Dimensions... inDims)
Attempts to calculate the dimensions of a result of a PostfixMathCommand.java.lang.Object
ele(java.lang.Object vec, java.lang.Object rhs)
Find the element of a vectorjava.lang.Object
ele(java.lang.Object mat, java.lang.Object[] args)
Find element of a multi-dimensional arrayjava.lang.Object
ele(java.lang.Object mat, java.lang.Object row, java.lang.Object col)
Find the element of a matrixvoid
set(Evaluator pv, Node node, java.lang.Object value)
Performs appropriate action to set an LValue.void
setEqn(Jep xjep, Node node, Node eqn)
Sets the equation of an LValue-
Methods inherited from class com.singularsys.jep.functions.Ele
checkNumberOfParameters, ele, eval, getVariable
-
Methods inherited from class com.singularsys.jep.functions.NaryFunction
run
-
Methods inherited from class com.singularsys.jep.functions.PostfixMathCommand
asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, getName, getNumberOfParameters, setCurNumberOfParameters, setName, toString, toString
-
-
-
-
Constructor Detail
-
MatrixEle
public MatrixEle(MatrixFactoryI mfact, IntegerConvertor conv)
-
MatrixEle
public MatrixEle(MatrixFactoryI mfact, IntegerConvertor conv, boolean javaIndex)
Element access, either java convention (first element has index 0) or mathematical convention (first element has index 1) can be specified.- Parameters:
javaIndex
- whether to use the java convention, if true index start at 0.
-
-
Method Detail
-
ele
public java.lang.Object ele(java.lang.Object vec, java.lang.Object rhs) throws EvaluationException
Description copied from class:Ele
Find the element of a vector- Overrides:
ele
in classEle
- Parameters:
vec
- the vectorrhs
- the index either as a vector with a single value or as a single value.- Returns:
- element of vec referred to by the index.
- Throws:
EvaluationException
- if the calculation cannot be performed
-
ele
public java.lang.Object ele(java.lang.Object mat, java.lang.Object row, java.lang.Object col) throws EvaluationException
Description copied from class:Ele
Find the element of a matrix- Overrides:
ele
in classEle
- Parameters:
mat
- the matrix represented a a Vector<Vector<Object>>row
- the indexcol
- the index- Returns:
- element of matrix referred to by row/col
- Throws:
EvaluationException
- if the calculation cannot be performed
-
ele
public java.lang.Object ele(java.lang.Object mat, java.lang.Object[] args) throws EvaluationException
Description copied from class:Ele
Find element of a multi-dimensional array- Overrides:
ele
in classEle
- Parameters:
mat
- the arrayargs
- array of indices- Returns:
- element in mat referred to by indices
- Throws:
EvaluationException
- if the calculation cannot be performed
-
set
public void set(Evaluator pv, Node node, java.lang.Object value) throws EvaluationException
Description copied from interface:LValueI
Performs appropriate action to set an LValue.- Specified by:
set
in interfaceLValueI
- Overrides:
set
in classEle
- Parameters:
pv
- a pointer to the evaluator. The pv.eval() method can be used to evaluate the children of the node.node
- The top node for the LValuevalue
- the value obtained by evaluating the right hand side.- Throws:
EvaluationException
- if the calculation cannot be performed
-
calcDims
public Dimensions calcDims(Dimensions... inDims) throws ParseException
Description copied from interface:MatrixFunctionI
Attempts to calculate the dimensions of a result of a PostfixMathCommand.- Specified by:
calcDims
in interfaceMatrixFunctionI
- Parameters:
inDims
- the dimensions of each argument- Returns:
- the dimension of the result or null if can be calculated
- Throws:
ParseException
- if there is a parse error
-
setEqn
public void setEqn(Jep xjep, Node node, Node eqn) throws ParseException
Description copied from interface:SymbolicLValueI
Sets the equation of an LValue- Specified by:
setEqn
in interfaceSymbolicLValueI
- Parameters:
xjep
- Jep instancenode
- an LValue whose equation can be seteqn
- the expression the set in to- Throws:
ParseException
-
-