<div dir="ltr"><div class="markdown-here-wrapper" style=""><p style="margin:0px 0px 1.2em!important">It looks like your code is wrong, and numpy 1.12 happened to let you get away with it</p>
<p style="margin:0px 0px 1.2em!important">This line:</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important">evals = evals[evals > tolerance]
</code></pre><p style="margin:0px 0px 1.2em!important">Reduces the eigenvalues to only those which are greater than the tolerance</p>
<p style="margin:0px 0px 1.2em!important">When you do <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">U[:, evals > tolerance]</code>, <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">evals > tolerance</code> is just going to be <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">[True, True, ...]</code>.</p>
<p style="margin:0px 0px 1.2em!important">You need to swap the last two lines, to</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important">U = U[:, evals > tolerance]
evals = evals[evals > tolerance]
</code></pre><p style="margin:0px 0px 1.2em!important">Or better yet, introduce an intermediate variable:</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important">keep = evals > tolerance
evals = evals[keep]
U = U[:, keep]
</code></pre><p style="margin:0px 0px 1.2em!important">Eric</p>
<div title="MDH:SXQgbG9va3MgbGlrZSB5b3VyIGNvZGUgaXMgd3JvbmcsIGFuZCBudW1weSAxLjEyIGhhcHBlbmVk
IHRvIGxldCB5b3UgZ2V0IGF3YXkgd2l0aCBpdDxkaXY+PGJyPjwvZGl2PjxkaXY+VGhpcyBsaW5l
OjwvZGl2PjxkaXY+PGJyPiZuYnNwOyAmbmJzcDsmbmJzcDs8c3BhbiBzdHlsZT0iY29sb3I6IHJn
YigzMywgMzMsIDMzKTsiPmV2YWxzID0gZXZhbHNbZXZhbHMgJmd0OyB0b2xlcmFuY2VdPC9zcGFu
PjwvZGl2PjxkaXY+PHNwYW4gc3R5bGU9ImNvbG9yOiByZ2IoMzMsIDMzLCAzMyk7Ij48YnI+PC9z
cGFuPjwvZGl2PjxkaXY+PHNwYW4gc3R5bGU9ImNvbG9yOiByZ2IoMzMsIDMzLCAzMyk7Ij5SZWR1
Y2VzIHRoZSBlaWdlbnZhbHVlcyB0byBvbmx5IHRob3NlIHdoaWNoIGFyZSBncmVhdGVyIHRoYW4g
dGhlIHRvbGVyYW5jZTwvc3Bhbj48L2Rpdj48ZGl2Pjxz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4gc3R5bGU9ImNvbG9yOiBy
Z2IoMzMsIDMzLCAzMyk7Ij5dPC9zcGFuPjwvZGl2PjwvZGl2PjxkaXY+PHNwYW4gc3R5bGU9ImNv
bG9yOiByZ2IoMzMsIDMzLCAzMyk7Ij48YnI+PC9zcGFuPjwvZGl2PjxkaXY+PHNwYW4gc3R5bGU9
ImNvbG9yOiByZ2IoMzMsIDMzLCAzMyk7Ij5FcmljPC9zcGFuPjwvZGl2Pg==" style="height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0">​</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 12 Feb 2019 at 15:16 Mauro Cavalcanti <<a href="mailto:maurobio@gmail.com">maurobio@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Dear ALL,<br></div><div dir="ltr"><br></div><div dir="ltr">I am trying to port an eigenalysis function that runs smoothly on Numpy 1.12 but fail miserably on Numpy 1.13 or higher with the dreadful error "boolean index did not match indexed array along dimension 1".<br><br>Here is a fragment of the code, where the error occurrs:<br><br>    evals, evecs = np.linalg.eig(Syy)<br>    idx = evals.argsort()[::-1]<br>    evals = np.real(evals[idx])<br>    U = np.real(evecs[:, idx])<br>    evals = evals[evals > tolerance]<br>    U = U[:, evals > tolerance] # Here is where the error occurs<br><br>So, I ask: is there a way out of this?<br></div><div><br></div><div>Thanks in advance for any assistance you can provide.<br></div></div>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@python.org" target="_blank">NumPy-Discussion@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/numpy-discussion</a><br>
</blockquote></div>