Wei, Huayi
2016-11-30 21:54:16 UTC
Hi, There,
Here is a sample code using `numpy.bincount`
import numpy as np
a = np.array([1.0, 2.0, 3.0], dtype=np.float128)
b = np.array([1, 2, 0], dtype=np.int)
c = np.bincount(b, weights=a)
If run it, I get the following error report:
----> 1 c = np.bincount(b, weights=a)
TypeError: Cannot cast array data from dtype('float128') to
dtype('float64') according to the rule 'safe'
Is it a bug of `np.bincount`? Does there exist any similar function
which I can use to do the similar thing with numpy.float128 type weights?
Best
Huayi
Here is a sample code using `numpy.bincount`
import numpy as np
a = np.array([1.0, 2.0, 3.0], dtype=np.float128)
b = np.array([1, 2, 0], dtype=np.int)
c = np.bincount(b, weights=a)
If run it, I get the following error report:
----> 1 c = np.bincount(b, weights=a)
TypeError: Cannot cast array data from dtype('float128') to
dtype('float64') according to the rule 'safe'
Is it a bug of `np.bincount`? Does there exist any similar function
which I can use to do the similar thing with numpy.float128 type weights?
Best
Huayi