Mercurial > hg > octave-lyh
diff src/DLD-FUNCTIONS/pinv.cc @ 14179:a7a020cd6106 stable
Relax tolerance for pinv tests so that it fails less than 1% of the time.
pinv.cc (pinv): Relax tolerance for pinv tests so that it fails less than 1% of
the time.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Mon, 09 Jan 2012 11:46:52 -0800 |
parents | 72c96de7a403 |
children |
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/pinv.cc +++ b/src/DLD-FUNCTIONS/pinv.cc @@ -174,18 +174,19 @@ %!shared a, b, tol, hitol, d, u, x, y %! a = reshape (rand*[1:16], 4, 4); ## Rank 2 matrix %! b = pinv (a); -%! tol = 1e-14; -%! hitol = 15*sqrt(eps); +%! tol = 4e-14; +%! hitol = 40*sqrt (eps); %! d = diag ([rand, rand, hitol, hitol]); %! u = rand (4); ## Could be singular by freak accident %! x = inv (u)*d*u; -%! y = pinv (x, sqrt(eps)); -%!assert(a*b*a, a, tol); -%!assert(b*a*b, b, tol); -%!assert((b*a)', b*a, tol); -%!assert((a*b)', a*b, tol); -%!assert(x*y*x, x, -hitol); -%!assert(y*x*y, y, -hitol); -%!assert((x*y)', x*y, hitol); -%!assert((y*x)', y*x, hitol); +%! y = pinv (x, sqrt (eps)); +%! +%!assert (a*b*a, a, tol) +%!assert (b*a*b, b, tol) +%!assert ((b*a)', b*a, tol) +%!assert ((a*b)', a*b, tol) +%!assert (x*y*x, x, -hitol) +%!assert (y*x*y, y, -hitol) +%!assert ((x*y)', x*y, hitol) +%!assert ((y*x)', y*x, hitol) */