diff --git a/src/main/java/org/flag4j/operations/sparse/coo/real_complex/RealComplexCooTensorOperations.java b/src/main/java/org/flag4j/operations/sparse/coo/real_complex/RealComplexCooTensorOperations.java index b02c28b54..88912037a 100644 --- a/src/main/java/org/flag4j/operations/sparse/coo/real_complex/RealComplexCooTensorOperations.java +++ b/src/main/java/org/flag4j/operations/sparse/coo/real_complex/RealComplexCooTensorOperations.java @@ -261,76 +261,4 @@ public static CooCTensor elemMult(CooTensor src1, CooCTensor src2) { // Truncate arrays if necessary. return new CooCTensor(src1.shape, Arrays.copyOf(productEntries, count), Arrays.copyOf(productIndices, count)); } - - - /** - *
Computes the element-wise division between two sparse COO tensors.
- * - *Assumes indices of both tensors are sorted lexicographically.
- * - * @param src1 First tensor in the element-wise division. - * @param src2 Second tensor in the element-wise division. - * @return The element-wise quotient of {@code src1} and {@code src2}. - */ - public static CooCTensor elemdiv(CooCTensor src1, CooTensor src2) { - ParameterChecks.assertEqualShape(src1.shape, src2.shape); - - CNumber[] productEntries = new CNumber[Math.min(src1.nnz, src2.nnz)]; - int[][] productIndices = new int[Math.min(src1.nnz, src2.nnz)][src1.indices[0].length]; - int count = 0; - - int src2Idx = 0; - for(int i = 0; i < src1.nnz && src2Idx < src2.nnz; i++) { - int cmp = -1; - - while(src2Idx < src2.nnz && (cmp = Arrays.compare(src2.indices[src2Idx], src1.indices[i])) < 0) { - src2Idx++; - } - - if(src2Idx < src2.nnz && cmp == 0) { - productEntries[count] = src1.entries[i].div(src2.entries[src2Idx]); - productIndices[count] = src1.indices[i]; - count++; - } - } - - // Truncate arrays if necessary. - return new CooCTensor(src1.shape, Arrays.copyOf(productEntries, count), Arrays.copyOf(productIndices, count)); - } - - - /** - *Computes the element-wise division between two sparse COO tensors.
- * - *Assumes indices of both tensors are sorted lexicographically.
- * - * @param src1 First tensor in the element-wise division. - * @param src2 Second tensor in the element-wise division. - * @return The element-wise quotient of {@code src1} and {@code src2}. - */ - public static CooCTensor elemdiv(CooTensor src1, CooCTensor src2) { - ParameterChecks.assertEqualShape(src1.shape, src2.shape); - - CNumber[] productEntries = new CNumber[Math.min(src1.nnz, src2.nnz)]; - int[][] productIndices = new int[Math.min(src1.nnz, src2.nnz)][src1.indices[0].length]; - int count = 0; - - int src2Idx = 0; - for(int i = 0; i < src1.nnz && src2Idx < src2.nnz; i++) { - int cmp = -1; - - while(src2Idx < src2.nnz && (cmp = Arrays.compare(src2.indices[src2Idx], src1.indices[i])) < 0) { - src2Idx++; - } - - if(src2Idx < src2.nnz && cmp == 0) { - productEntries[count] = new CNumber(src1.entries[i]).div(src2.entries[src2Idx]); - productIndices[count] = src1.indices[i]; - count++; - } - } - - // Truncate arrays if necessary. - return new CooCTensor(src1.shape, Arrays.copyOf(productEntries, count), Arrays.copyOf(productIndices, count)); - } }