Class DenseSemiringMatMultDispatcher

java.lang.Object
org.flag4j.linalg.ops.dense.semiring_ops.DenseSemiringMatMultDispatcher

public final class DenseSemiringMatMultDispatcher extends Object
Singleton class which stores a map of all viable dense Semiring matrix multiply algorithms and uses that map to dispatch a dense Semiring matrix multiply problem to the appropriate algorithm.
  • Method Details

    • getInstance

      public static DenseSemiringMatMultDispatcher getInstance()
      Gets the singleton instance of this class. If this class has not been instanced, a new instance will be created.
      Returns:
      The singleton instance of this class.
    • dispatchVector

      public static <T extends Semiring<T>> void dispatchVector(T[] src1, Shape shape1, T[] src2, Shape shape2, T[] dest)
      Dispatches a matrix-vector multiplication problem to the appropriate algorithm based on the size of the matrix and vector.
      Parameters:
      src1 - Entries of the matrix in the matrix-vector multiplication problem.
      shape1 - Shape of the matrix src1.
      src2 - Entries of the vector in the matrix-vector multiplication problem.
      shape2 - Shape of the vector src2.
      dest - Array to store the result of the matrix-vector multiplication.
    • dispatch

      public static <T extends Semiring<T>> void dispatch(T[] src1, Shape shape1, T[] src2, Shape shape2, T[] dest)
      Dispatches a matrix multiply problem to the appropriate algorithm based on the size of the matrices.
      Parameters:
      src1 - Entries of the first matrix.
      shape1 - Shape of the first matrix.
      src2 - Entries of the second matrix.
      shape2 - Shape of the second matrix.
      dest - Array to store the result of the matrix multiplication in.
    • dispatchTranspose

      public static <T extends Semiring<T>> void dispatchTranspose(T[] src1, Shape shape1, T[] src2, Shape shape2, T[] dest)
      Dispatches a matrix multiply-transpose problem equivalent to src1.mult(src2.T()) to the appropriate algorithm based on the size of the matrices.
      Parameters:
      src1 - Entries of the first matrix in the multiplication.
      shape1 - Shape of the first matrix.
      src2 - Entries of the second matrix in the multiplication and the matrix to transpose.
      shape2 - Shape of the second matrix.
      dest - Array to store the result of the matrix multiply-transpose in.
    • selectAlgorithmVector

      public static DenseSemiringMatMultDispatcher.AlgorithmNames selectAlgorithmVector(Shape shape)
      Dynamically chooses matrix-vector multiply algorithm based on the shapes of the matrix to multiply.
      Parameters:
      shape - The shape of the matrix.
      Returns:
      The algorithm to use in the matrix multiplication.