Class RealComplexSparseMatOps

java.lang.Object
org.flag4j.linalg.ops.sparse.coo.real_complex.RealComplexSparseMatOps

public final class RealComplexSparseMatOps extends Object
This class has low level implementations for ops between a real sparse matrix and a complex sparse matrix.
  • Method Details

    • add

      public static CooCMatrix add(CooCMatrix src1, CooMatrix src2)
      Adds a real sparse matrix to a complex sparse matrix. This method assumes that the indices of the two matrices are sorted lexicographically.
      Parameters:
      src1 - First matrix in the sum.
      src2 - Second matrix in the sum.
      Returns:
      The sum of the two matrices src1 and src2.
      Throws:
      IllegalArgumentException - If the two matrices do not have the same shape.
    • add

      public static CMatrix add(CooCMatrix src, double a)
      Adds a double all data (including zero values) of a complex sparse matrix.
      Parameters:
      src - Sparse matrix to add double value to.
      a - Double value to add to the sparse matrix.
      Returns:
      Throws:
      ArithmeticException - If the src sparse matrix is too large to be converted to a dense matrix. That is, there are more than Integer.MAX_VALUE data in the matrix (including zero data).
    • add

      public static CMatrix add(CooMatrix src, Complex128 a)
      Adds a complex number to all data (including zero values) of a real sparse matrix.
      Parameters:
      src - Sparse matrix to add double value to.
      a - Complex value to add to the sparse matrix.
      Returns:
      The result of the matrix addition.
      Throws:
      ArithmeticException - If the src sparse matrix is too large to be converted to a dense matrix. That is, there are more than Integer.MAX_VALUE data in the matrix (including zero data).
    • sub

      public static CooCMatrix sub(CooCMatrix src1, CooMatrix src2)
      Subtracts a real sparse matrix from a complex sparse matrix. This method assumes that the indices of the two matrices are sorted lexicographically.
      Parameters:
      src1 - First matrix in the difference.
      src2 - Second matrix in the difference.
      Returns:
      The difference of the two matrices src1 and src2.
      Throws:
      IllegalArgumentException - If the two matrices do not have the same shape.
    • sub

      public static CooCMatrix sub(CooMatrix src1, CooCMatrix src2)
      Subtracts a complex sparse matrix from a real sparse matrix. This method assumes that the indices of the two matrices are sorted lexicographically.
      Parameters:
      src1 - First matrix in the difference.
      src2 - Second matrix in the difference.
      Returns:
      The difference of the two matrices src1 and src2.
      Throws:
      IllegalArgumentException - If the two matrices do not have the same shape.
    • sub

      public static CMatrix sub(CooCMatrix src, double a)
      Adds a double all data (including zero values) of a complex sparse matrix.
      Parameters:
      src - Sparse matrix to add double value to.
      a - Double value to add to the sparse matrix.
      Returns:
      The result of subtracting the double value from all data of the sparse matrix.
      Throws:
      ArithmeticException - If the src sparse matrix is too large to be converted to a dense matrix. That is, there are more than Integer.MAX_VALUE data in the matrix (including zero data).
    • sub

      public static CMatrix sub(CooMatrix src, Complex128 a)
      Adds a complex number to all data (including zero values) of a real sparse matrix.
      Parameters:
      src - Sparse matrix to add double value to.
      a - Complex value to add to the sparse matrix.
      Returns:
      The result of the matrix addition.
      Throws:
      ArithmeticException - If the src sparse matrix is too large to be converted to a dense matrix. That is, there are more than Integer.MAX_VALUE data in the matrix (including zero data).
    • elemMult

      public static CooCMatrix elemMult(CooCMatrix src1, CooMatrix src2)
      Multiplies two sparse matrices element-wise. This method assumes that the indices of the two matrices are sorted lexicographically.
      Parameters:
      src1 - First matrix in the element-wise multiplication.
      src2 - Second matrix in the element-wise multiplication.
      Returns:
      The element-wise product of the two matrices src1 and src2.
      Throws:
      IllegalArgumentException - If the two matrices do not have the same shape.
    • addToEachCol

      public static CMatrix addToEachCol(CooMatrix src, CooCVector col)
      Adds a sparse vector to each column of a sparse matrix as if the vector is a column vector.
      Parameters:
      src - The source sparse matrix.
      col - Sparse vector to add to each column of the sparse matrix.
      Returns:
      A dense copy of the src matrix with the col vector added to each row of the matrix.
    • addToEachRow

      public static CMatrix addToEachRow(CooMatrix src, CooCVector row)
      Adds a sparse vector to each row of a sparse matrix as if the vector is a row vector.
      Parameters:
      src - The source sparse matrix.
      row - Sparse vector to add to each row of the sparse matrix.
      Returns:
      A dense copy of the src matrix with the row vector added to each row of the matrix.
    • addToEachCol

      public static CMatrix addToEachCol(CooCMatrix src, CooVector col)
      Adds a sparse vector to each column of a sparse matrix as if the vector is a column vector.
      Parameters:
      src - The source sparse matrix.
      col - Sparse vector to add to each column of the sparse matrix.
      Returns:
      A dense copy of the src matrix with the col vector added to each row of the matrix.
    • addToEachRow

      public static CMatrix addToEachRow(CooCMatrix src, CooVector row)
      Adds a sparse vector to each row of a sparse matrix as if the vector is a row vector.
      Parameters:
      src - The source sparse matrix.
      row - Sparse vector to add to each row of the sparse matrix.
      Returns:
      A dense copy of the src matrix with the row vector added to each row of the matrix.