Package org.flag4j.operations
Class TransposeDispatcher
java.lang.Object
org.flag4j.operations.TransposeDispatcher
Provides a dispatch method for dynamically choosing the best matrix transpose algorithm.
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static enum
Simple enum class containing available algorithms for computing a matrix transpose. -
Field Summary
Modifier and TypeFieldDescriptionprivate static final int
Threshold for using complex blocked algorithm.private static final int
Threshold for number of elements in matrix to use concurrent implementation.private static final int
Threshold for using blocked hermitian algorithmprivate static final int
Threshold for using standard transpose implementation. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate static TransposeDispatcher.Algorithm
chooseAlgorithm
(Shape shape) Chooses the appropriate matrix transpose algorithm based on the shape of a matrix.private static TransposeDispatcher.Algorithm
chooseAlgorithmComplex
(Shape shape) Chooses the appropriate matrix transpose algorithm based on the shape of a matrix.private static TransposeDispatcher.Algorithm
chooseAlgorithmHermitian
(Shape shape) Chooses the appropriate matrix hermitian transpose algorithm based on the shape of a matrix.private static TransposeDispatcher.Algorithm
chooseAlgorithmTensor
(int numEntries) Chooses the appropriate algorithm for computing a tensor transpose.private static TransposeDispatcher.Algorithm
chooseAlgorithmTensor
(int length1, int length2) Chooses the appropriate algorithm for computing a tensor transpose.static CMatrix
Dispatches a matrix transpose problem to the appropriate algorithm based in its shape and size.static Matrix
Dispatches a matrix transpose problem to the appropriate algorithm based on its shape and size.static CMatrix
dispatchHermitian
(CMatrix src) Dispatches a matrix hermitian transpose problem to the appropriate algorithm based on its shape and size.static double[]
dispatchTensor
(double[] src, Shape shape, int[] axes) Dispatches a tensor transpose problem to the appropriate algorithm based on its shape and size.static CTensor
dispatchTensor
(CTensor src, int axis1, int axis2) Dispatches a tensor transpose problem to the appropriate algorithm based on its shape and size.static Tensor
dispatchTensor
(Tensor src, int axis1, int axis2) Dispatches a tensor transpose problem to the appropriate algorithm based on its shape and size.
-
Field Details
-
COMPLEX_BLOCKED_THRESHOLD
private static final int COMPLEX_BLOCKED_THRESHOLDThreshold for using complex blocked algorithm.- See Also:
-
HERMATION_BLOCKED_THRESHOLD
private static final int HERMATION_BLOCKED_THRESHOLDThreshold for using blocked hermitian algorithm- See Also:
-
STANDARD_THRESHOLD
private static final int STANDARD_THRESHOLDThreshold for using standard transpose implementation.- See Also:
-
CONCURRENT_THRESHOLD
private static final int CONCURRENT_THRESHOLDThreshold for number of elements in matrix to use concurrent implementation.- See Also:
-
-
Constructor Details
-
TransposeDispatcher
private TransposeDispatcher()
-
-
Method Details
-
dispatch
-
dispatch
-
dispatchHermitian
-
dispatchTensor
Dispatches a tensor transpose problem to the appropriate algorithm based on its shape and size.- Parameters:
src
- Tensor to transpose.axis1
- First axis in tensor transpose.axis2
- Second axis in tensor transpose.- Returns:
- The result of the tensor transpose.
- Throws:
ArrayIndexOutOfBoundsException
- If either axis is not within thesrc
tensor.
-
dispatchTensor
Dispatches a tensor transpose problem to the appropriate algorithm based on its shape and size.- Parameters:
src
- Entries of tensor to transpose.shape
- Shape of the tensor to transpose.axes
- Permutation of axes in the tensor transpose.- Returns:
- The result of the tensor transpose.
- Throws:
ArrayIndexOutOfBoundsException
- If either axis is not within thesrc
tensor.
-
dispatchTensor
-
chooseAlgorithmTensor
Chooses the appropriate algorithm for computing a tensor transpose.- Parameters:
length1
- Length of first axis in tensor transpose.length2
- Length of second axis in tensor transpose.- Returns:
-
chooseAlgorithmTensor
Chooses the appropriate algorithm for computing a tensor transpose.- Parameters:
numEntries
- Total number of entries in tensor to transpose.- Returns:
- The algorithm to use for the tensor transpose.
-
chooseAlgorithm
Chooses the appropriate matrix transpose algorithm based on the shape of a matrix.- Parameters:
shape
- Shape of matrix to transpose.- Returns:
- The appropriate matrix transpose algorithm.
-
chooseAlgorithmHermitian
Chooses the appropriate matrix hermitian transpose algorithm based on the shape of a matrix.- Parameters:
shape
- Shape of matrix to transpose.- Returns:
- The appropriate matrix transpose algorithm.
-
chooseAlgorithmComplex
Chooses the appropriate matrix transpose algorithm based on the shape of a matrix.- Parameters:
shape
- Shape of matrix to transpose.- Returns:
- The appropriate matrix transpose algorithm.
-