Package org.lsmp.djep.matrixJep.function
Class MList
java.lang.Object
org.nfunk.jep.function.PostfixMathCommand
org.nfunk.jep.function.List
org.lsmp.djep.vectorJep.function.VList
org.lsmp.djep.matrixJep.function.MList
- All Implemented Interfaces:
SpecialPreProcessorI
,NaryOperatorI
,PrintVisitor.PrintRulesI
,PostfixMathCommandI
public class MList
extends VList
implements PrintVisitor.PrintRulesI, NaryOperatorI, SpecialPreProcessorI
A enhanced version of list, allows matrices and tensors.
- Author:
- Rich Morris Created on 27-Nov-2003
-
Field Summary
Fields inherited from class org.nfunk.jep.function.PostfixMathCommand
curNumberOfParameters, numberOfParameters
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
append
(Node node, PrintVisitor pv) Used to print the TensorNode with all its children.protected void
bufferAppend
(MatrixNodeI node, PrintVisitor pv, int currank) recursive procedure to print the tensor with lots of brackets.calcValue
(MatrixValueI res, MatrixValueI[] inputs) Calculates the value of this node.preprocess
(ASTFunNode node, MatrixPreprocessor visitor, MatrixJep jep, MatrixNodeFactory nf) Subverts the preprocessing stage.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.lsmp.djep.vectorJep.function.NaryOperatorI
calcDim
Methods inherited from interface org.nfunk.jep.function.PostfixMathCommandI
checkNumberOfParameters, getNumberOfParameters, run, setCurNumberOfParameters
-
Constructor Details
-
MList
public MList()
-
-
Method Details
-
calcValue
Description copied from class:VList
Calculates the value of this node.- Specified by:
calcValue
in interfaceNaryOperatorI
- Overrides:
calcValue
in classVList
- Throws:
ParseException
-
preprocess
public MatrixNodeI preprocess(ASTFunNode node, MatrixPreprocessor visitor, MatrixJep jep, MatrixNodeFactory nf) throws ParseException Description copied from interface:SpecialPreProcessorI
Subverts the preprocessing stage. Preprocessing performs a number of operations:- Converts each node into one of the subtypes of MatrixNodeI
- Calculate the dimensions for the results
- Performs any special symbolic operations such as differentation
MatrixNodeI children[] = visitor.visitChildrenAsArray(node,null);
The final step is to construct a node of the correct type. The MatrixNodeFactory argument has a number of methods to do this. For examplereturn (ASTMFunNode) nf.buildOperatorNode(node.getOperator(),children,rhsDim);
Note how the dimension is specified.- Specified by:
preprocess
in interfaceSpecialPreProcessorI
- Parameters:
node
- the top node of the tree representing the function and its arguments.visitor
- A reference to the preprocessing visitor.jep
- A reference of the MatrixJep instance.nf
- A reference to the node factory object.- Returns:
- A new MatrixNodeI representing the converted function.
- Throws:
ParseException
- if some error occurs.
-
bufferAppend
recursive procedure to print the tensor with lots of brackets.- Throws:
ParseException
-
append
Used to print the TensorNode with all its children. Method implements PrintVisitor.PrintRulesI.- Specified by:
append
in interfacePrintVisitor.PrintRulesI
- Throws:
ParseException
-