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

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

[Octave-bug-tracker] [bug #57476] Numerical inaccuracy in range object w


From: Rik
Subject: [Octave-bug-tracker] [bug #57476] Numerical inaccuracy in range object with complex power operation
Date: Thu, 26 Dec 2019 13:38:24 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

Update of bug #57476 (project octave):

                  Status:                    None => Confirmed              
                 Release:                   5.1.0 => dev                    
                 Summary: Numerical inaccuracy in range object => Numerical
inaccuracy in range object with complex power operation

    _______________________________________________________

Follow-up Comment #1:

Confirmed.  I checked with the current development version of Octave and the
behavior is still present.

On one hand, Octave is for numerical computation, not pure math.  The best one
can expect is to be within an eps or two of the true result which the range
operator does satisfy.

But, given that this is a simple operation and is computed correctly in one
instance this leads one to believe it can be calculated exactly.

For reference, Octave has a "range" object which efficiently represents ranges
(START:INCREMENT:END).  To convert from the efficient space-saving
representation to a full matrix representation you can use brackets or the
full() function.


x = 1:100;
whos x
Variables visible from the current scope:

variables in scope: top scope

   Attr Name        Size                     Bytes  Class
   ==== ====        ====                     =====  ===== 
        x           1x100                       24  double

Total is 100 elements using 24 bytes

y = [x];
whos y
Variables visible from the current scope:

variables in scope: top scope

   Attr Name        Size                     Bytes  Class
   ==== ====        ====                     =====  ===== 
        y           1x100                      800  double

Total is 100 elements using 800 bytes

z = full (x);
whos z
Variables visible from the current scope:

variables in scope: top scope

   Attr Name        Size                     Bytes  Class
   ==== ====        ====                     =====  ===== 
        z           1x100                      800  double

Total is 100 elements using 800 bytes



As you noted, typeinfo() will tell you what representation Octave is using
internally.

I think the best place to start debugging this is to look at the power
operator implementation between Complex values and ranges.

In particular, the implementation between a Complex scalar and a range.  I did
a quick check and a Complex matrix raised to a range works.


base = [i, i, i, i];
rng = 1:4;
base .^ rng
ans =

   0 + 1i  -1 + 0i   0 - 1i   1 + 0i





    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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