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

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

[Octave-bug-tracker] [bug #52285] inv(0) gives 0 (instead of inf)


From: Rik
Subject: [Octave-bug-tracker] [bug #52285] inv(0) gives 0 (instead of inf)
Date: Wed, 1 Nov 2017 19:01:08 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

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

I stepped through the code in dMatrix.cc and in fact the MatrixType is set to
Diagonal for the case of a scalar.  It looks like the general question is why
there isn't an early decision to take care of diagonal matrices which would be
very easy


  if (typ == MatrixType::Diagonal)
    ret = 1 / (*this);  
  else if (...)


Find attached a quick test (inv.diff).  It seems to pass "make check" with no
problems.  To be complete there should also be some BIST tests for the correct
behavior of scalars of all types (double, single, double complex, single
complex) with respect to the various operations '1 / x', 'inv (x)', x^-1,
'pinv (x)'. 


(file #42320)
    _______________________________________________________

Additional Item Attachment:

File name: inv.diff                       Size:4 KB


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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