[Numpy-discussion] Porting code for Numpy 1.13+ to get rid of "boolean index did not match indexed array along dimension 1" error

Mauro Cavalcanti maurobio at gmail.com
Tue Feb 12 18:15:49 EST 2019


Dear ALL,

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".

Here is a fragment of the code, where the error occurrs:

    evals, evecs = np.linalg.eig(Syy)
    idx = evals.argsort()[::-1]
    evals = np.real(evals[idx])
    U = np.real(evecs[:, idx])
    evals = evals[evals > tolerance]
    U = U[:, evals > tolerance] # Here is where the error occurs

So, I ask: is there a way out of this?

Thanks in advance for any assistance you can provide.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20190212/8e2ae53f/attachment.html>


More information about the NumPy-Discussion mailing list