I am building an array with cython element by element. I'd like to store the constant np.inf
(or -1 * np.inf
) in some entries. However, this will require the overhead of going back into Python to look up inf
. Is there a libc.math
equivalent of this constant? Or some other value that could easily be used that's equivalent to (-1*np.inf)
and can be used from Cython without overhead?
EDIT example, you have:
cdef double value = 0
for k in xrange(...):
# use -inf here -- how to avoid referring to np.inf and calling back to python?
value = -1 * np.inf