Class CooRingHermTranspose
java.lang.Object
org.flag4j.linalg.ops.sparse.coo.ring_ops.CooRingHermTranspose
Utility class for computing the Hermitian transpose of a COO ring matrix or tensor.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Ring<T>>
voidtensorHermTranspose(Shape shape, T[] srcEntries, int[][] srcIndices, int[] axes, T[] destEntries, int[][] destIndices) Computes the Hermitian transpose of a sparse COO tensor.static <T extends Ring<T>>
voidtensorHermTranspose(Shape shape, T[] srcEntries, int[][] srcIndices, int axis1, int axis2, T[] destEntries, int[][] destIndices) Computes the Hermitian transpose of a sparse COO tensor by exchangingaxis1andaxis2.
-
Method Details
-
tensorHermTranspose
public static <T extends Ring<T>> void tensorHermTranspose(Shape shape, T[] srcEntries, int[][] srcIndices, int axis1, int axis2, T[] destEntries, int[][] destIndices) Computes the Hermitian transpose of a sparse COO tensor by exchanging
axis1andaxis2.- Parameters:
shape- Shape of the tensor to transpose.srcEntries- The non-zero data of the tensor to transpose.srcIndices- The non-zero indices of the tensor to transpose. Must have shape[srcEntries.length][shape.getRank()].axis1- First axis to exchange. Must be in the range [0, shape.getRank()).axis2- Second axis to exchange. Must be in the range [0, shape.getRank()).destEntries- Array to store the non-zero data of the transpose. Must have the same length assrcEntries.destIndices- Array to store the non-zero indices of the transpose. Must have shape[srcEntries.length][shape.getRank()]srcIndices-- Throws:
IndexOutOfBoundsException- If eitheraxis1oraxis2are out of bounds for the rank of this tensor.- See Also:
-
tensorHermTranspose
public static <T extends Ring<T>> void tensorHermTranspose(Shape shape, T[] srcEntries, int[][] srcIndices, int[] axes, T[] destEntries, int[][] destIndices) Computes the Hermitian transpose of a sparse COO tensor. That is, permutes the axes of the tensor so that it matches the permutation specified byaxes.- Parameters:
shape- Shape of the tensor to transpose.srcEntries- The non-zero data of the tensor to transpose.srcIndices- The non-zero indices of the tensor to transpose. Must have shape[srcEntries.length][shape.getRank()].axes- Permutation of tensor axis. If the tensor has rankN, then this must be an array of lengthNwhich is a permutation of{0, 1, 2, ..., N-1}.destEntries- Array to store the non-zero data of the transpose. Must have the same length assrcEntries.destIndices- Array to store the non-zero indices of the transpose. Must have shape[srcEntries.length][shape.getRank()]- Throws:
IllegalArgumentException- IfsrcEntries,srcIndices,destEntries, anddestIndicesdo not all have the same length.IndexOutOfBoundsException- If any element ofaxesis out of bounds for the rank of this tensor.IllegalArgumentException- Ifaxesis not a permutation of{1, 2, 3, ... N-1}.
-