I have a scipy CSR matrix that was constructed from a COO matrix as follows:
coord_mat = coo_matrix((data, (row, col)), dtype=np.float64)
It is being used as an input to a library with an underlying C implementation, and I believe that the dtype of my matrix is double(np.float64)
. However, I'm encountering the following error:
ValueError: Buffer dtype mismatch, expected 'flt' but got 'double'
I went to do some research and found the scipy C-api, which informed me that the NPY_FLOAT
data type is converted to a 32-bit float in C, while the current data type I have corresponds to a 64-bit double. Am I on the right track here? If so, how do I cast the type of the array? I'm not entirely sure how I can call on the NPY_FLOAT
object in order to cast it.
Any help on this matter would be deeply appreciated!