Class MatrixVariable

java.lang.Object
math.matrix.expressParser.MatrixVariable

public class MatrixVariable extends Object
  • Field Details

    • name

      private String name
      The name of the Matrix Variable. A valid Matrix Variable Name must start with # and the rest of its body must be a valid variable name.
    • matrix

      private Matrix matrix
      The matrix object stored by this variable.
  • Constructor Details

    • MatrixVariable

      public MatrixVariable(String name, Matrix matrix)
      Parameters:
      name - The name of the Matrix object.
      matrix - The Matrix object used to set the Matrix value stored by this MatrixVariable object.
    • MatrixVariable

      public MatrixVariable(String name, String expression)
      Here an expression like A=[2,3,4:-2,3,4:5,1,20] is passed into the constructor.
      Parameters:
      name - The name of the matrix.
      expression - The compound expression containing information useful in creating the MatrixVariable object..e.g [2,3,4:-2,3,4:5,1,20]
  • Method Details

    • setMatrixVariable

      public void setMatrixVariable(String expression)
    • setMatrix

      public void setMatrix(Matrix matrix)
    • getMatrix

      public Matrix getMatrix()
    • getName

      public String getName()
    • setName

      public void setName(String name)
    • getCreatingExpression

      public String getCreatingExpression()
      Returns:
      the equivalent string expression that creates the matrix variable and stores its present matrix value in it.
    • isMatrixVariableName

      public static boolean isMatrixVariableName(String name)
      A + B + 2*C + A.B - A.B^5 + 3*4*A^2*C+I Matrix names must start with # in this syntax.
      Parameters:
      name - The string to be checked if or not it represents a valid matrix name.
      Returns:
      true if the name represents a valid matrix name.
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      the view of the matrix in the format...A = num1, num2, num3 ....numi numi+1,numi+2,numi+3....numj numj+1,numj+2,numj+3....numk e.t.c.
    • main

      public static void main(String[] args)