annotate liboctave/oct-spparms.cc @ 6460:fa6312d93730

[project @ 2007-03-26 21:23:00 by dbateman]
author dbateman
date Mon, 26 Mar 2007 21:23:00 +0000
parents d73ffe42f2c8
children 93c65f2a5668
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
1 /*
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
2
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
3 Copyright (C) 2004 David Bateman
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
4 Copyright (C) 1998-2004 Andy Adler
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
5
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
6 Octave is free software; you can redistribute it and/or modify it
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
9 later version.
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
10
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
11 Octave is distributed in the hope that it will be useful, but WITHOUT
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
14 for more details.
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
15
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
5307
4c8a2e4e0717 [project @ 2005-04-26 19:24:27 by jwe]
jwe
parents: 5164
diff changeset
17 along with this program; see the file COPYING. If not, write to the
4c8a2e4e0717 [project @ 2005-04-26 19:24:27 by jwe]
jwe
parents: 5164
diff changeset
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
4c8a2e4e0717 [project @ 2005-04-26 19:24:27 by jwe]
jwe
parents: 5164
diff changeset
19 Boston, MA 02110-1301, USA.
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
20
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
21 */
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
22
5893
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
23 #ifdef HAVE_CONFIG_H
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
24 #include <config.h>
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
25 #endif
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
26
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
27 #include "lo-error.h"
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
28 #include "lo-ieee.h"
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
29
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
30 #include "oct-spparms.h"
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
31
5893
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
32 octave_sparse_params *octave_sparse_params::instance = 0;
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
33
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
34 bool
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
35 octave_sparse_params::instance_ok (void)
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
36 {
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
37 bool retval = true;
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
38
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
39 if (! instance)
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
40 instance = new octave_sparse_params ();
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
41
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
42 if (! instance)
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
43 {
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
44 (*current_liboctave_error_handler)
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
45 ("unable to create octave_sparse_params object!");
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
46
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
47 retval = false;
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
48 }
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
49
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
50 return retval;
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
51 }
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
52
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
53 void
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
54 octave_sparse_params::defaults (void)
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
55 {
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
56 if (instance_ok ())
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
57 instance->do_defaults ();
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
58 }
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
59
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
60 void
5893
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
61 octave_sparse_params::tight (void)
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
62 {
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
63 if (instance_ok ())
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
64 instance->do_tight ();
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
65 }
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
66
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
67 string_vector
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
68 octave_sparse_params::get_keys (void)
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
69 {
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
70 return instance_ok () ? instance->do_get_keys () : string_vector ();
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
71 }
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
72
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
73 ColumnVector
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
74 octave_sparse_params::get_vals (void)
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
75 {
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
76 return instance_ok () ? instance->do_get_vals () : ColumnVector ();
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
77 }
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
78
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
79 bool
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
80 octave_sparse_params::set_vals (const NDArray& vals)
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
81 {
5893
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
82 return instance_ok () ? instance->do_set_vals (vals) : false;
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
83 }
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
84
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
85 bool
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
86 octave_sparse_params::set_key (const std::string& key, const double& val)
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
87 {
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
88 return instance_ok () ? instance->do_set_key (key, val) : false;
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
89 }
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
90
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
91 double
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
92 octave_sparse_params::get_key (const std::string& key)
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
93 {
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
94 return instance_ok () ? instance->do_get_key (key) : octave_NaN;
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
95 }
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
96
6460
fa6312d93730 [project @ 2007-03-26 21:23:00 by dbateman]
dbateman
parents: 5893
diff changeset
97 double
fa6312d93730 [project @ 2007-03-26 21:23:00 by dbateman]
dbateman
parents: 5893
diff changeset
98 octave_sparse_params::get_bandden (void)
fa6312d93730 [project @ 2007-03-26 21:23:00 by dbateman]
dbateman
parents: 5893
diff changeset
99 {
fa6312d93730 [project @ 2007-03-26 21:23:00 by dbateman]
dbateman
parents: 5893
diff changeset
100 return instance_ok () ? instance->do_get_bandden () : 0.0;
fa6312d93730 [project @ 2007-03-26 21:23:00 by dbateman]
dbateman
parents: 5893
diff changeset
101 }
fa6312d93730 [project @ 2007-03-26 21:23:00 by dbateman]
dbateman
parents: 5893
diff changeset
102
5893
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
103 void
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
104 octave_sparse_params::print_info (std::ostream& os, const std::string& prefix)
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
105 {
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
106 if (instance_ok ())
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
107 instance->do_print_info (os, prefix);
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
108 }
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
109
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
110 void
5893
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
111 octave_sparse_params::do_defaults (void)
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
112 {
5893
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
113 params(0) = 0; // spumoni
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
114 params(1) = 1; // ths_rel
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
115 params(2) = 1; // ths_abs
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
116 params(3) = 0; // exact_d
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
117 params(4) = 3; // supernd
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
118 params(5) = 3; // rreduce
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
119 params(6) = 0.5; // wh_frac
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
120 params(7) = 1; // autommd
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
121 params(8) = 1; // autoamd
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
122 params(9) = 0.1; // piv_tol
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
123 params(10) = 0.5; // bandden
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
124 params(11) = 1; // umfpack
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
125 }
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
126
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
127 void
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
128 octave_sparse_params::do_tight (void)
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
129 {
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
130 params(0) = 0; // spumoni
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
131 params(1) = 1; // ths_rel
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
132 params(2) = 0; // ths_abs
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
133 params(3) = 1; // exact_d
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
134 params(4) = 1; // supernd
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
135 params(5) = 1; // rreduce
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
136 params(6) = 0.5; // wh_frac
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
137 params(7) = 1; // autommd
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
138 params(8) = 1; // autoamd
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
139 params(9) = 0.1; // piv_tol
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
140 params(10) = 0.5; // bandden
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
141 params(11) = 1; // umfpack
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
142 }
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
143
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
144 void
5893
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
145 octave_sparse_params::init_keys (void)
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
146 {
5893
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
147 keys(0) = "spumoni";
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
148 keys(1) = "ths_rel";
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
149 keys(2) = "ths_abs";
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
150 keys(3) = "exact_d";
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
151 keys(4) = "supernd";
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
152 keys(5) = "rreduce";
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
153 keys(6) = "wh_frac";
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
154 keys(7) = "autommd";
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
155 keys(8) = "autoamd";
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
156 keys(9) = "piv_tol";
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
157 keys(10) = "bandden";
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
158 keys(11) = "umfpack";
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
159 }
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
160
6460
fa6312d93730 [project @ 2007-03-26 21:23:00 by dbateman]
dbateman
parents: 5893
diff changeset
161 double
fa6312d93730 [project @ 2007-03-26 21:23:00 by dbateman]
dbateman
parents: 5893
diff changeset
162 octave_sparse_params::do_get_bandden (void)
fa6312d93730 [project @ 2007-03-26 21:23:00 by dbateman]
dbateman
parents: 5893
diff changeset
163 {
fa6312d93730 [project @ 2007-03-26 21:23:00 by dbateman]
dbateman
parents: 5893
diff changeset
164 return params(10);
fa6312d93730 [project @ 2007-03-26 21:23:00 by dbateman]
dbateman
parents: 5893
diff changeset
165 }
fa6312d93730 [project @ 2007-03-26 21:23:00 by dbateman]
dbateman
parents: 5893
diff changeset
166
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
167 bool
5893
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
168 octave_sparse_params::do_set_vals (const NDArray& vals)
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
169 {
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
170 octave_idx_type len = vals.length ();
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
171
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
172 if (len > OCTAVE_SPARSE_CONTROLS_SIZE)
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
173 {
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
174 (*current_liboctave_error_handler)
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
175 ("octave_sparse_params::do_set_vals: too many values");
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
176
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
177 return false;
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
178 }
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
179 else
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
180 {
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
181 for (int i = 0; i < len; i++)
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
182 params(i) = vals(i);
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
183
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
184 return true;
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
185 }
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
186 }
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
187
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
188 bool
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
189 octave_sparse_params::do_set_key (const std::string& key, const double& val)
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
190 {
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
191 for (int i = 0; i < OCTAVE_SPARSE_CONTROLS_SIZE; i++)
5893
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
192 {
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
193 if (keys (i) == key)
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
194 {
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
195 params(i) = val;
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
196 return true;
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
197 }
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
198 }
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
199
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
200 return false;
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
201 }
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
202
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
203 double
5893
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
204 octave_sparse_params::do_get_key (const std::string& key)
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
205 {
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
206 for (int i = 0; i < OCTAVE_SPARSE_CONTROLS_SIZE; i++)
5893
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
207 {
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
208 if (keys (i) == key)
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
209 return params(i);
5893
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
210 }
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
211
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
212 return octave_NaN;
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
213 }
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
214
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
215 void
5893
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
216 octave_sparse_params::do_print_info (std::ostream& os,
d73ffe42f2c8 [project @ 2006-07-16 07:48:19 by jwe]
jwe
parents: 5307
diff changeset
217 const std::string& prefix) const
5164
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
218 {
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
219 for (int i = 0; i < OCTAVE_SPARSE_CONTROLS_SIZE; i++)
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
220 os << prefix << keys(i) << ": " << params(i) << "\n";
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
221 }
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
222
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
223 /*
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
224 ;;; Local Variables: ***
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
225 ;;; mode: C++ ***
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
226 ;;; End: ***
57077d0ddc8e [project @ 2005-02-25 19:55:24 by jwe]
jwe
parents:
diff changeset
227 */