26 #if defined (HAVE_CONFIG_H)
47 DEFUN (issparse, args, ,
54 if (args.length () != 1)
57 return ovl (args(0).issparse ());
83 DEFUN (sparse, args, ,
175 int nargin = args.length ();
177 if (nargin == 0 || nargin > 6)
189 "sparse: input array cast to double");
200 else if (nargin == 2)
202 octave_idx_type m = args(0).xidx_type_value (
"sparse: M must be a non-negative integer");
203 octave_idx_type n = args(1).xidx_type_value (
"sparse: N must be a non-negative integer");
206 error (
"sparse: dimensions M and N must be non-negative");
210 else if (nargin >= 3)
212 bool summation =
true;
213 if (nargin > 3 && args(nargin-1).is_string ())
215 std::string opt = args(nargin-1).string_value ();
218 else if (opt ==
"sum" || opt ==
"summation")
221 error (
"sparse: invalid option: %s", opt.c_str ());
230 nzmax = args(5).idx_type_value ();
236 m = args(3).xidx_type_value (
"sparse: M must be a non-negative integer");
237 n = args(4).xidx_type_value (
"sparse: N must be a non-negative integer");
240 error (
"sparse: dimensions M and N must be non-negative");
255 "sparse: input array cast to double");
258 i, j,
m,
n, summation, nzmax);
261 i, j,
m,
n, summation, nzmax);
265 i, j,
m,
n, summation, nzmax);
285 DEFUN (spalloc, args, ,
326 int nargin = args.length ();
328 if (nargin < 2 || nargin > 3)
336 nz = args(2).idx_type_value ();
338 if (
m < 0 ||
n < 0 || nz < 0)
339 error (
"spalloc: M, N, and NZ must be non-negative");
364 OCTAVE_END_NAMESPACE(
octave)
Vector representing the dimensions (size) of an Array.
void set_pos_if_unset(octave_idx_type nd_arg, octave_idx_type dim_arg)
boolNDArray bool_array_value(bool warn=false) const
SparseMatrix sparse_matrix_value(bool frc_str_conv=false) const
ComplexNDArray complex_array_value(bool frc_str_conv=false) const
bool is_single_type() const
SparseBoolMatrix sparse_bool_matrix_value(bool warn=false) const
NDArray array_value(bool frc_str_conv=false) const
SparseComplexMatrix sparse_complex_matrix_value(bool frc_str_conv=false) const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void warning_with_id(const char *id, const char *fmt,...)
void() error(const char *fmt,...)
void err_wrong_type_arg(const char *name, const char *s)
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.