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

[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: Thu, 1 Mar 2018 14:58:39 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

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

I could rewrite the test, but with the discussion with M.L. I think we are
moving away from testing so many angles and instead boil it down to maybe a
half-dozen to ten tests that exercise all the important aspects of a subspace
comparison.  The randomness and so many tests in my original test script
really don't add much because they are limited to 2D vector space, mostly have
big angles, etc.  I just wanted to make sure all sectors of the space were
tested.

Something like this


theta = pi/200;
Ry = [cos(theta) 0 sin(theta);0 1 0;-sin(theta) 0 cos(theta)];
assert(subspace(Ry*[1 0 0]',[1 1 0;1 -1 0]'), theta, eps);


is a small angle test that accomplishes the task.  Picking random vectors most
times isn't small angle so doesn't test the core of the subspace algorithm.

We could make the hyperplane randomly oriented and then chose the line to be a
small angle from that hyperplane, but I'm not sure that adds anything.  Maybe
it would affect the orth() routine that is used by subspace(), but that's what
"test orth" is for.

The one thing that intrigues me is why we are finding that the 


assert(subspace([1 0 1]',[1 1 0;1 -1 0]'),pi/4,3*eps)


requires an increased tolerance of 3 times eps.  That's still not bad, but the
funny thing is I implement the [1 0 1] as a rotation:


octave:2> theta = -pi/4;
octave:3> Ry = [cos(theta) 0 sin(theta);0 1 0;-sin(theta) 0 cos(theta)];
octave:4> Ry * [sqrt(2) 0 0]' - [1 0 1]'
ans =

   2.2204e-16
   0.0000e+00
   0.0000e+00

octave:5> assert(subspace(Ry*[sqrt(2) 0 0]',[1 1 0;1 -1 0]'),pi/4,eps)


and that little inaccuracy seems to compensate so the test passes using a
tolerance of eps.  Just luck I guess.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]