Passing a cython function vs a cython method to scipy.integrate

后端 未结 1 1550
挽巷
挽巷 2020-12-07 04:22

I am trying work out how to use cython to speed up a calculation involving integration that is done within a class I have defined. I\'m trying to understand better how cytho

1条回答
  •  天命终不由人
    2020-12-07 04:47

    From hpaulj's help above: the answer is the _integrand method needs to be declared cpdef not cdef

    cpdef double _integrand(self, double x):
        """Cython: integrand inside the class"""
        cdef double f = log(x) / sqrt(x)
        return f
    

    0 讨论(0)
提交回复
热议问题