octave-bug-tracker
[Top][All Lists]

## [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 02:47:27 -0500 (EST) User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

```Follow-up Comment #3, bug #53242 (project octave):

Give the following changeset test a try.

As I see it, it doesn't make sense to compute theta in two different ways--one
in the routine subspace() and one in the test script.  In the following hunk
of code from subspace.m:

if (scos^2 > 1/2)
if (columns (A) >= columns (B))
c = B - A*c;
else
c = A - B*c';
endif
ssin = max (svd (c));
ang = asin (min (ssin, 1));
else
ang = acos (scos);
endif

It's basically computing exactly the same thing as the test script when scos^2
<= 1/2, i.e., ang = acos (scos).  One must assume the other case is to account
for numerical issues with acos(), which of course the test script isn't doing.
So that right there is the flaw.  We could change the test script, but then
it is as though we are replicating the function itself, which I don't see the
point of.

A much more useful test seems to be starting with the angle known, then we are
ostensibly testing the accuracy of the subspace() function, not two functions.
So, I used a rotation matrix (its angle theta is what's of interest) to
generate a vector from the first random vector with some additional random
scaling of the amplitude.  The angle goes around the unit circle so it is more
than just the first quadrant that the vectors live in.  I also added some
secondary jitter to be sure to test those often numerically problematic cases
of near-0, near-pi, etc.

(file #43414)
_______________________________________________________

File name: octave-subspace_angle_test_bug_53242-djs2018feb28.patch Size:1 KB

_______________________________________________________

<http://savannah.gnu.org/bugs/?53242>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/

```