[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #53242] tests: 'test subspace.m' fails randoml
From: |
Dan Sebald |
Subject: |
[Octave-bug-tracker] [bug #53242] tests: 'test subspace.m' fails randomly |
Date: |
Wed, 28 Feb 2018 13:38:54 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0 |
Follow-up Comment #6, bug #53242 (project octave):
Here's the abstract for that article referenced in the subspace code:
http://epubs.siam.org/doi/pdf/10.1137/S1064827500377332
## reference:
## [1] Andrew V. Knyazev, Merico E. Argentati:
## Principal Angles between Subspaces in an A-Based Scalar Product:
## Algorithms and Perturbation Estimates.
## SIAM Journal on Scientific Computing, Vol. 23 no. 6, pp. 2008-2040
One can see that the main point of the article is the small angle round-off
errors. So the test that was failing simply illustrates that problem with its
use of acos(dot(a,b)/(a1*b1)). Funny. Anyway, we should be using the angle
directly as in the changeset I provided.
As for the issue of different dimensionality A and B, would it be sufficient
to simply extend the vectors by appending zeros? I.e.,
--- a/scripts/linear-algebra/subspace.m
+++ b/scripts/linear-algebra/subspace.m
@@ -38,8 +38,10 @@ function ang = subspace (A, B)
print_usage ();
elseif (ndims (A) != 2 || ndims (B) != 2)
error ("subspace: A and B must be 2-dimensional arrays");
- elseif (rows (A) != rows (B))
- error ("subspace: column dimensions of A and B must match");
+ elseif (rows (A) < rows (B))
+ A = [A; zeros(rows(B)-rows(A), size(A,2))];
+ elseif (rows (A) > rows (B))
+ B = [B; zeros(rows(A)-rows(B), size(B,2))];
endif
A = orth (A);
I'll think that one over.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?53242>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/