Class DenseSemiringMatMultDispatcher
java.lang.Object
org.flag4j.linalg.ops.dense.semiring_ops.DenseSemiringMatMultDispatcher
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enumSimple enum class containing all possible choices of real dense matrix multiply algorithms. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Semiring<T>>
voidDispatches a matrix multiply problem to the appropriate algorithm based on the size of the matrices.static <T extends Semiring<T>>
voiddispatchTranspose(T[] src1, Shape shape1, T[] src2, Shape shape2, T[] dest) Dispatches a matrix multiply-transpose problem equivalent tosrc1.mult(src2.T())to the appropriate algorithm based on the size of the matrices.static <T extends Semiring<T>>
voiddispatchVector(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.Gets the singleton instance of this class.selectAlgorithmVector(Shape shape) Dynamically chooses matrix-vector multiply algorithm based on the shapes of the matrix to multiply.
-
Method Details
-
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 matrixsrc1.src2- Entries of the vector in the matrix-vector multiplication problem.shape2- Shape of the vectorsrc2.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 tosrc1.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
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.
-