24 #if defined (HAVE_CONFIG_H) 45 template <
typename ArrayType>
48 int nargout,
int dim,
bool ismin)
51 ArrayType
array = octave_value_extract<ArrayType> (
arg);
85 int nargout,
int dim,
bool ismin)
115 int nargout,
int dim,
bool ismin)
126 if (
array.isempty ())
153 template <
typename ArrayType>
158 typedef typename ArrayType::element_type ScalarType;
164 ScalarType
x = octave_value_extract<ScalarType> (argx);
165 ArrayType
y = octave_value_extract<ArrayType> (argy);
174 ArrayType
x = octave_value_extract<ArrayType> (argx);
175 ScalarType
y = octave_value_extract<ScalarType> (argy);
184 ArrayType
x = octave_value_extract<ArrayType> (argx);
185 ArrayType
y = octave_value_extract<ArrayType> (argy);
218 else if (
y.numel () == 1)
227 else if (
y.numel () == 1)
247 const char *func = (ismin ?
"min" :
"max");
255 dim = args(2).int_value (
true) - 1;
258 error (
"%s: DIM must be a valid dimension", func);
261 warning (
"%s: second argument is ignored", func);
271 if (
range.numel () < 1)
281 retval(1) =
static_cast<double> 288 retval(1) =
static_cast<double> 325 #define MAKE_INT_BRANCH(X) \ 327 retval = do_minmax_red_op<X ## NDArray> (arg, nargout, dim, ismin); \ 339 #undef MAKE_INT_BRANCH 371 retval = do_minmax_bin_op<SparseMatrix> (argx, argy, ismin);
373 retval = do_minmax_bin_op<NDArray> (argx, argy, ismin);
382 retval = do_minmax_bin_op<SparseComplexMatrix> (argx, argy,
385 retval = do_minmax_bin_op<ComplexNDArray> (argx, argy, ismin);
390 retval = do_minmax_bin_op<FloatNDArray> (argx, argy, ismin);
394 retval = do_minmax_bin_op<FloatComplexNDArray> (argx, argy, ismin);
401 #define MAKE_INT_BRANCH(X) \ 403 retval = do_minmax_bin_op<X ## NDArray> (argx, argy, ismin); \ 415 #undef MAKE_INT_BRANCH 423 error (
"%s: cannot compute %s (%s, %s)", func, func,
424 argx.type_name ().c_str (), argy.type_name ().c_str ());
882 template <
typename ArrayType>
885 int nargout,
int dim,
bool ismin)
888 ArrayType
array = octave_value_extract<ArrayType> (
arg);
921 const char *func = (ismin ?
"cummin" :
"cummax");
927 dim = args(1).int_value (
true) - 1;
930 error (
"%s: DIM must be a valid dimension", func);
955 #define MAKE_INT_BRANCH(X) \ 957 retval = do_cumminmax_red_op<X ## NDArray> (arg, nargout, dim, ismin); \ 969 #undef MAKE_INT_BRANCH 1019 return do_cumminmax_body (args,
nargout,
true);
1074 return do_cumminmax_body (args,
nargout,
false);
Range range_value(void) 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,...)
octave_value resize(const dim_vector &dv, bool fill=false) const
octave_value_list do_minmax_red_op< boolNDArray >(const octave_value &arg, int nargout, int dim, bool ismin)
then the function must return scalars which will be concatenated into the return array(s). If code
builtin_type_t btyp_mixed_numeric(builtin_type_t x, builtin_type_t y)
Determine the resulting type for a possible mixed-type operation.
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
static octave_value_list do_minmax_body(const octave_value_list &args, int nargout, bool ismin)
static octave_value do_minmax_bin_op(const octave_value &argx, const octave_value &argy, bool ismin)
bool issparse(void) const
charNDArray octave_value_extract< charNDArray >(const octave_value &v)
static octave_value_list do_minmax_red_op(const octave_value &arg, int nargout, int dim, bool ismin)
void err_wrong_type_arg(const char *name, const char *s)
#define MAKE_INT_BRANCH(X)
void warning(const char *fmt,...)
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
charNDArray max(char d, const charNDArray &m)
builtin_type_t builtin_type(void) const
boolNDArray bool_array_value(bool warn=false) const
octave_idx_type length(void) const
the element is set to zero In other the statement xample y
octave_value do_minmax_bin_op< charNDArray >(const octave_value &argx, const octave_value &argy, bool ismin)
SparseBoolMatrix sparse_bool_matrix_value(bool warn=false) const
OCTAVE_EXPORT octave_value_list or cell arrays Arguments are concatenated vertically The returned values are padded with blanks as needed to make each row of the string array have the same length Empty input strings are significant and will concatenated in the output For numerical each element is converted to the corresponding ASCII character A range error results if an input is outside the ASCII range(0-255). For cell arrays
bool is_range(void) const
octave_idx_type length(void) const
octave_value_list do_minmax_red_op< charNDArray >(const octave_value &arg, int nargout, int dim, bool ismin)
bool is_scalar_type(void) const
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
charNDArray min(char d, const charNDArray &m)