Class CooConversions
java.lang.Object
org.flag4j.linalg.ops.sparse.coo.CooConversions
Utility class for converting COO tensor to another type of tensor.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> voidtoCsr(Shape shape, T[] entries, int[] rowIndices, int[] colIndices, T[] destEntries, int[] destRowPointers, int[] destColIndices) Converts a COO matrix to an equivalent CSR matrix.static <T> voidConverts a sparse COO tensor to an equivalent dense tensor.
-
Method Details
-
toDense
Converts a sparse COO tensor to an equivalent dense tensor.- Parameters:
shape- Shape of the COO tensor.entries- Non-zero data of the COO tensor.indices- Non-zero indices of the COO tensor.dest- Array to store the dense result in.- Throws:
IllegalArgumentException- Ifdest.length != shape.totalEntriesIntValueExact().
-
toCsr
public static <T> void toCsr(Shape shape, T[] entries, int[] rowIndices, int[] colIndices, T[] destEntries, int[] destRowPointers, int[] destColIndices) Converts a COO matrix to an equivalent CSR matrix.- Parameters:
shape- Shape of the COO matrix.entries- Non-zero data of the COO matrix.rowIndices- Non-zero row indices of the COO matrix.colIndices- Non-zero column indices of the COO matrix.destEntries- Array to store non-zero data of the CSR matrix.destRowPointers- Array to store non-zero row pointers of the CSR matrix.destColIndices- Array to store non-zero column indices of the CSR matrix.
-