[Top][All Lists]

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

[Octave-bug-tracker] [bug #41546] warning ("pinv: tol is ignored for dia

From: Ceral Paquet
Subject: [Octave-bug-tracker] [bug #41546] warning ("pinv: tol is ignored for diagonal matrices");
Date: Mon, 17 Feb 2014 10:25:42 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:27.0) Gecko/20100101 Firefox/27.0

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

I just noticed a patch got sent to fix a bug I reported last week.

Awesome - thanks. However there's a small gotcha in the new code:

+ if (std::abs (elem (i, i)) < tol)
+ retval.elem (i, i) = 0.0;
+ else
retval.elem (i, i) = 1.0 / elem (i, i);

When tol==0 and elem(i,i)==0, the code will divide by zero. Changing < to <=
will remedy the problem but makes the behaviour inconsistent with non-diagonal
pinv function.


q=diag([3 2 1]);
pinv([q],2) # uses non-diag code
pinv(q,2) # uses diag code

To copy from the non-diagonal pinv, we could do

868  if (tol <= 0.0)
869  {
873  tol = nc * sigma.elem (0) * std::numeric_limits<double>::epsilon ();
874  }

where sigma.elem (0) in this case is the max abs of the diagonal elements.


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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