Mercurial > hg > octave-nkf
diff liboctave/numeric/lo-specfun.h @ 20371:65e22ba879f0
psi: add support to compute the polygamma function (kth-derivative).
* libinterp/corefcn/psi.cc: previously, only the digamma function, k == 0,
was being computed. Add support for polygamma function, add tests, and
improve documentation.
* liboctave/cruft/slatec-fn/dpsifn.f, liboctave/cruft/slatec-fn/psifn.f: the
two functions that actually compute the the polygamma functions, copied
verbatim from SLATEC, and under public domain.
* liboctave/cruft/slatec-fn/module.mk: add dpsifn.f and psifn.f to the build
system.
* liboctave/numeric/lo-specfun.cc: add new signature for function psi to
compute polygamma function that wraps the Fortran DPSIFN and PSIFN functions.
* liboctave/numeric/lo-specfun.h: declare new function and document all psi()
with doxygen.
author | Carnë Draug <carandraug@octave.org> |
---|---|
date | Sun, 03 May 2015 22:52:07 +0100 |
parents | 1fae49e34a1a |
children |
line wrap: on
line diff
--- a/liboctave/numeric/lo-specfun.h +++ b/liboctave/numeric/lo-specfun.h @@ -663,9 +663,24 @@ ellipj (const Complex& u, double m, Complex& sn, Complex& cn, Complex& dn, double& err); +//! Digamma function. +//! +//! Only defined for double and float. template<class T> extern OCTAVE_API T psi (const T& z); + +//! Digamma function for complex input. +//! +//! Only defined for double and float. template<class T> extern OCTAVE_API std::complex<T> psi (const std::complex<T>& z); +//! Polygamma function. +//! +//! Only defined for double and float. +//! @param n must be non-negative. If zero, the digamma function is computed. +//! @param z must be real and non-negative. +template<class T> +extern OCTAVE_API T psi (const octave_idx_type n, const T z); + #endif