Skip to content

Commit 6a4cbc1

Browse files
committed
Resolve #523 9 Correct "copy" constructor from a Matrix. We can just clone the realmatrix.
1 parent b5e9bd5 commit 6a4cbc1

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

legacy/src/main/java/org/openscience/cdk/math/IMatrix.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,8 @@ public IMatrix(int rows, int columns) {
6161
public IMatrix(Matrix m) {
6262
rows = m.rows;
6363
columns = m.columns;
64-
int i, j;
65-
for (i = 0; i < rows; i++)
66-
for (j = 0; j < columns; j++) {
67-
realmatrix[i][j] = m.matrix[i][j];
68-
imagmatrix[i][j] = 0d;
69-
}
64+
realmatrix = m.matrix.clone();
65+
imagmatrix = new double[rows][columns];
7066
}
7167

7268
/**

0 commit comments

Comments
 (0)