Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Topic: Binary or Logical Selection : Given an array A and a binary
orlogical vector S, how do I select the rows of A when S = 1 or True ?

Replies: 2   Last Post: Sep 24, 2012 12:46 PM

 Messages: [ Previous | Next ]
 James Waldby Posts: 396 Registered: 1/27/11
Re: Binary or Logical Selection : Given an array A and a binary
orlogical vector S, how do I select the rows of A when S = 1 or True ?

Posted: Sep 24, 2012 2:31 AM

On Sun, 23 Sep 2012 22:00:15 +0200, clicliclic wrote:
> Beau Webber schrieb:
>> Given a 3 column array A of x,y,z numbers, defining a set of spatial
>> coordinates, and a binary or logical selection vector S (with as many
>> elements as rows in A) :
>>
>> How do I express the operation of selecting an array R with the set of
>> those co-ordinates in A where S is 1 (or true) ?
>>
>> In Apl I write this as R <- S /[1] A .
>>
>> But a referee of a paper is asking that I express this in standard
>> maths, and I have not yet managed to find an appropriate mathematical
>> expression.

...
> I can imagine that referees don't like mathematical explanations in
> terms of APL - unless yours is a paper about APL (does the language
> still exist?). But I can't think of an elegant way to express this in
> standard vector notation either. This newsgroup is only concerned with
> the development and application of computer-algebra systems like Maxima
> or Maple, I am therefore widening the audience to include sci.math.
>
> Can anybody help the original poster?

Perhaps write something like following, in which the form p_i_j
stands for p_{i_j} and the parenthesized lists stand for vectors
of points p_i.

Suppose A = (p_1, p_2, ... p_n). Let R = (p_i_1, p_i_2, ... p_i_k)
where i_j < i_{j+1} for all the j, and i \in { i_j } iff S_i = 1.

--
jiw

Date Subject Author
9/24/12 James Waldby