Class CooSemiringMatMult

java.lang.Object
org.flag4j.linalg.ops.sparse.coo.semiring_ops.CooSemiringMatMult

public final class CooSemiringMatMult extends Object
This utility class contains methods useful for computing the matrix multiplication between two sparse COO Semiring tensors.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T extends Semiring<T>>
    void
    concurrentStandard(T[] src1, int[] rowIndices1, int[] colIndices1, Shape shape1, T[] src2, int[] rowIndices2, int[] colIndices2, Shape shape2, T[] dest)
    Computes the matrix multiplication between two sparse matrices using a concurrent implementation of the standard algorithm.
    static <T extends Semiring<T>>
    void
    concurrentStandardVector(T[] src1, int[] rowIndices1, int[] colIndices1, Shape shape1, T[] src2, int[] indices, T[] dest)
    Computes the multiplication between a sparse matrix and a sparse vector using a concurrent implementation of the standard algorithm.
    static <T extends Semiring<T>>
    void
    standard(T[] src1, int[] rowIndices1, int[] colIndices1, Shape shape1, T[] src2, int[] rowIndices2, int[] colIndices2, Shape shape2, T[] dest)
    Computes the matrix multiplication between two sparse matrices using a standard algorithm.
    static <T extends Semiring<T>>
    void
    standardVector(T[] src1, int[] rowIndices1, int[] colIndices1, Shape shape1, T[] src2, int[] indices, T[] dest)
    Computes the multiplication between a sparse matrix and a sparse vector using a standard algorithm.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • standard

      public static <T extends Semiring<T>> void standard(T[] src1, int[] rowIndices1, int[] colIndices1, Shape shape1, T[] src2, int[] rowIndices2, int[] colIndices2, Shape shape2, T[] dest)
      Computes the matrix multiplication between two sparse matrices using a standard algorithm.
      Parameters:
      src1 - Non-zero data of the first sparse matrix.
      rowIndices1 - Row indices of non-zero data for the first sparse matrix.
      colIndices1 - Column indices of non-zero data for the first sparse matrix.
      shape1 - Shape of the first sparse matrix.
      src2 - Non-zero data of the second sparse matrix.
      rowIndices2 - Row indices of non-zero data for the second sparse matrix.
      colIndices2 - column indices of non-zero data for the second sparse matrix.
      shape2 - Shape of the second sparse matrix.
      dest - Array to store the dense result of the matrix multiplication in. Must have length shape1.get(0)*shape2.get(1).
    • concurrentStandard

      public static <T extends Semiring<T>> void concurrentStandard(T[] src1, int[] rowIndices1, int[] colIndices1, Shape shape1, T[] src2, int[] rowIndices2, int[] colIndices2, Shape shape2, T[] dest)

      Computes the matrix multiplication between two sparse matrices using a concurrent implementation of the standard algorithm.

      NOTE: Caution should be exercised when using this method. It is rarely faster than standard(Semiring[], int[], int[], Shape, Semiring[], int[], int[], Shape, Semiring[])

      Parameters:
      src1 - Non-zero data of the first sparse matrix.
      rowIndices1 - Row indices of non-zero data for the first sparse matrix.
      colIndices1 - Column indices of non-zero data for the first sparse matrix.
      shape1 - Shape of the first sparse matrix.
      src2 - Non-zero data of the second sparse matrix.
      rowIndices2 - Row indices of non-zero data for the second sparse matrix.
      colIndices2 - column indices of non-zero data for the second sparse matrix.
      shape2 - Shape of the second sparse matrix.
      dest - Array to store the dense result of the matrix multiplication in. Must have length shape1.get(0)*shape2.get(1).
    • standardVector

      public static <T extends Semiring<T>> void standardVector(T[] src1, int[] rowIndices1, int[] colIndices1, Shape shape1, T[] src2, int[] indices, T[] dest)

      Computes the multiplication between a sparse matrix and a sparse vector using a standard algorithm.

      Parameters:
      src1 - Non-zero data of the first sparse matrix.
      rowIndices1 - Row indices of non-zero data for the first sparse matrix.
      colIndices1 - Column indices of non-zero data for the first sparse matrix.
      shape1 - Shape of the first sparse matrix.
      src2 - Non-zero data of the second sparse matrix.
      indices - Indices of non-zero data in the sparse vector.
      dest - Array to store the resulting dense vector in.
    • concurrentStandardVector

      public static <T extends Semiring<T>> void concurrentStandardVector(T[] src1, int[] rowIndices1, int[] colIndices1, Shape shape1, T[] src2, int[] indices, T[] dest)

      Computes the multiplication between a sparse matrix and a sparse vector using a concurrent implementation of the standard algorithm.

      NOTE: Caution should be exercised when using this method. It is rarely faster than standardVector(Semiring[], int[], int[], Shape, Semiring[], int[], Semiring[])

      Parameters:
      src1 - Non-zero data of the first sparse matrix.
      rowIndices1 - Row indices of non-zero data for the first sparse matrix.
      colIndices1 - Column indices of non-zero data for the first sparse matrix.
      shape1 - Shape of the first sparse matrix.
      src2 - Non-zero data of the second sparse matrix.
      indices - Indices of non-zero data in the sparse vector.
      dest - Array to store the dense result of the matrix multiplication in. Must have length shape1.get(0).