26 #if defined (HAVE_CONFIG_H)
47 DEFUN (issparse, args, ,
54 if (args.length () != 1)
57 return ovl (args(0).issparse ());
81 DEFUN (sparse, args, ,
151 int nargin = args.length ();
153 if (nargin == 0 || nargin > 6)
170 else if (nargin == 2)
178 error (
"sparse: dimensions must be non-negative");
182 else if (nargin >= 3)
184 bool summation =
true;
185 if (nargin > 3 && args(nargin-1).is_string ())
187 std::string opt = args(nargin-1).string_value ();
190 else if (opt ==
"sum" || opt ==
"summation")
193 error (
"sparse: invalid option: %s", opt.c_str ());
202 nzmax = args(5).idx_type_value ();
211 error (
"sparse: dimensions must be non-negative");
221 if (args(2).islogical ())
223 m,
n, summation, nzmax);
224 else if (args(2).iscomplex ())
226 i, j,
m,
n, summation, nzmax);
227 else if (args(2).isnumeric ())
229 m,
n, summation, nzmax);
249 DEFUN (spalloc, args, ,
290 int nargin = args.length ();
292 if (nargin < 2 || nargin > 3)
300 nz = args(2).idx_type_value ();
302 if (
m < 0 ||
n < 0 || nz < 0)
303 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
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 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)