26 #if defined (HAVE_CONFIG_H)
74 int nargin = args.length ();
76 if (nargin < 2 || nargin > 3)
84 double m = args(1).xdouble_value (
"ellipj: M must be a scalar or matrix");
91 double u = args(0).xdouble_value (
"ellipj: U must be a scalar or matrix");
98 return ovl (sn, cn, dn, err);
110 return ovl (sn, cn, dn, err);
124 Complex *psn = sn.fortran_vec ();
125 Complex *pcn = cn.fortran_vec ();
133 return ovl (sn, cn, dn, err);
138 NDArray m = args(1).xarray_value (
"ellipj: M must be a scalar or matrix");
148 double u = u_arg.
xdouble_value (
"ellipj: U must be a scalar or matrix");
150 NDArray sn (sz_m), cn (sz_m), dn (sz_m);
153 const double *pm =
m.data ();
154 double *psn = sn.fortran_vec ();
155 double *pcn = cn.fortran_vec ();
163 return ovl (sn, cn, dn, err);
173 const double *pm =
m.data ();
174 Complex *psn = sn.fortran_vec ();
175 Complex *pcn = cn.fortran_vec ();
183 return ovl (sn, cn, dn, err);
197 && sz_u(1) == 1 && sz_m(0) == 1)
204 NDArray sn (sz_out), cn (sz_out), dn (sz_out);
207 const double *pu = u.
data ();
208 const double *pm =
m.data ();
214 return ovl (sn, cn, dn, err);
216 else if (sz_m == sz_u)
218 NDArray sn (sz_m), cn (sz_m), dn (sz_m);
221 const double *pu = u.
data ();
222 const double *pm =
m.data ();
223 double *psn = sn.fortran_vec ();
224 double *pcn = cn.fortran_vec ();
232 return ovl (sn, cn, dn, err);
235 error (
"ellipj: Invalid size combination for U and M");
245 && sz_u(1) == 1 && sz_m(0) == 1)
256 const double *pm =
m.data ();
262 return ovl (sn, cn, dn, err);
264 else if (sz_m == sz_u)
270 const double *pm =
m.data ();
271 Complex *psn = sn.fortran_vec ();
272 Complex *pcn = cn.fortran_vec ();
280 return ovl (sn, cn, dn, err);
283 error (
"ellipj: Invalid size combination for U and M");
octave_idx_type numel(void) const
Number of elements in the array.
const T * data(void) const
Size of the specified dimension.
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
const T * fortran_vec(void) const
Size of the specified dimension.
Vector representing the dimensions (size) of an Array.
octave_idx_type ndims(void) const
Number of dimensions.
bool is_scalar_type(void) const
Complex xcomplex_value(const char *fmt,...) const
double xdouble_value(const char *fmt,...) const
ComplexNDArray xcomplex_array_value(const char *fmt,...) const
NDArray xarray_value(const char *fmt,...) const
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,...)
void ellipj(double u, double m, double &sn, double &cn, double &dn, double &err)
std::complex< double > Complex
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.