Class RealFieldDenseCooMatrixOps

java.lang.Object
org.flag4j.linalg.ops.dense_sparse.coo.real_field_ops.RealFieldDenseCooMatrixOps

public final class RealFieldDenseCooMatrixOps extends Object
This class contains low level implementations of ops between real/field and dense/sparse matrices.
  • Method Details

    • add

      public static <T extends Field<T>> AbstractDenseFieldMatrix<?,?,T> add(AbstractDenseFieldMatrix<?,?,T> src1, CooMatrix src2)
      Adds a real dense matrix to a real sparse matrix.
      Parameters:
      src1 - First matrix.
      src2 - Second matrix.
      Returns:
      The result of the matrix addition.
      Throws:
      IllegalArgumentException - If the matrices do not have the same shape.
    • sub

      public static <T extends Field<T>> AbstractDenseFieldMatrix<?,?,T> sub(AbstractDenseFieldMatrix<?,?,T> src1, CooMatrix src2)
      Subtracts a real sparse matrix from a complex dense matrix.
      Parameters:
      src1 - First matrix.
      src2 - Second matrix.
      Returns:
      The result of the matrix subtraction.
      Throws:
      IllegalArgumentException - If the matrices do not have the same shape.
    • sub

      public static <T extends Field<T>> AbstractDenseFieldMatrix<?,?,T> sub(CooMatrix src1, AbstractDenseFieldMatrix<?,?,T> src2)
      Subtracts a real sparse matrix from a real dense matrix.
      Parameters:
      src1 - First matrix.
      src2 - Second matrix.
      Returns:
      The result of the matrix subtraction.
      Throws:
      IllegalArgumentException - If the matrices do not have the same shape.
    • addEq

      public static <T extends Field<T>> void addEq(AbstractDenseFieldMatrix<?,?,T> src1, CooMatrix src2)
      Adds a complex dense matrix to a real sparse matrix and stores the result in the first matrix.
      Parameters:
      src1 - Entries of first matrix in the sum. Also, the storage for the result.
      src2 - Entries of second matrix in the sum.
      Throws:
      IllegalArgumentException - If the matrices do not have the same shape.
    • subEq

      public static <T extends Field<T>> void subEq(AbstractDenseFieldMatrix<?,?,T> src1, CooMatrix src2)
      Subtracts a real sparse matrix from a complex dense matrix and stores the result in the first matrix.
      Parameters:
      src1 - Entries of first matrix in the sum. Also, the storage for the result.
      src2 - Entries of second matrix in the sum.
      Throws:
      IllegalArgumentException - If the matrices do not have the same shape.
    • elemMult

      public static <T extends Field<T>> AbstractCooFieldMatrix<?,?,?,T> elemMult(Matrix src1, AbstractCooFieldMatrix<?,?,?,T> src2)
      Computes the element-wise multiplication between a real dense matrix and a complex sparse matrix.
      Parameters:
      src1 - First matrix.
      src2 - Second matrix.
      Returns:
      The result of element-wise multiplication.
      Throws:
      IllegalArgumentException - If the matrices do not have the same shape.
    • elemMult

      public static <T extends Field<T>> void elemMult(AbstractDenseFieldMatrix<?,?,T> src1, CooMatrix src2, Field<T>[] destEntries)
      Computes the element-wise multiplication between two matrices.
      Parameters:
      src1 - First matrix.
      src2 - Second matrix.
      destEntries - Array to store non-zero values resulting from the element-wise product. Assumed to have length src2.nnz.
      Throws:
      TensorShapeException - If the matrices do not have the same shape.
    • elemDiv

      public static <T extends Field<T>> AbstractCooFieldMatrix<?,?,?,T> elemDiv(AbstractCooFieldMatrix<?,?,?,T> src1, Matrix src2)
      Computes the element-wise division between a complex sparse matrix and a real dense matrix.

      If the dense matrix contains a zero at the same index the sparse matrix contains a non-zero, the result will be either Double.POSITIVE_INFINITY or Double.NEGATIVE_INFINITY.

      If the dense matrix contains a zero at an index for which the sparse matrix is also zero, the result will be zero. This is done to realize computational benefits from ops with sparse matrices.

      Parameters:
      src1 - Real sparse matrix and numerator in element-wise quotient.
      src2 - Real Dense matrix and denominator in element-wise quotient.
      Returns:
      The element-wise quotient of src1 and src2.
      Throws:
      IllegalArgumentException - If src1 and src2 do not have the same shape.