36 DEFUN (spparms, args, nargout,
38 @deftypefn {Built-in Function} { } spparms ()\n\
39 @deftypefnx {Built-in Function} {@var{vals} =} spparms ()\n\
40 @deftypefnx {Built-in Function} {[@var{keys}, @var{vals}] =} spparms ()\n\
41 @deftypefnx {Built-in Function} {@var{val} =} spparms (@var{key})\n\
42 @deftypefnx {Built-in Function} { } spparms (@var{vals})\n\
43 @deftypefnx {Built-in Function} { } spparms (\"default\")\n\
44 @deftypefnx {Built-in Function} { } spparms (\"tight\")\n\
45 @deftypefnx {Built-in Function} { } spparms (@var{key}, @var{val})\n\
46 Query or set the parameters used by the sparse solvers and factorization\n\
49 The first four calls above get information about the current settings, while\n\
50 the others change the current settings. The parameters are stored as pairs\n\
51 of keys and values, where the values are all floats and the keys are one of\n\
52 the following strings:\n\
56 Printing level of debugging information of the solvers (default 0)\n\
59 Included for compatibility. Not used. (default 1)\n\
62 Included for compatibility. Not used. (default 1)\n\
65 Included for compatibility. Not used. (default 0)\n\
68 Included for compatibility. Not used. (default 3)\n\
71 Included for compatibility. Not used. (default 3)\n\
74 Included for compatibility. Not used. (default 0.5)\n\
77 Flag whether the LU/QR and the '\\' and '/' operators will automatically\n\
78 use the sparsity preserving mmd functions (default 1)\n\
81 Flag whether the LU and the '\\' and '/' operators will automatically\n\
82 use the sparsity preserving amd functions (default 1)\n\
85 The pivot tolerance of the @sc{umfpack} solvers (default 0.1)\n\
88 The pivot tolerance of the @sc{umfpack} symmetric solvers (default 0.001)\n\
91 The density of nonzero elements in a banded matrix before it is treated\n\
92 by the @sc{lapack} banded solvers (default 0.5)\n\
95 Flag whether the @sc{umfpack} or mmd solvers are used for the LU, '\\' and\n\
96 '/' operations (default 1)\n\
99 The value of individual keys can be set with\n\
100 @code{spparms (@var{key}, @var{val})}.\n\
101 The default values can be restored with the special keyword\n\
102 @qcode{\"default\"}. The special keyword @qcode{\"tight\"} can be used to\n\
103 set the mmd solvers to attempt a sparser solution at the potential cost of\n\
104 longer running time.\n\
105 @seealso{chol, colamd, lu, qr, symamd}\n\
109 int nargin = args.
length ();
115 else if (nargout == 1)
117 else if (nargout == 2)
123 error (
"spparms: too many output arguments");
125 else if (nargin == 1)
129 std::string str = args(0).string_value ();
130 int len = str.length ();
131 for (
int i = 0; i < len; i++)
132 str[i] = tolower (str[i]);
134 if (str ==
"defaults" || str ==
"default")
137 static bool warned =
false;
138 if (! warned && str ==
"defaults")
140 warning (
"spparms: use \"default\" instead of \"defaults\"");
145 else if (str ==
"tight")
151 error (
"spparms: KEY not recognized");
158 NDArray vals = args(0).array_value ();
161 error (
"spparms: input must be a string or a vector");
163 error (
"spparms: too many elements in vector VALS");
168 else if (nargin == 2)
172 std::string str = args(0).string_value ();
174 double val = args(1).double_value ();
177 error (
"spparms: second argument must be a real scalar");
178 else if (str ==
"umfpack")
179 warning (
"spparms: request to disable umfpack solvers ignored");
181 error (
"spparms: KEY not found");
184 error (
"spparms: first argument must be a string");
187 error (
"spparms: too many input arguments");
static string_vector get_keys(void)
octave_idx_type numel(void) const
Number of elements in the array.
#define OCTAVE_SPARSE_CONTROLS_SIZE
octave_idx_type length(void) const
#define DEFUN(name, args_name, nargout_name, doc)
void error(const char *fmt,...)
static void print_info(std::ostream &os, const std::string &prefix)
static double get_key(const std::string &key)
static ColumnVector get_vals(void)
bool is_string(void) const
static void defaults(void)
void warning(const char *fmt,...)
static bool set_key(const std::string &key, const double &val)
static bool set_vals(const NDArray &vals)