[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #62405] Out of Bound(OOB) on subsindex()
From: |
Glite |
Subject: |
[Octave-bug-tracker] [bug #62405] Out of Bound(OOB) on subsindex() |
Date: |
Tue, 3 May 2022 04:19:36 -0400 (EDT) |
URL:
<https://savannah.gnu.org/bugs/?62405>
Summary: Out of Bound(OOB) on subsindex()
Project: GNU Octave
Submitted by: linuxbckp
Submitted on: Tue 03 May 2022 08:19:34 AM UTC
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Unexpected Error or Warning
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Release: 7.1.0
Discussion Lock: Any
Operating System: GNU/Linux
_______________________________________________________
Details:
An object with overloaded subsindex() should get part of its field. Now Octave
can only get the whole field.
Here is my code:
Class InputContainer with overloaded subsindex():
#!/usr/bin/octave
# @InputContainer/InputContainer.m
function ret = InputContainer(mat)
ret = class(struct("mat", mat), "InputContainer");
fprintf('InputContainer class initialized.\n')
endfunction
#!/usr/bin/octave
# @InputContainer/subsindex.m
function ret = subsindex(this)
ret = double(this.mat) - 1;
endfunction
Tnen I init InputContainer with [1 2 3 4].
The input range is [1 2 3 4]:
code line 1
>> input_container = InputContainer([1 2 3 4]);
InputContainer class initialized.
When I define a range that can contain input range, subindexing works fine:
>> b = 1:10;
>> b(input_container)
ans =
1 2 3 4
>> b = 1:4;
>> b(input_container)
ans =
1 2 3 4
But, when I define a range that can not contain input range, subindexing
throws error:
>> b = 1:2;
>> b(input_container)
error: b(4): out of bound 2 (dimensions are 1x2)
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?62405>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #62405] Out of Bound(OOB) on subsindex(),
Glite <=
- [Octave-bug-tracker] [bug #62405] Out of Bound(OOB) on subsindex(), Markus Mützel, 2022/05/03
- [Octave-bug-tracker] [bug #62405] Out of Bound(OOB) on subsindex(), Glite, 2022/05/03
- [Octave-bug-tracker] [bug #62405] Out of Bound(OOB) on subsindex(), Markus Mützel, 2022/05/03
- [Octave-bug-tracker] [bug #62405] Out of Bound(OOB) on subsindex(), Glite, 2022/05/03
- [Octave-bug-tracker] [bug #62405] Out of Bound(OOB) on subsindex(), Glite, 2022/05/03
- [Octave-bug-tracker] [bug #62405] Out of Bound(OOB) on subsindex(), Markus Mützel, 2022/05/03
- [Octave-bug-tracker] [bug #62405] Out of Bound(OOB) on subsindex(), Glite, 2022/05/03
- [Octave-bug-tracker] [bug #62405] Out of Bound(OOB) on subsindex(), Markus Mützel, 2022/05/04