26 #if defined (HAVE_CONFIG_H)
45 DEFUN (issparse, args, ,
52 if (args.length () != 1)
55 return ovl (args(0).issparse ());
79 DEFUN (sparse, args, ,
147 int nargin = args.length ();
149 if (nargin == 0 || nargin > 6)
171 else if (nargin == 2)
179 error (
"sparse: dimensions must be non-negative");
183 else if (nargin >= 3)
185 bool summation =
true;
186 if (nargin > 3 && args(nargin-1).is_string ())
188 std::string opt = args(nargin-1).string_value ();
191 else if (opt ==
"sum" || opt ==
"summation")
194 error (
"sparse: invalid option: %s", opt.c_str ());
203 nzmax = args(5).idx_type_value ();
212 error (
"sparse: dimensions must be non-negative");
222 if (args(2).islogical ())
224 m,
n, summation, nzmax);
225 else if (args(2).iscomplex ())
227 i, j,
m,
n, summation, nzmax);
228 else if (args(2).isnumeric ())
230 m,
n, summation, nzmax);
250 DEFUN (spalloc, args, ,
291 int nargin = args.length ();
293 if (nargin < 2 || nargin > 3)
301 nz = args(2).idx_type_value ();
303 if (
m < 0 ||
n < 0 || nz < 0)
304 error (
"spalloc: M, N, and NZ must be non-negative");
Vector representing the dimensions (size) of an Array.
void set_pos_if_unset(octave_idx_type nd_arg, octave_idx_type dim_arg)
SparseMatrix sparse_matrix_value(bool frc_str_conv=false) const
bool isnumeric(void) const
SparseBoolMatrix sparse_bool_matrix_value(bool warn=false) const
bool iscomplex(void) const
bool islogical(void) const
SparseComplexMatrix sparse_complex_matrix_value(bool frc_str_conv=false) 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 err_wrong_type_arg(const char *name, const char *s)
void get_dimensions(const octave_value &a, const char *warn_for, dim_vector &dim)
octave_value::octave_value(const Array< char > &chm, char type) return retval
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.