[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #36236] Boolean indexing not too prominent in
From: |
Alexander Klein |
Subject: |
[Octave-bug-tracker] [bug #36236] Boolean indexing not too prominent in the docs. |
Date: |
Mon, 04 Jun 2012 06:59:20 +0000 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2 |
Follow-up Comment #3, bug #36236 (project octave):
Hello,
I just found some time to fix the documentation concerning boolean indexing,
and wondered if the following is intended behaviour:
octave:44> a=rand(5)
a =
0.590252 0.785107 0.789109 0.973847 0.037473
0.720128 0.552948 0.529387 0.712228 0.285633
0.097387 0.498243 0.368774 0.341973 0.272160
0.302804 0.645076 0.383922 0.550020 0.883258
0.181661 0.969068 0.376169 0.458497 0.294898
octave:45> b=a(1:3,1:3)>0.5
b =
1 1 1
1 1 1
0 0 0
octave:46> a(b)
ans =
0.59025
0.72013
0.30280
0.18166
0.55295
0.49824
octave:47> a(1:rows(b),1:columns(b))(b)
ans =
0.59025
0.72013
0.78511
0.55295
0.78911
0.52939
octave:48> a(rand(7)>0.5)
error: A(I): index out of bounds; value 48 out of bound 25
octave:48> a(-rand(7)>0.5)
ans = [](0x1)
So, what we get in more than one dimension is
vec(<array>)(find(vec(<boolean>))), which is OK, and seems to be the only way
to go for equally sized arrays and boolean indices, but we get index errors
only for out of bounds true indices, and puzzling results without a warning
when the indexing array is smaller than the indexed array.
Is this really what we want?
Alex
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?36236>
_______________________________________________
Nachricht gesendet von/durch Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Octave-bug-tracker] [bug #36236] Boolean indexing not too prominent in the docs.,
Alexander Klein <=