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

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

[Octave-bug-tracker] [bug #63080] Allow matrix power for sparse empty ma


From: Arun Giridhar
Subject: [Octave-bug-tracker] [bug #63080] Allow matrix power for sparse empty matrices
Date: Tue, 20 Sep 2022 09:03:11 -0400 (EDT)

Follow-up Comment #3, bug #63080 (project octave):

@Rik: Good points, both. I've made the changes you described with others and
pushed it here: https://hg.savannah.gnu.org/hgweb/octave/rev/a1318deb4584

In the course of testing, I found an additional inconsistency between full and
sparse, when the input matrix is all-zeros. For the full case, it returns an
all-Inf matrix with a warning, but for the sparse case it gives an error.


>> A = zeros (2, 2); A ^ -1
warning: inverse: matrix singular to machine precision, rcond = 0
ans =

   Inf   Inf
   Inf   Inf

>> A = sparse (zeros (2, 2)); A ^ -1
error: inverse of the null matrix not defined


I've added a FIXME and marked that inconsistency as a known bug in the BISTs.

This is also the same inconsistency with calling inv() directly:

>> A = zeros (2, 2); inv (A)
warning: matrix singular to machine precision
ans =

   Inf   Inf
   Inf   Inf

>> A = sparse (zeros (2, 2)); inv (A)
error: inverse of the null matrix not defined


We could in principle detect an all-zeros matrix with a negative power and
return an all-Inf matrix instead of taking the inverse, but the better fix for
that inconsistency should probably be in the matrix inverse function, not in
the matrix power function. What do you think?


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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