Class CooRingMatrixOps

java.lang.Object
org.flag4j.linalg.ops.sparse.coo.ring_ops.CooRingMatrixOps

public final class CooRingMatrixOps extends Object
Utility class for computing ops on sparse COO Ring matrices.
  • Method Details

    • sub

      public static <V extends Ring<V>> SparseMatrixData<V> sub(Shape shape1, V[] src1Entries, int[] src1RowIndices, int[] src1ColIndices, Shape shape2, V[] src2Entries, int[] src2RowIndices, int[] src2ColIndices)
      Computes the element-wise difference of two sparse matrices. This method assumes that the indices of the two matrices are sorted lexicographically.
      Parameters:
      shape1 - Shape of the first matrix.
      src1Entries - Non-zero data of the first matrix.
      src1RowIndices - Non-zero row indices of the first matrix.
      src1ColIndices - Non-zero column indices of the first matrix.
      shape2 - Shape of the second matrix.
      src2Entries - Non-zero data of the second matrix.
      src2RowIndices - Non-zero row indices of the second matrix.
      src2ColIndices - Non-zero column indices of the second matrix.
      Returns:
      The element-wise difference of the two matrices.
      Throws:
      IllegalArgumentException - If the two matrices do not have the same shape.
    • isCloseToIdentity

      public static <T extends Ring<T>> boolean isCloseToIdentity(AbstractCooRingMatrix<?,?,?,T> src)
      Checks if a real sparse matrix is close to the identity matrix.
      Parameters:
      src - Matrix to check if it is the identity matrix.
      Returns:
      true if the src matrix is the identity matrix; false otherwise.
    • isHermitian

      public static <T extends Ring<T>> boolean isHermitian(Shape shape, T[] data, int[] rowIndices, int[] colIndices)
      Checks if a sparse COO Ring matrix is Hermitian.
      Type Parameters:
      T - The ring to which the data values of the COO matrix belong.
      Parameters:
      shape - The shape of the COO matrix.
      data - Non-zero entries of the COO matrix.
      rowIndices - Non-zero row indices of the COO matrix.
      colIndices - Non-zero column indices of the COO matrix.
      Returns:
      true if the specified COO matrix is Hermitian (i.e. equal to its conjugate transpose); false otherwise.