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

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

[Octave-bug-tracker] [bug #60786] mpower: negative scalar to power of ma


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #60786] mpower: negative scalar to power of matrix containing non-integers returns nan
Date: Wed, 30 Jun 2021 14:15:04 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0

Follow-up Comment #19, bug #60786 (project octave):

@rik: Yes, definitely a bummer.  I'm tempted to use our own "oct-math.h" and
"oct-complex.h" that would provide all the math functions that we need with
the behavior we want.  Then we would also not allow the standard header files
to be included directly in Octave's source files and we could at least ensure
consistency in Octave functions.  But of course that doesn't "fix" the
behavior of other dependencies that we have.

If we don't override the complex pow function to do what we want we *will*
have to check all places where it is used.  I've been looking at the
element-wise operations in sparse-xpow.cc and it first checks whether
conversion to complex is needed for any of the calculations, and if so just
uses complex pow for all.  But then that can produce these "bad" results:


octave> x = sparse ([-2, 0, -2]);
octave> y = sparse ([-2, 0, 0.25]);
octave> x .^ y
ans =

Compressed Column Sparse (rows = 1, cols = 3, nnz = 3 [100%])

  (1, 1) ->  2.5000e-01 + 6.1232e-17i
  (1, 2) ->  1 + 0i
  (1, 3) ->  0.8409 + 0.8409i



    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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