26 #if defined (HAVE_CONFIG_H)
76 int nargin = args.length ();
78 if (nargin < 2 || nargin > 3)
86 double m = args(1).xdouble_value (
"ellipj: M must be a scalar or matrix");
93 double u = args(0).xdouble_value (
"ellipj: U must be a scalar or matrix");
100 return ovl (sn, cn, dn, err);
112 return ovl (sn, cn, dn, err);
126 Complex *psn = sn.fortran_vec ();
127 Complex *pcn = cn.fortran_vec ();
135 return ovl (sn, cn, dn, err);
140 NDArray m = args(1).xarray_value (
"ellipj: M must be a scalar or matrix");
150 double u = u_arg.
xdouble_value (
"ellipj: U must be a scalar or matrix");
152 NDArray sn (sz_m), cn (sz_m), dn (sz_m);
155 const double *pm =
m.data ();
156 double *psn = sn.fortran_vec ();
157 double *pcn = cn.fortran_vec ();
163 math::ellipj (u, pm[i], psn[i], pcn[i], pdn[i], perr[i]);
165 return ovl (sn, cn, dn, err);
175 const double *pm =
m.data ();
176 Complex *psn = sn.fortran_vec ();
177 Complex *pcn = cn.fortran_vec ();
183 math::ellipj (u, pm[i], psn[i], pcn[i], pdn[i], perr[i]);
185 return ovl (sn, cn, dn, err);
199 && sz_u(1) == 1 && sz_m(0) == 1)
206 NDArray sn (sz_out), cn (sz_out), dn (sz_out);
209 const double *pu = u.
data ();
210 const double *pm =
m.data ();
214 math::ellipj (pu[i], pm[j], sn(i, j), cn(i, j), dn(i, j), err(i, j));
216 return ovl (sn, cn, dn, err);
218 else if (sz_m == sz_u)
220 NDArray sn (sz_m), cn (sz_m), dn (sz_m);
223 const double *pu = u.
data ();
224 const double *pm =
m.data ();
225 double *psn = sn.fortran_vec ();
226 double *pcn = cn.fortran_vec ();
232 math::ellipj (pu[i], pm[i], psn[i], pcn[i], pdn[i], perr[i]);
234 return ovl (sn, cn, dn, err);
237 error (
"ellipj: Invalid size combination for U and M");
247 && sz_u(1) == 1 && sz_m(0) == 1)
258 const double *pm =
m.data ();
262 math::ellipj (pu[i], pm[j], sn(i, j), cn(i, j), dn(i, j), err(i, j));
264 return ovl (sn, cn, dn, err);
266 else if (sz_m == sz_u)
272 const double *pm =
m.data ();
273 Complex *psn = sn.fortran_vec ();
274 Complex *pcn = cn.fortran_vec ();
280 math::ellipj (pu[i], pm[i], psn[i], pcn[i], pdn[i], perr[i]);
282 return ovl (sn, cn, dn, err);
285 error (
"ellipj: Invalid size combination for U and M");
OCTARRAY_OVERRIDABLE_FUNC_API const T * data(void) const
Size of the specified dimension.
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type numel(void) const
Number of elements in the array.
OCTARRAY_OVERRIDABLE_FUNC_API const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
OCTARRAY_API T * fortran_vec(void)
Size of the specified dimension.
Vector representing the dimensions (size) of an Array.
octave_idx_type ndims(void) const
Number of dimensions.
OCTINTERP_API NDArray xarray_value(const char *fmt,...) const
bool is_scalar_type(void) const
OCTINTERP_API ComplexNDArray xcomplex_array_value(const char *fmt,...) const
OCTINTERP_API Complex xcomplex_value(const char *fmt,...) const
OCTINTERP_API double xdouble_value(const char *fmt,...) 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,...)
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.