Class RealCsrDenseMatrixMultiplication

java.lang.Object
org.flag4j.linalg.ops.dense_sparse.csr.real.RealCsrDenseMatrixMultiplication

public final class RealCsrDenseMatrixMultiplication extends Object
This class contains low-level implementations of real sparse-dense matrix multiplication where the sparse matrix is in CSR format.
  • Method Details

    • standard

      public static Matrix standard(CsrMatrix src1, Matrix src2)
      Computes the matrix multiplication between a real sparse CSR matrix and a real dense matrix. WARNING: If the first matrix is very large but not very sparse, this method may be slower than converting the first matrix to a dense matrix and calling Matrix.mult(Matrix).
      Parameters:
      src1 - First matrix in the matrix multiplication.
      src2 - Second matrix in the matrix multiplication.
      Returns:
      The result of the matrix multiplication between src1 and src2.
      Throws:
      IllegalArgumentException - If src1 does not have the same number of columns as src2 has rows.
    • standard

      public static Matrix standard(Matrix src1, CsrMatrix src2)
      Computes the matrix multiplication between a real dense matrix and a real sparse CSR matrix. WARNING: If the second matrix is very large but not very sparse, this method may be slower than converting the second matrix to a dense matrix and calling Matrix.mult(Matrix).
      Parameters:
      src1 - First matrix in the matrix multiplication (dense matrix).
      src2 - Second matrix in the matrix multiplication (sparse CSR matrix).
      Returns:
      The result of the matrix multiplication between src1 and src2.
      Throws:
      IllegalArgumentException - If src1 does not have the same number of columns as src2 has rows.
    • standardTranspose

      public static Matrix standardTranspose(CsrMatrix src1, Matrix src2)
      Computes the matrix multiplication between a real sparse CSR matrix and the transpose of a real dense matrix. WARNING: This method is likely slower than standard(src1, src2.T()) unless src1 has many more columns than rows and is very sparse.
      Parameters:
      src1 - First matrix in the matrix multiplication.
      src2 - Second matrix in the matrix multiplication. Will be implicitly transposed.
      Returns:
      The result of the matrix multiplication between src1 and src2.
      Throws:
      IllegalArgumentException - If src1 and src2 do not have the same number of rows.
    • standardVector

      public static Vector standardVector(CsrMatrix src1, Vector src2)
      Computes the matrix-vector multiplication between a real sparse CSR matrix and a real dense vector.
      Parameters:
      src1 - The matrix in the multiplication.
      src2 - Vector in multiplication. Treated as a column vector.
      Returns:
      The result of the matrix-vector multiplication.
      Throws:
      IllegalArgumentException - If the number of columns in src1 does not equal the length of src2.