Class TransposeDispatcher
java.lang.Object
org.flag4j.linalg.ops.TransposeDispatcher
Provides a dispatch method for dynamically choosing the best matrix transpose algorithm.
-
Method Summary
Modifier and TypeMethodDescriptionstatic double[]
Dispatches a matrix transpose problem to the appropriate algorithm based on its shape and size.static Object[]
Dispatches a matrix transpose problem to the appropriate algorithm based on its shape and size.static Matrix
Dispatches a matrix transpose problem to the appropriate algorithm based on its shape and size.static <T extends Ring<T>>
voiddispatchHermitian
(T[] src, Shape shape, T[] dest) Dispatches a matrix Hermitian transpose (i.e. conjugate 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 Object[]
dispatchTensor
(Object[] src, Shape shape, int[] axes, Object[] dest) Dispatches a tensor transpose problem to the appropriate algorithm based on its shape and size.static <V extends Semiring<V>>
AbstractDenseSemiringTensor<?, V> dispatchTensor
(AbstractDenseSemiringTensor<?, V> src, int[] axes) Dispatches a tensor transpose problem to the appropriate algorithm based on its shape and size.static <T> T[]
dispatchTensor
(T[] src, Shape srcShape, int axis1, int axis2, T[] dest) Dispatches a tensor transpose problem to the appropriate algorithm based on its shape and size.static <T extends AbstractDoubleTensor<T>>
TdispatchTensor
(T src, int axis1, int axis2) Dispatches a tensor transpose problem to the appropriate algorithm based on its shape and size.static <V extends Ring<V>>
voiddispatchTensorHermitian
(Shape shape, V[] src, int[] axes, V[] dest) Dispatches a tensor Hermitian transpose problem to the appropriate algorithm based on its shape and size.static <V extends Ring<V>>
voiddispatchTensorHermitian
(Shape shape, V[] src, int axis1, int axis2, V[] dest) Dispatches a tensor Hermitian transpose problem to the appropriate algorithm based on its shape and size.
-
Method Details
-
dispatch
-
dispatch
Dispatches a matrix transpose problem to the appropriate algorithm based on its shape and size.- Parameters:
src
- Matrix to transpose.- Returns:
- The transpose of the source matrix.
-
dispatch
Dispatches a matrix transpose problem to the appropriate algorithm based on its shape and size.- Parameters:
src
- Matrix to transpose.shape
- Shape of the matrix to transpose.dest
- Array to store the transpose result in. May benull
. If notnull
, must be at least as large assrc
.- Returns:
- If
dest != null
a reference to thedest
array will be returned. Otherwise, ifdest == null
then a new array will be created and returned.
-
dispatchHermitian
Dispatches a matrix Hermitian transpose (i.e. conjugate transpose) problem to the appropriate algorithm based on its shape and size.- Parameters:
src
- Entries of the matrix to transpose and conjugate.shape
- Shape of the matrix to transpose and conjugate.dest
- Array to store the Hermitian transpose result in. May benull
. If notnull
, must be at least as large assrc
.
-
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
- 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
Dispatches a tensor transpose problem to the appropriate algorithm based on its shape and size.- Parameters:
src
- Entries of the tensor to transpose.srcShape
- Shape of the tensor to transpose.axis1
- First axis in tensor transpose.axis2
- Second axis in tensor transpose.dest
- Array to store the transpose result in. May benull
. Must at least as large assrc
.- Returns:
- If
dest != null
a reference to thedest
tensor. Otherwise, ifdest == null
a new array will be constructed and returned. - Throws:
IndexOutOfBoundsException
- Ifdest.length < src.length
.
-
dispatchTensor
public static <V extends Semiring<V>> AbstractDenseSemiringTensor<?,V> dispatchTensor(AbstractDenseSemiringTensor<?, V> src, int[] axes) Dispatches a tensor transpose problem to the appropriate algorithm based on its shape and size.- Parameters:
src
- Entries of 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
Dispatches a tensor transpose problem to the appropriate algorithm based on its shape and size.- Parameters:
src
- Entries of tensor to transpose.shape
- Shape fo the tensor to transpose.axes
- Permutation of axes in the tensor transpose.dest
- Array to store the transpose result in. May benull
. Ifdest != null
, both of the following must be satisfied:dest.length >= src.length
dest != src
- Returns:
- The result of the tensor transpose.
- Throws:
ArrayIndexOutOfBoundsException
- If either axis is not within thesrc
tensor or ifdest.length < src.length
.IllegalArgumentException
- Ifsrc == dest
.
-
dispatchTensorHermitian
public static <V extends Ring<V>> void dispatchTensorHermitian(Shape shape, V[] src, int axis1, int axis2, V[] dest) Dispatches a tensor Hermitian transpose problem to the appropriate algorithm based on its shape and size.- Parameters:
shape
- Shape of the tensor to transpose.src
- Entries of the tensor to transpose.axis1
- First axis in tensor transpose.axis2
- Second axis in tensor transpose.dest
- Array to store the transpose result in.
-
dispatchTensorHermitian
public static <V extends Ring<V>> void dispatchTensorHermitian(Shape shape, V[] src, int[] axes, V[] dest) Dispatches a tensor Hermitian transpose problem to the appropriate algorithm based on its shape and size.- Parameters:
src
- Entries of tensor to transpose.axes
- Permutation of axes in the tensor transpose.dest
- Array to store the result of the tensor transpose in.Shape
- shape of the tensor to transpose.- Throws:
ArrayIndexOutOfBoundsException
- If either axis is not within thesrc
tensor.
-