Skip to content

Commit f539c17

Browse files
committed
fix: Correct arraycopy source and destination in dropRow method
- Fixed the source and destination parameters in `System.arraycopy` to correctly handle the dropping of a row from the matrix. - The source was incorrectly set to `newEntries[destRow++]`, which is now updated to `entries[i]`, and the destination is updated to `newEntries[destRow++]`.
1 parent c979b89 commit f539c17

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/com/mitsuki/jmatrix/Matrix.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,7 @@ public static Matrix dropRow(Matrix m, int row) {
12791279
double[][] newEntries = new double[rows - 1][cols];
12801280
for (int i = 0, destRow = 0; i < rows; i++) {
12811281
if (i == row) continue; // Skip the desired row index
1282-
System.arraycopy(newEntries[destRow++], 0, entries[i], 0, cols);
1282+
System.arraycopy(entries[i], 0, newEntries[destRow++], 0, cols);
12831283
}
12841284

12851285
return new Matrix(newEntries);

0 commit comments

Comments
 (0)