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

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

[Octave-bug-tracker] [bug #61689] inv of scalar emits a singular matrix


From: A.R. Burgers
Subject: [Octave-bug-tracker] [bug #61689] inv of scalar emits a singular matrix warning
Date: Sat, 18 Dec 2021 02:56:58 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.57

Follow-up Comment #1, bug #61689 (project octave):

same result for:


octave:1> inv(diag(2))
warning: matrix singular to machine precision
ans = 0.5000


Consistent with that comments in the source code indicate scalars are treated
as diagonal matrices in this context.

The problem I think is in this bit in liboctave/array/dMatrix.cc around line
644 where the rcon argument is not adjusted


  if (typ == MatrixType::Diagonal)  // a scalar is also classified as
Diagonal.
    ret = 1 / (*this);


rcon is left at the 0 initial value set in libinterp/corefcn/inv.cc around
line 81. m.inverse is called at line 170 in inv.cc

Then later in inv.cc rcond_plus_one_eq_one will be true, and the warning will
be triggered.


rcond_plus_one_eq_one = xrcond + 1.0 == 1.0;



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?61689>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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