[PYTHON MATRIX-SIG] A problem with slicing
Chris Chase S1A
Fri, 15 Sep 1995 13:26:17 -0400
Hinsen> a = [[1,2,3], [4,5,6]]
--> a.gt(2) == [[0,0,1], [1,1,1]]
Hinsen> a[a.gt(2)] = 99
--> a == [[1,2,99], [99,99,99]]
Hinsen> That's nice on the left hand side of an assignment, but what
Hinsen> is the value of a[a.gt(2)] in an expression? It can't be an
It be an array if you define a selection type indexing, e.g.,
where select is a method that whose argument has the same
dimensions as "a" and returns elements of "a" that correspond to
"true" elements of a.gt(2).
The language Octave allows for this type of selection indexing.
There are several types of indexing schemes that I have seen for
multi-demensional arrays. Without additions to the syntax, only one
could be used with "[...]" and the others would have to be explicit
I have a number of possible suggestions about different types of
array indexing which I will post later.
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: firstname.lastname@example.org
administrivia to: email@example.com