comparison 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
comparison
equal deleted inserted replaced
20367:e410d62ae2c8 20371:65e22ba879f0
661 ellipj (double u, double m, double& sn, double& cn, double& dn, double& err); 661 ellipj (double u, double m, double& sn, double& cn, double& dn, double& err);
662 extern OCTAVE_API void 662 extern OCTAVE_API void
663 ellipj (const Complex& u, double m, Complex& sn, Complex& cn, Complex& dn, 663 ellipj (const Complex& u, double m, Complex& sn, Complex& cn, Complex& dn,
664 double& err); 664 double& err);
665 665
666 //! Digamma function.
667 //!
668 //! Only defined for double and float.
666 template<class T> 669 template<class T>
667 extern OCTAVE_API T psi (const T& z); 670 extern OCTAVE_API T psi (const T& z);
671
672 //! Digamma function for complex input.
673 //!
674 //! Only defined for double and float.
668 template<class T> 675 template<class T>
669 extern OCTAVE_API std::complex<T> psi (const std::complex<T>& z); 676 extern OCTAVE_API std::complex<T> psi (const std::complex<T>& z);
670 677
671 #endif 678 //! Polygamma function.
679 //!
680 //! Only defined for double and float.
681 //! @param n must be non-negative. If zero, the digamma function is computed.
682 //! @param z must be real and non-negative.
683 template<class T>
684 extern OCTAVE_API T psi (const octave_idx_type n, const T z);
685
686 #endif