Class SymMatrix

java.lang.Object
jline.util.matrix.SymMatrix

public final class SymMatrix extends Object
A dense matrix whose entries are SymExpr rational functions.

The SYMBOLIC counterpart of ComplexMatrix, and it exists for the same reason that one does: Matrix stores doubles, so a scalar that is not a double needs its own container rather than a reinterpretation of that one. The surface here is deliberately only what the pfqn_gld symbolic arm reads -- shape, element access, row and column slicing -- and not a linear algebra API. Nothing in that arm multiplies two matrices.

Every entry shares ONE SymContext, which is what makes the entries addable: Rings fixes the indeterminates when the ring is built. Copyright (c) 2012-2026, Imperial College London All rights reserved.

  • Constructor Details

    • SymMatrix

      public SymMatrix(SymContext ctx, int rows, int cols)
      A zero-filled matrix.
      Parameters:
      ctx - the shared symbolic context
      rows - row count
      cols - column count
  • Method Details

    • of

      public static SymMatrix of(SymContext ctx, double[][] values)
      A matrix of the given numeric values, carried in exactly.
      Parameters:
      ctx - the shared symbolic context
      values - row-major values
      Returns:
      the matrix
    • context

      public SymContext context()
      Returns:
      the shared symbolic context
    • getNumRows

      public int getNumRows()
      Returns:
      the row count
    • getNumCols

      public int getNumCols()
      Returns:
      the column count
    • getNumElements

      public int getNumElements()
      Returns:
      the element count
    • isEmpty

      public boolean isEmpty()
      Returns:
      whether the matrix holds no elements
    • get

      public SymExpr get(int i, int j)
      Parameters:
      i - row
      j - column
      Returns:
      the entry
    • get

      public SymExpr get(int idx)
      Linear access in row-major order, as ComplexMatrix.get(int) offers.
      Parameters:
      idx - linear index
      Returns:
      the entry
    • set

      public void set(int i, int j, SymExpr val)
      Parameters:
      i - row
      j - column
      val - the entry
    • extractRows

      public SymMatrix extractRows(int row0, int row1)
      Rows [row0,row1) as a new matrix.
      Parameters:
      row0 - first row, inclusive
      row1 - last row, exclusive
      Returns:
      the slice
    • extractColumns

      public SymMatrix extractColumns(int col0, int col1)
      Columns [col0,col1) as a new matrix.
      Parameters:
      col0 - first column, inclusive
      col1 - last column, exclusive
      Returns:
      the slice
    • copy

      public SymMatrix copy()
      Returns:
      an independent copy
    • toString

      public String toString()
      Overrides:
      toString in class Object