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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #31773] numerical instability in the pinv (Moo


From: Gunnar Farnebäck
Subject: [Octave-bug-tracker] [bug #31773] numerical instability in the pinv (Moore-Penrose inverse) function
Date: Thu, 16 Dec 2010 21:30:55 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101209 Iceweasel/3.5.16 (like Firefox/3.5.16)

Follow-up Comment #4, bug #31773 (project octave):

Your computation involves the pseudo-inverse of a nearly singular
matrix and that's about as numerically sensitive as it gets. In
fact, if your sigma values are off in the fourteenth decimal or
so, that's sufficient to get completely different results,
whether you believe it or not. The problem is that the pinv
function has to decide which singular values are zero and which
are not. The default numerical tolerance is quite small and since
the non-zero singular values are inverted, any value which should
mathematically be zero but numerically falls just outside the
tolerance will introduce huge deviations. For a simple example,
compare the results of

octave:2> pinv(diag([1 1e-15]))
ans =

   1.0000e+00   0.0000e+00
   0.0000e+00   1.0000e+15

octave:3> pinv(diag([1 1e-16]))
ans =

   1   0
   0   0

If you want your code to be more numerically robust I propose
that you make use of the second argument to pinv and set it to
1e-10 or so. E.g.

octave:4> pinv(diag([1 1e-15]), 1e-10)
ans =

   1   0
   0   0

Incidentally, with the data you provided I see the same behavior in
Matlab as in Octave.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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