comparison src/DLD-FUNCTIONS/spparms.cc @ 5893:d73ffe42f2c8

[project @ 2006-07-16 07:48:19 by jwe]
author jwe
date Sun, 16 Jul 2006 07:49:03 +0000
parents 1eb29d3bed2b
children 8b0cfeb06365
comparison
equal deleted inserted replaced
5892:13aa80fc7839 5893:d73ffe42f2c8
89 int nargin = args.length (); 89 int nargin = args.length ();
90 90
91 if (nargin == 0) 91 if (nargin == 0)
92 { 92 {
93 if (nargout == 0) 93 if (nargout == 0)
94 Voctave_sparse_controls.print_info (octave_stdout, ""); 94 octave_sparse_params::print_info (octave_stdout, "");
95 else if (nargout == 1) 95 else if (nargout == 1)
96 retval(0) = Voctave_sparse_controls.get_vals (); 96 retval(0) = octave_sparse_params::get_vals ();
97 else if (nargout == 2) 97 else if (nargout == 2)
98 { 98 {
99 retval (0) = Voctave_sparse_controls.get_keys (); 99 retval (0) = octave_sparse_params::get_keys ();
100 retval (1) = Voctave_sparse_controls.get_vals (); 100 retval (1) = octave_sparse_params::get_vals ();
101 } 101 }
102 else 102 else
103 error ("spparms: too many output arguments"); 103 error ("spparms: too many output arguments");
104 } 104 }
105 else if (nargin == 1) 105 else if (nargin == 1)
110 int len = str.length (); 110 int len = str.length ();
111 for (int i = 0; i < len; i++) 111 for (int i = 0; i < len; i++)
112 str [i] = tolower (str [i]); 112 str [i] = tolower (str [i]);
113 113
114 if (str == "defaults") 114 if (str == "defaults")
115 Voctave_sparse_controls.defaults (); 115 octave_sparse_params::defaults ();
116 else if (str == "tight") 116 else if (str == "tight")
117 Voctave_sparse_controls.tight (); 117 octave_sparse_params::tight ();
118 else 118 else
119 { 119 {
120 double val = Voctave_sparse_controls.get_key (str); 120 double val = octave_sparse_params::get_key (str);
121 if (xisnan (val)) 121 if (xisnan (val))
122 error ("spparams: unrecognized key"); 122 error ("spparams: unrecognized key");
123 else 123 else
124 retval (0) = val; 124 retval (0) = val;
125 } 125 }
131 if (error_state) 131 if (error_state)
132 error ("spparms: input must be a string or a vector"); 132 error ("spparms: input must be a string or a vector");
133 else if (vals.numel () > OCTAVE_SPARSE_CONTROLS_SIZE) 133 else if (vals.numel () > OCTAVE_SPARSE_CONTROLS_SIZE)
134 error ("spparams: too many elements in values vector"); 134 error ("spparams: too many elements in values vector");
135 else 135 else
136 for (int i = 0; i < vals.length (); i++) 136 octave_sparse_params::set_vals (vals);
137 Voctave_sparse_controls (i) = vals (i);
138 } 137 }
139 } 138 }
140 else if (nargin == 2) 139 else if (nargin == 2)
141 { 140 {
142 if (args(0).is_string ()) 141 if (args(0).is_string ())
147 146
148 if (error_state) 147 if (error_state)
149 error ("spparms: second argument must be a real scalar"); 148 error ("spparms: second argument must be a real scalar");
150 else if (str == "umfpack") 149 else if (str == "umfpack")
151 warning ("spparms: request to disable umfpack solvers ignored"); 150 warning ("spparms: request to disable umfpack solvers ignored");
152 else if (!Voctave_sparse_controls.set_key (str, val)) 151 else if (!octave_sparse_params::set_key (str, val))
153 error ("spparms: key not found"); 152 error ("spparms: key not found");
154 } 153 }
155 else 154 else
156 error ("spparms: first argument must be a string"); 155 error ("spparms: first argument must be a string");
157 } 156 }