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: Rik
Subject: [Octave-bug-tracker] [bug #46103] inversion of a singular diagonal matrix A produces inv(A)==A
Date: Fri, 02 Oct 2015 21:56:50 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0

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

@Mike: Could you try the sparse example under Matlab?


x = sparse (diag ([1 0]))
y = inv (x)


Under Octave it simply refuses to calculate an answer


octave:6> x = sparse (diag ([1 0]))
x =

Compressed Column Sparse (rows = 2, cols = 2, nnz = 1 [25%])

  (1, 1) ->  1

octave:7> y = inv (x)
error: inv: division by zero


This could be another option to use for singular diag matrices.  It would
certainly be easier to implement.  The C++ inverse function defined in
dDiagMatrix.cc returns a DiagMatrix, not an octave_value.  Thus we can't
easily mutate the return value from the special DiagMatrix class to the
ordinary Matrix class.  I suppose one could do so at a higher level in inv.cc
by checking for any element equal to 0.  That's pretty easy check on a
diagonal matrix.



    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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