All Implemented Interfaces:
MatrixFunctionI, SymbolicLValueI, LValueI, PostfixMathCommandI, Serializable

public class MatrixEle extends Ele implements MatrixFunctionI, SymbolicLValueI
Gets and sets the elements of a matrix or vector using a MatrixFactory.
See Also:
  • Constructor Details

    • MatrixEle

      public MatrixEle(MatrixFactoryI mfact, IntegerConvertor conv)
    • MatrixEle

      public MatrixEle(MatrixFactoryI mfact, IntegerConvertor conv, boolean javaIndex)
      Element access, either java convention (first element has an index 0) or mathematical convention (first element has an index 1) can be specified.
      Parameters:
      javaIndex - whether to use the java convention, if true index start at 0.
  • Method Details

    • ele

      public Object ele(Object vec, Object rhs) throws EvaluationException
      Description copied from class: Ele
      Find the element of a vector
      Overrides:
      ele in class Ele
      Parameters:
      vec - the vector
      rhs - 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 Object ele(Object mat, Object row, Object col) throws EvaluationException
      Description copied from class: Ele
      Find the element of a matrix
      Overrides:
      ele in class Ele
      Parameters:
      mat - the matrix represented a Vector<Vector<Object>>
      row - the index
      col - the index
      Returns:
      element of matrix referred to by row/col
      Throws:
      EvaluationException - if the calculation cannot be performed
    • ele

      public Object ele(Object mat, Object[] args) throws EvaluationException
      Description copied from class: Ele
      Find element of a multi-dimensional array
      Overrides:
      ele in class Ele
      Parameters:
      mat - the array
      args - 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, Object value) throws EvaluationException
      Description copied from class: Ele
      Sets an element of an vector valued variable. For the expression u[2] = 5 the left hand node is ASTOpNode for the Ele pfmc the method will be called like set(pv,lhs,5); The value of the variable will be replaced by a new Vector<Object> with the appropriate element replaced.
      Specified by:
      set in interface LValueI
      Overrides:
      set in class Ele
      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 LValue, root should be the ASTOpNode for the Ele pfmc.
      value - 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 interface MatrixFunctionI
      Parameters:
      inDims - the dimensions of each argument
      Returns:
      the dimension of the result, or null, if it cannot 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 interface SymbolicLValueI
      Parameters:
      xjep - Jep instance
      node - an LValue whose equation can be set
      eqn - the expression the set in to
      Throws:
      ParseException