Class 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
  • Constructor Details

    • MList

      public MList()
  • Method Details

    • calcValue

      public MatrixValueI calcValue(MatrixValueI res, MatrixValueI[] inputs) throws ParseException
      Description copied from class: VList
      Calculates the value of this node.
      Specified by:
      calcValue in interface NaryOperatorI
      Overrides:
      calcValue in class VList
      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:
      1. Converts each node into one of the subtypes of MatrixNodeI
      2. Calculate the dimensions for the results
      3. Performs any special symbolic operations such as differentation
      In general the first step in preprocessing is to run the preprocessor on the children of the node. This can be done using
       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 example
       return (ASTMFunNode) nf.buildOperatorNode(node.getOperator(),children,rhsDim);
       
      Note how the dimension is specified.
      Specified by:
      preprocess in interface SpecialPreProcessorI
      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

      protected void bufferAppend(MatrixNodeI node, PrintVisitor pv, int currank) throws ParseException
      recursive procedure to print the tensor with lots of brackets.
      Throws:
      ParseException
    • append

      public void append(Node node, PrintVisitor pv) throws ParseException
      Used to print the TensorNode with all its children. Method implements PrintVisitor.PrintRulesI.
      Specified by:
      append in interface PrintVisitor.PrintRulesI
      Throws:
      ParseException