# [Numpy-discussion] LaTeX version of boolean indexing

Andras Deak deak.andris at gmail.com
Thu Oct 11 14:03:56 EDT 2018

On Thu, Oct 11, 2018 at 7:45 PM Matthew Harrigan
<harrigan.matthew at gmail.com> wrote:
>
> What do you mean by indicator?
>

I mostly meant what wikipedia seems to call "set-builder notation"
(https://en.wikipedia.org/wiki/Set-builder_notation#Sets_defined_by_a_predicate).
Since your "input" is {x_i | i in [0,1,2]} but your output is a y_j
for j in [0,1], the straightforward thing I could think of was
defining the set of valid y_j values (with an implicit assumption of
the order being preserved, I guess). This would mean you can say
something like
y_i \in {x_j | m_j} (omitting the \left/\right/\vert fluff for
simplicity here) where m_j are the elements of the boolean mask
(say, m = [True, False, True]). In this context I'd understand it
that m_j is the predicate and x_j are the corresponding values,
the above wikipedia page) so you can't really get away with omitting
further explanation in order to resolve ambiguity. Though I guess
calling m_j elements of a mask would do the same thing.
The other option that comes to mind is to define the auxiliary indices
n_i for which m_j are True, then you of course denote the result
with integer indices: y_i = x_{n_i} where i goes from 0 to the
number of Trues in m_j. But then you have the same difficulty
defining n_i.
All in all I'm not sure there's an elegant and concise notation for