特殊函数的 Cython API#

可以在 Cython 中直接访问 scipy.special 中许多函数的标量类型版本;完整的列表如下。函数使用 Cython 融合类型进行重载,因此它们的名称与其 Python 对应函数匹配。该模块遵循以下约定

  • 如果函数的 Python 对应函数返回多个值,则函数通过最终参数中的指针返回其输出。

  • 如果函数的 Python 对应函数返回单个值,则函数的输出直接返回。

可以通过以下方式在 Cython 中使用该模块

cimport scipy.special.cython_special

错误处理#

函数可以通过返回 nan 来指示错误;但是,它们无法像 scipy.special 中的对应函数那样发出警告。

可用函数#

  • voigt_profile:

    double voigt_profile(double, double, double)
    
  • agm:

    double agm(double, double)
    
  • airy:

    void airy(double, double *, double *, double *, double *)
    void airy(double complex, double complex *, double complex *, double complex *, double complex *)
    
  • airye:

    void airye(double complex, double complex *, double complex *, double complex *, double complex *)
    void airye(double, double *, double *, double *, double *)
    
  • bdtr:

    double bdtr(double, double, double)
    double bdtr(double, long, double)
    
  • bdtrc:

    double bdtrc(double, double, double)
    double bdtrc(double, long, double)
    
  • bdtri:

    double bdtri(double, double, double)
    double bdtri(double, long, double)
    
  • bdtrik:

    double bdtrik(double, double, double)
    
  • bdtrin:

    double bdtrin(double, double, double)
    
  • bei:

    double bei(double)
    
  • beip:

    double beip(double)
    
  • ber:

    double ber(double)
    
  • berp:

    double berp(double)
    
  • besselpoly:

    double besselpoly(double, double, double)
    
  • beta:

    double beta(double, double)
    
  • betainc:

    float betainc(float, float, float)
    double betainc(double, double, double)
    
  • betaincc:

    float betaincc(float, float, float)
    double betaincc(double, double, double)
    
  • betaincinv:

    float betaincinv(float, float, float)
    double betaincinv(double, double, double)
    
  • betainccinv:

    float betainccinv(float, float, float)
    double betainccinv(double, double, double)
    
  • betaln:

    double betaln(double, double)
    
  • binom:

    double binom(double, double)
    
  • boxcox:

    double boxcox(double, double)
    
  • boxcox1p:

    double boxcox1p(double, double)
    
  • btdtr:

    double btdtr(double, double, double)
    
  • btdtri:

    double btdtri(double, double, double)
    
  • btdtria:

    double btdtria(double, double, double)
    
  • btdtrib:

    double btdtrib(double, double, double)
    
  • cbrt:

    double cbrt(double)
    
  • chdtr:

    double chdtr(double, double)
    
  • chdtrc:

    double chdtrc(double, double)
    
  • chdtri:

    double chdtri(double, double)
    
  • chdtriv:

    double chdtriv(double, double)
    
  • chndtr:

    double chndtr(double, double, double)
    
  • chndtridf:

    double chndtridf(double, double, double)
    
  • chndtrinc:

    double chndtrinc(double, double, double)
    
  • chndtrix:

    double chndtrix(double, double, double)
    
  • cosdg:

    double cosdg(double)
    
  • cosm1:

    double cosm1(double)
    
  • cotdg:

    double cotdg(double)
    
  • dawsn:

    double dawsn(double)
    double complex dawsn(double complex)
    
  • ellipe:

    double ellipe(double)
    
  • ellipeinc:

    double ellipeinc(double, double)
    
  • ellipj:

    void ellipj(double, double, double *, double *, double *, double *)
    
  • ellipkinc:

    double ellipkinc(double, double)
    
  • ellipkm1:

    double ellipkm1(double)
    
  • ellipk:

    double ellipk(double)
    
  • elliprc:

    double elliprc(double, double)
    double complex elliprc(double complex, double complex)
    
  • elliprd:

    double elliprd(double, double, double)
    double complex elliprd(double complex, double complex, double complex)
    
  • elliprf:

    double elliprf(double, double, double)
    double complex elliprf(double complex, double complex, double complex)
    
  • elliprg:

    double elliprg(double, double, double)
    double complex elliprg(double complex, double complex, double complex)
    
  • elliprj:

    double elliprj(double, double, double, double)
    double complex elliprj(double complex, double complex, double complex, double complex)
    
  • entr:

    double entr(double)
    
  • erf:

    double complex erf(double complex)
    double erf(double)
    
  • erfc:

    double complex erfc(double complex)
    double erfc(double)
    
  • erfcx:

    double erfcx(double)
    double complex erfcx(double complex)
    
  • erfi:

    double erfi(double)
    double complex erfi(double complex)
    
  • erfinv:

    float erfinv(float)
    double erfinv(double)
    
  • erfcinv:

    double erfcinv(double)
    
  • eval_chebyc:

    double complex eval_chebyc(double, double complex)
    double eval_chebyc(double, double)
    double eval_chebyc(long, double)
    
  • eval_chebys:

    double complex eval_chebys(double, double complex)
    double eval_chebys(double, double)
    double eval_chebys(long, double)
    
  • eval_chebyt:

    double complex eval_chebyt(double, double complex)
    double eval_chebyt(double, double)
    double eval_chebyt(long, double)
    
  • eval_chebyu:

    double complex eval_chebyu(double, double complex)
    double eval_chebyu(double, double)
    double eval_chebyu(long, double)
    
  • eval_gegenbauer:

    double complex eval_gegenbauer(double, double, double complex)
    double eval_gegenbauer(double, double, double)
    double eval_gegenbauer(long, double, double)
    
  • eval_genlaguerre:

    double complex eval_genlaguerre(double, double, double complex)
    double eval_genlaguerre(double, double, double)
    double eval_genlaguerre(long, double, double)
    
  • eval_hermite:

    double eval_hermite(long, double)
    
  • eval_hermitenorm:

    double eval_hermitenorm(long, double)
    
  • eval_jacobi:

    double complex eval_jacobi(double, double, double, double complex)
    double eval_jacobi(double, double, double, double)
    double eval_jacobi(long, double, double, double)
    
  • eval_laguerre:

    double complex eval_laguerre(double, double complex)
    double eval_laguerre(double, double)
    double eval_laguerre(long, double)
    
  • eval_legendre:

    double complex eval_legendre(double, double complex)
    double eval_legendre(double, double)
    double eval_legendre(long, double)
    
  • eval_sh_chebyt:

    double complex eval_sh_chebyt(double, double complex)
    double eval_sh_chebyt(double, double)
    double eval_sh_chebyt(long, double)
    
  • eval_sh_chebyu:

    double complex eval_sh_chebyu(double, double complex)
    double eval_sh_chebyu(double, double)
    double eval_sh_chebyu(long, double)
    
  • eval_sh_jacobi:

    double complex eval_sh_jacobi(double, double, double, double complex)
    double eval_sh_jacobi(double, double, double, double)
    double eval_sh_jacobi(long, double, double, double)
    
  • eval_sh_legendre:

    double complex eval_sh_legendre(double, double complex)
    double eval_sh_legendre(double, double)
    double eval_sh_legendre(long, double)
    
  • exp1:

    double complex exp1(double complex)
    double exp1(double)
    
  • exp10:

    double exp10(double)
    
  • exp2:

    double exp2(double)
    
  • expi:

    double complex expi(double complex)
    double expi(double)
    
  • expit:

    double expit(double)
    float expit(float)
    long double expit(long double)
    
  • expm1:

    double complex expm1(double complex)
    double expm1(double)
    
  • expn:

    double expn(double, double)
    double expn(long, double)
    
  • exprel:

    double exprel(double)
    
  • fdtr:

    double fdtr(double, double, double)
    
  • fdtrc:

    double fdtrc(double, double, double)
    
  • fdtri:

    double fdtri(double, double, double)
    
  • fdtridfd:

    double fdtridfd(double, double, double)
    
  • fresnel:

    void fresnel(double, double *, double *)
    void fresnel(double complex, double complex *, double complex *)
    
  • gamma:

    double complex gamma(double complex)
    double gamma(double)
    
  • gammainc:

    double gammainc(double, double)
    
  • gammaincc:

    double gammaincc(double, double)
    
  • gammainccinv:

    double gammainccinv(double, double)
    
  • gammaincinv:

    double gammaincinv(double, double)
    
  • gammaln:

    double gammaln(double)
    
  • gammasgn:

    double gammasgn(double)
    
  • gdtr:

    double gdtr(double, double, double)
    
  • gdtrc:

    double gdtrc(double, double, double)
    
  • gdtria:

    double gdtria(double, double, double)
    
  • gdtrib:

    double gdtrib(double, double, double)
    
  • gdtrix:

    double gdtrix(double, double, double)
    
  • hankel1:

    double complex hankel1(double, double complex)
    
  • hankel1e:

    double complex hankel1e(double, double complex)
    
  • hankel2:

    double complex hankel2(double, double complex)
    
  • hankel2e:

    double complex hankel2e(double, double complex)
    
  • huber:

    double huber(double, double)
    
  • hyp0f1:

    double complex hyp0f1(double, double complex)
    double hyp0f1(double, double)
    
  • hyp1f1:

    double hyp1f1(double, double, double)
    double complex hyp1f1(double, double, double complex)
    
  • hyp2f1:

    double hyp2f1(double, double, double, double)
    double complex hyp2f1(double, double, double, double complex)
    
  • hyperu:

    double hyperu(double, double, double)
    
  • i0:

    double i0(double)
    
  • i0e:

    double i0e(double)
    
  • i1:

    double i1(double)
    
  • i1e:

    double i1e(double)
    
  • inv_boxcox:

    double inv_boxcox(double, double)
    
  • inv_boxcox1p:

    double inv_boxcox1p(double, double)
    
  • it2i0k0:

    void it2i0k0(double, double *, double *)
    
  • it2j0y0:

    void it2j0y0(double, double *, double *)
    
  • it2struve0:

    double it2struve0(double)
    
  • itairy:

    void itairy(double, double *, double *, double *, double *)
    
  • iti0k0:

    void iti0k0(double, double *, double *)
    
  • itj0y0:

    void itj0y0(double, double *, double *)
    
  • itmodstruve0:

    double itmodstruve0(double)
    
  • itstruve0:

    double itstruve0(double)
    
  • iv:

    double complex iv(double, double complex)
    double iv(double, double)
    
  • ive:

    double complex ive(double, double complex)
    double ive(double, double)
    
  • j0:

    double j0(double)
    
  • j1:

    double j1(double)
    
  • jv:

    double complex jv(double, double complex)
    double jv(double, double)
    
  • jve:

    double complex jve(double, double complex)
    double jve(double, double)
    
  • k0:

    double k0(double)
    
  • k0e:

    double k0e(double)
    
  • k1:

    double k1(double)
    
  • k1e:

    double k1e(double)
    
  • kei:

    double kei(double)
    
  • keip:

    double keip(double)
    
  • kelvin:

    void kelvin(double, double complex *, double complex *, double complex *, double complex *)
    
  • ker:

    double ker(double)
    
  • kerp:

    double kerp(double)
    
  • kl_div:

    double kl_div(double, double)
    
  • kn:

    double kn(double, double)
    double kn(long, double)
    
  • kolmogi:

    double kolmogi(double)
    
  • kolmogorov:

    double kolmogorov(double)
    
  • kv:

    double complex kv(double, double complex)
    double kv(double, double)
    
  • kve:

    double complex kve(double, double complex)
    double kve(double, double)
    
  • log1p:

    double complex log1p(double complex)
    double log1p(double)
    
  • log_expit:

    double log_expit(double)
    float log_expit(float)
    long double log_expit(long double)
    
  • log_ndtr:

    double log_ndtr(double)
    double complex log_ndtr(double complex)
    
  • loggamma:

    double loggamma(double)
    double complex loggamma(double complex)
    
  • logit:

    double logit(double)
    float logit(float)
    long double logit(long double)
    
  • lpmv:

    double lpmv(double, double, double)
    
  • mathieu_a:

    double mathieu_a(double, double)
    
  • mathieu_b:

    double mathieu_b(double, double)
    
  • mathieu_cem:

    void mathieu_cem(double, double, double, double *, double *)
    
  • mathieu_modcem1:

    void mathieu_modcem1(double, double, double, double *, double *)
    
  • mathieu_modcem2:

    void mathieu_modcem2(double, double, double, double *, double *)
    
  • mathieu_modsem1:

    void mathieu_modsem1(double, double, double, double *, double *)
    
  • mathieu_modsem2:

    void mathieu_modsem2(double, double, double, double *, double *)
    
  • mathieu_sem:

    void mathieu_sem(double, double, double, double *, double *)
    
  • modfresnelm:

    void modfresnelm(double, double complex *, double complex *)
    
  • modfresnelp:

    void modfresnelp(double, double complex *, double complex *)
    
  • modstruve:

    double modstruve(double, double)
    
  • nbdtr:

    double nbdtr(double, double, double)
    double nbdtr(long, long, double)
    
  • nbdtrc:

    double nbdtrc(double, double, double)
    double nbdtrc(long, long, double)
    
  • nbdtri:

    double nbdtri(double, double, double)
    double nbdtri(long, long, double)
    
  • nbdtrik:

    double nbdtrik(double, double, double)
    
  • nbdtrin:

    double nbdtrin(double, double, double)
    
  • ncfdtr:

    double ncfdtr(double, double, double, double)
    
  • ncfdtri:

    double ncfdtri(double, double, double, double)
    
  • ncfdtridfd:

    double ncfdtridfd(double, double, double, double)
    
  • ncfdtridfn:

    double ncfdtridfn(double, double, double, double)
    
  • ncfdtrinc:

    double ncfdtrinc(double, double, double, double)
    
  • nctdtr:

    double nctdtr(double, double, double)
    
  • nctdtridf:

    double nctdtridf(double, double, double)
    
  • nctdtrinc:

    double nctdtrinc(double, double, double)
    
  • nctdtrit:

    double nctdtrit(double, double, double)
    
  • ndtr:

    double complex ndtr(double complex)
    double ndtr(double)
    
  • ndtri:

    double ndtri(double)
    
  • nrdtrimn:

    double nrdtrimn(double, double, double)
    
  • nrdtrisd:

    double nrdtrisd(double, double, double)
    
  • obl_ang1:

    void obl_ang1(double, double, double, double, double *, double *)
    
  • obl_ang1_cv:

    void obl_ang1_cv(double, double, double, double, double, double *, double *)
    
  • obl_cv:

    double obl_cv(double, double, double)
    
  • obl_rad1:

    void obl_rad1(double, double, double, double, double *, double *)
    
  • obl_rad1_cv:

    void obl_rad1_cv(double, double, double, double, double, double *, double *)
    
  • obl_rad2:

    void obl_rad2(double, double, double, double, double *, double *)
    
  • obl_rad2_cv:

    void obl_rad2_cv(double, double, double, double, double, double *, double *)
    
  • owens_t:

    double owens_t(double, double)
    
  • pbdv:

    void pbdv(double, double, double *, double *)
    
  • pbvv:

    void pbvv(double, double, double *, double *)
    
  • pbwa:

    void pbwa(double, double, double *, double *)
    
  • pdtr:

    double pdtr(double, double)
    
  • pdtrc:

    double pdtrc(double, double)
    
  • pdtri:

    double pdtri(double, double)
    double pdtri(long, double)
    
  • pdtrik:

    double pdtrik(double, double)
    
  • poch:

    double poch(double, double)
    
  • powm1:

    float powm1(float, float)
    double powm1(double, double)
    
  • pro_ang1:

    void pro_ang1(double, double, double, double, double *, double *)
    
  • pro_ang1_cv:

    void pro_ang1_cv(double, double, double, double, double, double *, double *)
    
  • pro_cv:

    double pro_cv(double, double, double)
    
  • pro_rad1:

    void pro_rad1(double, double, double, double, double *, double *)
    
  • pro_rad1_cv:

    void pro_rad1_cv(double, double, double, double, double, double *, double *)
    
  • pro_rad2:

    void pro_rad2(double, double, double, double, double *, double *)
    
  • pro_rad2_cv:

    void pro_rad2_cv(double, double, double, double, double, double *, double *)
    
  • pseudo_huber:

    double pseudo_huber(double, double)
    
  • psi:

    double complex psi(double complex)
    double psi(double)
    
  • radian:

    double radian(double, double, double)
    
  • rel_entr:

    double rel_entr(double, double)
    
  • rgamma:

    double complex rgamma(double complex)
    double rgamma(double)
    
  • round:

    double round(double)
    
  • shichi:

    void shichi(double complex, double complex *, double complex *)
    void shichi(double, double *, double *)
    
  • sici:

    void sici(double complex, double complex *, double complex *)
    void sici(double, double *, double *)
    
  • sindg:

    double sindg(double)
    
  • smirnov:

    double smirnov(double, double)
    double smirnov(long, double)
    
  • smirnovi:

    double smirnovi(double, double)
    double smirnovi(long, double)
    
  • spence:

    double complex spence(double complex)
    double spence(double)
    
  • sph_harm:

    double complex sph_harm(double, double, double, double)
    double complex sph_harm(long, long, double, double)
    
  • stdtr:

    double stdtr(double, double)
    
  • stdtridf:

    double stdtridf(double, double)
    
  • stdtrit:

    double stdtrit(double, double)
    
  • struve:

    double struve(double, double)
    
  • tandg:

    double tandg(double)
    
  • tklmbda:

    double tklmbda(double, double)
    
  • wofz:

    double complex wofz(double complex)
    
  • wrightomega:

    double complex wrightomega(double complex)
    double wrightomega(double)
    
  • xlog1py:

    double xlog1py(double, double)
    double complex xlog1py(double complex, double complex)
    
  • xlogy:

    double xlogy(double, double)
    double complex xlogy(double complex, double complex)
    
  • y0:

    double y0(double)
    
  • y1:

    double y1(double)
    
  • yn:

    double yn(double, double)
    double yn(long, double)
    
  • yv:

    double complex yv(double, double complex)
    double yv(double, double)
    
  • yve:

    double complex yve(double, double complex)
    double yve(double, double)
    
  • zetac:

    double zetac(double)
    
  • wright_bessel:

    double wright_bessel(double, double, double)
    
  • log_wright_bessel:

    double log_wright_bessel(double, double, double)
    
  • ndtri_exp:

    double ndtri_exp(double)
    

自定义函数#

scipy.special 中的一些不是 ufunc 的函数具有自定义 Cython 包装器。

球面贝塞尔函数#

可选的 derivative 布尔参数被替换为可选的 Cython bint,从而导致以下签名。

  • spherical_jn:

    double complex spherical_jn(long, double complex)
    double complex spherical_jn(long, double complex, bint)
    double spherical_jn(long, double)
    double spherical_jn(long, double, bint)
    
  • spherical_yn:

    double complex spherical_yn(long, double complex)
    double complex spherical_yn(long, double complex, bint)
    double spherical_yn(long, double)
    double spherical_yn(long, double, bint)
    
  • spherical_in:

    double complex spherical_in(long, double complex)
    double complex spherical_in(long, double complex, bint)
    double spherical_in(long, double)
    double spherical_in(long, double, bint)
    
  • spherical_kn:

    double complex spherical_kn(long, double complex)
    double complex spherical_kn(long, double complex, bint)
    double spherical_kn(long, double)
    double spherical_kn(long, double, bint)