Here is a small code which demonstrates the error I am getting.
import numpy as np
r=4.0
L=20.0
ratio = 4*np.pi / 3.0 * (r/L)**3
for i in range(5, 16):
n = 10**i
m = int(ratio * n)
print i,n,m
ip = np.random.random_integers(100, size=(n,3))
jp = np.random.random_integers(100, size=(m,3))
a = np.expand_dims(ip, -1) == jp.T
b = np.where( a.all(axis=1).any(axis=1) )[0]
I get the following output:
5 100000 3351
6 1000000 33510
Traceback (most recent call last):
File "example.py", line 16, in <module>
b = np.where( a.all(axis=1).any(axis=1) )[0]
AttributeError: 'bool' object has no attribute 'all'
Anyone know what is going on here?
Alternatively, a reasonably quick way of indexing the location of elements of jp in ip would also work. I may go with the second solution from here
i==5
the size of arraya
is already on the order of 1 billion elements, wherei==6
its 100 billion elements (100 GB of data ifbool
). Are these extremely large arrays intentional? – Ophion Jul 26 '13 at 18:49i==6
np.expand_dims(ip, -1).nbytes == 24000000
which should be within reason, no? – user1984528 Jul 26 '13 at 21:02jp.T
to give the above sizes fora
.print a.nbytes/1E9
for the size in GB. – Ophion Jul 26 '13 at 21:06