[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #46892] subsref for OO @class failed to be cal
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #46892] subsref for OO @class failed to be called within method function. |
Date: |
Wed, 13 Jan 2016 23:55:37 +0000 |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0 |
URL:
<http://savannah.gnu.org/bugs/?46892>
Summary: subsref for OO @class failed to be called within
method function.
Project: GNU Octave
Submitted by: rik5
Submitted on: Wed 13 Jan 2016 03:55:36 PM PST
Category: Interpreter
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: Any
_______________________________________________________
Details:
The failing code is taken from examples/code/@polynomial/plot.m.
The code is
function h = plot (p, varargin)
n = 128;
rmax = max (abs (roots (p.poly)));
x = [0 : (n - 1)] / (n - 1) * 2.2 * rmax - 1.1 * rmax;
if (nargout > 0)
h = plot (x, p(x), varargin{:});
else
plot (x, p(x), varargin{:});
endif
endfunction
The code makes use of overloading for the subsref function so that p(x)
calculates the value of the polynomial at the points x. Unfortunately, the
overloaded subsref is not called and it is treated as normal indexing which
then fails because some of the x values are not integers.
cd examples/code
../../run-octave -f --no-gui
p = polynomial ([1 0 1])
p = 1 + X ^ 2
plot (p)
error: p(-1.1): subscripts must be either integers 1 to (2^31)-1 or logicals
error: called from
plot at line 10 column 5
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?46892>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #46892] subsref for OO @class failed to be called within method function.,
Rik <=