26#if defined (HAVE_CONFIG_H)
47DEFUN (issparse, args, ,
54 if (args.length () != 1)
57 return ovl (args(0).issparse ());
151 int nargin = args.length ();
153 if (nargin == 0 || nargin > 6)
173 else if (nargin == 2)
181 error (
"sparse: dimensions must be non-negative");
185 else if (nargin >= 3)
187 bool summation =
true;
188 if (nargin > 3 && args(nargin-1).is_string ())
190 std::string opt = args(nargin-1).string_value ();
193 else if (opt ==
"sum" || opt ==
"summation")
196 error (
"sparse: invalid option: %s", opt.c_str ());
205 nzmax = args(5).idx_type_value ();
214 error (
"sparse: dimensions must be non-negative");
224 if (args(2).islogical ())
226 m, n, summation, nzmax);
227 else if (args(2).iscomplex ())
229 i, j, m, n, summation, nzmax);
230 else if (args(2).isnumeric ())
232 m, n, summation, nzmax);
236 catch (index_exception& ie)
239 ie.set_pos_if_unset (2, k+1);
252DEFUN (spalloc, args, ,
293 int nargin = args.length ();
295 if (nargin < 2 || nargin > 3)
303 nz = args(2).idx_type_value ();
305 if (m < 0 || n < 0 || nz < 0)
306 error (
"spalloc: M, N, and NZ must be non-negative");
Vector representing the dimensions (size) of an Array.
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)
class OCTAVE_API SparseMatrix
class OCTAVE_API SparseComplexMatrix
class OCTAVE_API SparseBoolMatrix
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
void get_dimensions(const octave_value &a, const char *warn_for, dim_vector &dim)