26 #if defined (HAVE_CONFIG_H)
75 int nargin = args.length ();
77 if (nargin < 1 || nargin > 2)
80 const octave_value oct_z = (nargin == 1) ? args(0) : args(1);
81 const octave_idx_type k = (nargin == 1) ? 0 : args(0).xidx_type_value (
"psi: K must be an integer");
83 error (
"psi: K must be non-negative");
89 #define FLOAT_BRANCH(T, A, M, E) \
90 if (oct_z.is_ ## T ##_type ()) \
92 const A ## NDArray z = oct_z.M ## array_value (); \
93 A ## NDArray psi_z (z.dims ()); \
95 const E *zv = z.data (); \
96 E *psi_zv = psi_z.fortran_vec (); \
97 const octave_idx_type n = z.numel (); \
98 for (octave_idx_type i = 0; i < n; i++) \
99 *psi_zv++ = math::psi (*zv++); \
109 error (
"psi: Z must be a floating point");
116 error (
"psi: Z must be a floating point");
124 error (
"psi: Z must be real value for polygamma (K > 0)");
126 #define FLOAT_BRANCH(T, A, M, E) \
127 if (oct_z.is_ ## T ##_type ()) \
129 const A ## NDArray z = oct_z.M ## array_value (); \
130 A ## NDArray psi_z (z.dims ()); \
132 const E *zv = z.data (); \
133 E *psi_zv = psi_z.fortran_vec (); \
134 const octave_idx_type n = z.numel (); \
135 for (octave_idx_type i = 0; i < n; i++) \
138 error ("psi: Z must be non-negative for polygamma (K > 0)"); \
140 *psi_zv++ = math::psi (k, *zv++); \
148 error (
"psi: Z must be a floating point for polygamma (K > 0)");
bool iscomplex(void) const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
OCTINTERP_API void print_usage(void)
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void error(const char *fmt,...)
std::complex< double > Complex
std::complex< float > FloatComplex
#define FLOAT_BRANCH(T, A, M, E)