[Numpy-discussion] LaTeX version of boolean indexing

Matthew Harrigan harrigan.matthew at gmail.com
Thu Oct 11 12:53:51 EDT 2018


Hello,

I am documenting some code, translating the core of the algorithm to
LaTeX.  The style I have currently is very similar to the einsum syntax
(which is awesome btw).  Here
<https://gist.github.com/mattharrigan/68b292e64381bba6b78a06a6f1762fa2> is
an example of some of the basic operations in NumPy.  One part I do not
know how to capture well is boolean indexing, ie:

mask = np.array([1, 0, 1])
x = np.array([1, 2, 3])
y = x[mask]

Any suggestions on how to clearly, formally, and concisely show that
operation?  Also, are there any guides on translating NumPy to LaTeX?  It
might be helpful for documenting algorithms and also for people learning
NumPy.

Thank you,
Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20181011/68d3a86e/attachment.html>


More information about the NumPy-Discussion mailing list