#74 closed defect (fixed)
psMatrix testing
| Reported by: | Paul Price | Owned by: | |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | types | Version: | unspecified |
| Severity: | normal | Keywords: | |
| Cc: |
Description
(a) Transpose fails for non-square matrices (deliberately), but the transpose of
a non-square matrix is well defined.
(b) Test C in tst_psMatrix03 generates:
Error: Resulting image is not PS_DIMEN_VECTOR
But this is in the validation, so the test passes (though it is a "positive"
test).... is it an error or not?
Change History (10)
comment:1 by , 22 years ago
| Owner: | changed from to |
|---|
comment:2 by , 22 years ago
| Owner: | changed from to |
|---|
comment:3 by , 22 years ago
| Owner: | changed from to |
|---|
comment:4 by , 22 years ago
| Status: | new → assigned |
|---|
comment:5 by , 22 years ago
Algorithm is:
/* For the upper diagonal only */
for (i = 0; i < Ni; i++) {
for (j = i + 1; j < Nj; j++) {
/* Swap the ij and ji entries */
temp = matrixData[i][j];
matrixData[i][j] = matrixData[j][i];
matrixData[j][i] = temp;
}
}
comment:6 by , 22 years ago
Not sure if this will work with non-square matrices, which was item (a) above.
comment:7 by , 22 years ago
Of course, you're right.
How about expanding the matrix to square before transferring the entries, and
then collapsing to the correct dimensions afterward? An alternative would be to
allocate a new matrix, copy into there, free the old matrix, and return the new,
but I think that might be dangerous.
comment:9 by , 21 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |

I corrected (b) below. It was a minor error in the test.
I have not corrected (a) below, because GSL will not transpose a non-square
matrix. I will create an algorithm from scratch to do the same when time is
available. Please leave this open until completed.