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

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

[Octave-bug-tracker] [bug #46103] inversion of a singular diagonal matri


From: jan
Subject: [Octave-bug-tracker] [bug #46103] inversion of a singular diagonal matrix A produces inv(A)==A
Date: Fri, 02 Oct 2015 20:59:00 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0

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

Indeed, there is already difference in the behaviour of the inverse operation
for the sparse and respectively the full matrix classes. The sparse matrix
only gives an error and no result as shown below.   

One aspect of using the elementwise inversion (with 1/0=inf) is that it
preserves the sparsity structure and does not produce memory blow up. If one
wants to follow the approach similar to the full matrix case, perhaps a
diagonal matrix with the entire column inf's is a better choice: 

inv(diag([1,0])) -> diag([1,inf])



octave:158> inv(sparse([1,0;0,0]))
error: inv: division by zero

octave:159> inv(diag([1,0]))
warning: inverse: matrix singular to machine precision, rcond = 1
ans =

Diagonal Matrix

   1   0
   0   0

octave:160> inv(full(diag([1,0])))
warning: inverse: matrix singular to machine precision, rcond = 0
ans =

   Inf   Inf
   Inf   Inf



    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Meddelandet skickades via/av Savannah
  http://savannah.gnu.org/




reply via email to

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