24 #if defined (HAVE_CONFIG_H) 32 DEFUN (__betainc__, args, ,
38 int nargin = args.length ();
43 bool is_single = (args(0).is_single_type () || args(1).is_single_type ()
44 || args(2).is_single_type ());
47 int numel_x = args(0).numel ();
48 int numel_a = args(1).numel ();
49 int numel_b = args(2).numel ();
66 x = args(0).float_array_value ();
72 a = args(1).float_array_value ();
77 b = args(2).float_array_value ();
81 static const float eps = std::numeric_limits<float>::epsilon ();
82 float xj, x2,
y, Cj, Dj, aj, bj, Deltaj, alpha_j, beta_j;
101 beta_j = aj - (aj * (aj + bj)) / (aj + 1) * xj;
106 while ((
std::abs ((Deltaj - 1)) >
eps) && (j < maxit))
108 Dj = beta_j + alpha_j * Dj;
111 Cj = beta_j + alpha_j / Cj;
117 alpha_j = ((aj + j - 1) * (aj + bj + j -1) * (bj - j) * j)
118 / ((aj + 2 * j - 1) * (aj + 2 * j - 1)) * x2;
119 beta_j = aj + 2 * j + ((j * (bj - j)) / (aj + 2 * j - 1)
120 - ((aj + j) * (aj + bj + j)) / (aj + 2 * j + 1)) * xj;
136 x =
NDArray (output_dv, args(0).scalar_value ());
138 x = args(0).array_value ();
141 a =
NDArray (output_dv, args(1).scalar_value ());
143 a = args(1).array_value ();
146 b =
NDArray (output_dv, args(2).scalar_value ());
148 b = args(2).array_value ();
152 static const double eps = std::numeric_limits<double>::epsilon ();
153 double xj, x2,
y, Cj, Dj, aj, bj, Deltaj, alpha_j, beta_j;
172 beta_j = aj - (aj * (aj + bj)) / (aj + 1) * xj;
177 while ((
std::abs ((Deltaj - 1)) >
eps) && (j < maxit))
179 Dj = beta_j + alpha_j * Dj;
182 Cj = beta_j + alpha_j / Cj;
188 alpha_j = ((aj + j - 1) * (aj + bj + j - 1) * (bj - j) * j)
189 / ((aj + 2 * j - 1) * (aj + 2 * j - 1)) * x2;
190 beta_j = aj + 2 * j + ((j * (bj - j)) / (aj + 2 * j - 1)
191 - ((aj + j) * (aj + bj + j)) / (aj + 2 * j + 1)) * xj;
OCTINTERP_API void print_usage(void)
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE * f
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
charNDArray max(char d, const charNDArray &m)
the element is set to zero In other the statement xample y
Vector representing the dimensions (size) of an Array.
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE * x