Skip to content

Commit

Permalink
Minor fix to pxd file to move header file imports back into pyx file.…
Browse files Browse the repository at this point in the history
… Also get rid of Numpy version requirement
  • Loading branch information
mattpitkin committed Apr 6, 2022
1 parent bfd3979 commit 96d7afb
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion lintegrate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from .lintegrate import *

__version__ = "0.1.12"
__version__ = "0.1.13"


def get_include():
Expand Down
18 changes: 0 additions & 18 deletions lintegrate/lintegrate.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,6 @@ from numpy.math cimport LOGE2, INFINITY

from libc.math cimport exp, sqrt, log, log10, isinf, fabs

cdef extern from "gsl/gsl_integration.h":
void gsl_integration_workspace_free (gsl_integration_workspace * w)
ctypedef struct gsl_integration_workspace
gsl_integration_workspace * gsl_integration_workspace_alloc (size_t n)
void gsl_integration_cquad_workspace_free (gsl_integration_cquad_workspace * w)
ctypedef struct gsl_integration_cquad_workspace
gsl_integration_cquad_workspace * gsl_integration_cquad_workspace_alloc (size_t n)

cdef extern from "gsl/gsl_sf_log.h":
double gsl_sf_log_1plusx(double x)

cdef extern from "lintegrate.h":
ctypedef double (*pylintfunc)(double x, void *funcdata, void *args)
int lintegration_qng (pylintfunc f, void *funcdata, void *args, double a, double b, double epsabs, double epsrel, double *result, double *abserr, size_t *neval)
int lintegration_qag (pylintfunc f, void *funcdata, void *args, double a, double b, double epsabs, double epsrel, size_t limit, int key, gsl_integration_workspace * workspace, double * result, double * abserr)
int lintegration_cquad (pylintfunc f, void *funcdata, void *args, double a, double b, double epsabs, double epsrel, gsl_integration_cquad_workspace * ws, double *result, double *abserr, size_t * nevals)


DTYPE = np.float64
ctypedef np.float64_t DTYPE_t

Expand Down
17 changes: 17 additions & 0 deletions lintegrate/lintegrate.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,23 @@
import numpy as np
cimport numpy as np

cdef extern from "gsl/gsl_integration.h":
void gsl_integration_workspace_free (gsl_integration_workspace * w)
ctypedef struct gsl_integration_workspace
gsl_integration_workspace * gsl_integration_workspace_alloc (size_t n)
void gsl_integration_cquad_workspace_free (gsl_integration_cquad_workspace * w)
ctypedef struct gsl_integration_cquad_workspace
gsl_integration_cquad_workspace * gsl_integration_cquad_workspace_alloc (size_t n)

cdef extern from "gsl/gsl_sf_log.h":
double gsl_sf_log_1plusx(double x)

cdef extern from "lintegrate.h":
ctypedef double (*pylintfunc)(double x, void *funcdata, void *args)
int lintegration_qng (pylintfunc f, void *funcdata, void *args, double a, double b, double epsabs, double epsrel, double *result, double *abserr, size_t *neval)
int lintegration_qag (pylintfunc f, void *funcdata, void *args, double a, double b, double epsabs, double epsrel, size_t limit, int key, gsl_integration_workspace * workspace, double * result, double * abserr)
int lintegration_cquad (pylintfunc f, void *funcdata, void *args, double a, double b, double epsabs, double epsrel, gsl_integration_cquad_workspace * ws, double *result, double *abserr, size_t * nevals)

# call import_array() https://cython.readthedocs.io/en/latest/src/tutorial/numpy.html#adding-types
np.import_array()

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ setup_requires =
numpy
setuptools_scm
install_requires =
numpy>=1.21
numpy
packages = find:

[options.package_data]
Expand Down

0 comments on commit 96d7afb

Please sign in to comment.