5164
|
1 /* |
|
2 |
|
3 Copyright (C) 2004 David Bateman |
|
4 Copyright (C) 1998-2004 Andy Adler |
|
5 |
|
6 Octave is free software; you can redistribute it and/or modify it |
|
7 under the terms of the GNU General Public License as published by the |
|
8 Free Software Foundation; either version 2, or (at your option) any |
|
9 later version. |
|
10 |
|
11 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 for more details. |
|
15 |
|
16 You should have received a copy of the GNU General Public License |
|
17 along with this program; see the file COPYING. If not, write to the Free |
|
18 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
19 |
|
20 */ |
|
21 |
|
22 #include "config.h" |
|
23 #include "lo-ieee.h" |
|
24 |
|
25 #include "oct-spparms.h" |
|
26 |
|
27 SparseParams Voctave_sparse_controls; |
|
28 |
|
29 void |
|
30 SparseParams::defaults (void) |
|
31 { |
|
32 Voctave_sparse_controls (0) = 0; // spumoni |
|
33 Voctave_sparse_controls (1) = 1; // ths_rel |
|
34 Voctave_sparse_controls (2) = 1; // ths_abs |
|
35 Voctave_sparse_controls (3) = 0; // exact_d |
|
36 Voctave_sparse_controls (4) = 3; // supernd |
|
37 Voctave_sparse_controls (5) = 3; // rreduce |
|
38 Voctave_sparse_controls (6) = 0.5; // wh_frac |
|
39 Voctave_sparse_controls (7) = 1; // autommd |
|
40 Voctave_sparse_controls (8) = 1; // autoamd |
|
41 Voctave_sparse_controls (9) = 0.1; // piv_tol |
|
42 Voctave_sparse_controls (10) = 0.5; // bandden |
|
43 Voctave_sparse_controls (11) = 1; // umfpack |
|
44 } |
|
45 |
|
46 void |
|
47 SparseParams::tight (void) |
|
48 { |
|
49 Voctave_sparse_controls (0) = 0; // spumoni |
|
50 Voctave_sparse_controls (1) = 1; // ths_rel |
|
51 Voctave_sparse_controls (2) = 0; // ths_abs |
|
52 Voctave_sparse_controls (3) = 1; // exact_d |
|
53 Voctave_sparse_controls (4) = 1; // supernd |
|
54 Voctave_sparse_controls (5) = 1; // rreduce |
|
55 Voctave_sparse_controls (6) = 0.5; // wh_frac |
|
56 Voctave_sparse_controls (7) = 1; // autommd |
|
57 Voctave_sparse_controls (8) = 1; // autoamd |
|
58 Voctave_sparse_controls (9) = 0.1; // piv_tol |
|
59 Voctave_sparse_controls (10) = 0.5; // bandden |
|
60 Voctave_sparse_controls (11) = 1; // umfpack |
|
61 } |
|
62 |
|
63 void |
|
64 SparseParams::init_keys (void) |
|
65 { |
|
66 keys (0) = "spumoni"; |
|
67 keys (1) = "ths_rel"; |
|
68 keys (2) = "ths_abs"; |
|
69 keys (3) = "exact_d"; |
|
70 keys (4) = "supernd"; |
|
71 keys (5) = "rreduce"; |
|
72 keys (6) = "wh_frac"; |
|
73 keys (7) = "autommd"; |
|
74 keys (8) = "autoamd"; |
|
75 keys (9) = "piv_tol"; |
|
76 keys (10) = "bandden"; |
|
77 keys (11) = "umfpack"; |
|
78 } |
|
79 |
|
80 SparseParams& |
|
81 SparseParams::operator = (const SparseParams& a) |
|
82 { |
|
83 for (int i = 0; i < OCTAVE_SPARSE_CONTROLS_SIZE; i++) |
|
84 params (i) = a.params (i); |
|
85 |
|
86 return *this; |
|
87 } |
|
88 |
|
89 bool |
|
90 SparseParams::set_key (const std::string key, const double& val) |
|
91 { |
|
92 for (int i = 0; i < OCTAVE_SPARSE_CONTROLS_SIZE; i++) |
|
93 if (keys (i) == key) |
|
94 { |
|
95 params(i) = val; |
|
96 return true; |
|
97 } |
|
98 return false; |
|
99 } |
|
100 |
|
101 double |
|
102 SparseParams::get_key (const std::string key) |
|
103 { |
|
104 for (int i = 0; i < OCTAVE_SPARSE_CONTROLS_SIZE; i++) |
|
105 if (keys (i) == key) |
|
106 return params(i); |
|
107 |
|
108 return octave_NaN; |
|
109 } |
|
110 |
|
111 void |
|
112 SparseParams::print_info (std::ostream& os, const std::string& prefix) const |
|
113 { |
|
114 for (int i = 0; i < OCTAVE_SPARSE_CONTROLS_SIZE; i++) |
|
115 os << prefix << keys(i) << ": " << params(i) << "\n"; |
|
116 } |
|
117 |
|
118 /* |
|
119 ;;; Local Variables: *** |
|
120 ;;; mode: C++ *** |
|
121 ;;; End: *** |
|
122 */ |