On Wed, Sep 14, 2011 at 2:31 AM, Rajeev Singh <rajs2...@gmail.com> wrote:
> Hi,
>
> The following examples compiles from the notebook
>
> %cython
> cimport sage.gsl.ode
> import sage.gsl.ode
> include 'gsl.pxi'
>
> cdef class van_der_pol(sage.gsl.ode.ode_system):
>    cdef double beta
>    def __cinit__(self, double beta=1.0):
>        self.beta = beta
>    cdef int c_f(self,double t, double *y,double *dydt):
>        dydt[0]=y[1]
>        dydt[1]=-y[0]-self.beta*y[1]*(y[0]*y[0]-1)
>        return GSL_SUCCESS
>    cdef int c_j(self, double t,double *y,double *dfdy,double *dfdt):
>        dfdy[0]=0
>        dfdy[1]=1.0
>        dfdy[2]=-2.0*10*y[0]*y[1]-1.0
>        dfdy[3]=-10*(y[0]*y[0]-1.0)
>        dfdt[0]=0
>        dfdt[1]=0
>        return GSL_SUCCESS
>
> However if I put it in a file vander.pyx (say) and use the following setup.py 
> -
>
> from distutils.core import setup
> from distutils.extension import Extension
> from Cython.Distutils import build_ext
>
> ext = Extension("vander", ["vander.pyx"],
>    include_dirs = ['/home/rajeev/bin/sage/devel/sage-main/sage/gsl/'])
>
> setup(ext_modules=[ext],
>      cmdclass = {'build_ext': build_ext})
>
>
> I get the following error -
>
> cdef class van_der_pol(sage.gsl.ode.ode_system):
>    ^
> ------------------------------------------------------------
>
> vander.pyx:10:5: 'ode_system' is not declared
>
>
> I guess the problem is with the setup.py. Can someone tell me how to do this?

IIRC, the notebook %cython creates a setup.py--you could just look at
that. Chances are your Extension object is missing include dirs and
libraries.

 -Robert

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to