# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1315084263 18000 # Node ID 9512d7272d5bbbc54eed24e0895c278876ccf798 # Parent 1dfd4c1d62a3fd53a2cdbc4719fcaff81f2fcc93 codesprint: Fix tolerance for pinv test diff --git a/src/DLD-FUNCTIONS/pinv.cc b/src/DLD-FUNCTIONS/pinv.cc --- a/src/DLD-FUNCTIONS/pinv.cc +++ b/src/DLD-FUNCTIONS/pinv.cc @@ -171,21 +171,21 @@ } /* -%!shared a, b, hitol, d, u, x, y, tolmult +%!shared a, b, tol, hitol, d, u, x, y %! a = reshape (rand*[1:16], 4, 4); ## Rank 2 matrix %! b = pinv (a); -%! hitol = sqrt(eps); +%! tol = 1e-14; +%! hitol = 15*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)); -%! tolmult = 15; -%!assert(a*b*a, a, tolmult*eps); -%!assert(b*a*b, b, tolmult*eps); -%!assert((b*a)', b*a, tolmult*eps); -%!assert((a*b)', a*b, tolmult*eps); -%!assert(x*y*x, x, tolmult*hitol); -%!assert(y*x*y, y, tolmult*hitol); -%!assert((x*y)', x*y, tolmult*hitol); -%!assert((y*x)', y*x, tolmult*hitol); +%!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); */