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 |
5307
|
17 along with this program; see the file COPYING. If not, write to the |
|
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
19 Boston, MA 02110-1301, USA. |
5164
|
20 |
|
21 */ |
|
22 |
|
23 #include "config.h" |
|
24 #include "lo-ieee.h" |
|
25 |
|
26 #include "oct-spparms.h" |
|
27 |
|
28 SparseParams Voctave_sparse_controls; |
|
29 |
|
30 void |
|
31 SparseParams::defaults (void) |
|
32 { |
|
33 Voctave_sparse_controls (0) = 0; // spumoni |
|
34 Voctave_sparse_controls (1) = 1; // ths_rel |
|
35 Voctave_sparse_controls (2) = 1; // ths_abs |
|
36 Voctave_sparse_controls (3) = 0; // exact_d |
|
37 Voctave_sparse_controls (4) = 3; // supernd |
|
38 Voctave_sparse_controls (5) = 3; // rreduce |
|
39 Voctave_sparse_controls (6) = 0.5; // wh_frac |
|
40 Voctave_sparse_controls (7) = 1; // autommd |
|
41 Voctave_sparse_controls (8) = 1; // autoamd |
|
42 Voctave_sparse_controls (9) = 0.1; // piv_tol |
|
43 Voctave_sparse_controls (10) = 0.5; // bandden |
|
44 Voctave_sparse_controls (11) = 1; // umfpack |
|
45 } |
|
46 |
|
47 void |
|
48 SparseParams::tight (void) |
|
49 { |
|
50 Voctave_sparse_controls (0) = 0; // spumoni |
|
51 Voctave_sparse_controls (1) = 1; // ths_rel |
|
52 Voctave_sparse_controls (2) = 0; // ths_abs |
|
53 Voctave_sparse_controls (3) = 1; // exact_d |
|
54 Voctave_sparse_controls (4) = 1; // supernd |
|
55 Voctave_sparse_controls (5) = 1; // rreduce |
|
56 Voctave_sparse_controls (6) = 0.5; // wh_frac |
|
57 Voctave_sparse_controls (7) = 1; // autommd |
|
58 Voctave_sparse_controls (8) = 1; // autoamd |
|
59 Voctave_sparse_controls (9) = 0.1; // piv_tol |
|
60 Voctave_sparse_controls (10) = 0.5; // bandden |
|
61 Voctave_sparse_controls (11) = 1; // umfpack |
|
62 } |
|
63 |
|
64 void |
|
65 SparseParams::init_keys (void) |
|
66 { |
|
67 keys (0) = "spumoni"; |
|
68 keys (1) = "ths_rel"; |
|
69 keys (2) = "ths_abs"; |
|
70 keys (3) = "exact_d"; |
|
71 keys (4) = "supernd"; |
|
72 keys (5) = "rreduce"; |
|
73 keys (6) = "wh_frac"; |
|
74 keys (7) = "autommd"; |
|
75 keys (8) = "autoamd"; |
|
76 keys (9) = "piv_tol"; |
|
77 keys (10) = "bandden"; |
|
78 keys (11) = "umfpack"; |
|
79 } |
|
80 |
|
81 SparseParams& |
|
82 SparseParams::operator = (const SparseParams& a) |
|
83 { |
|
84 for (int i = 0; i < OCTAVE_SPARSE_CONTROLS_SIZE; i++) |
|
85 params (i) = a.params (i); |
|
86 |
|
87 return *this; |
|
88 } |
|
89 |
|
90 bool |
|
91 SparseParams::set_key (const std::string key, const double& val) |
|
92 { |
|
93 for (int i = 0; i < OCTAVE_SPARSE_CONTROLS_SIZE; i++) |
|
94 if (keys (i) == key) |
|
95 { |
|
96 params(i) = val; |
|
97 return true; |
|
98 } |
|
99 return false; |
|
100 } |
|
101 |
|
102 double |
|
103 SparseParams::get_key (const std::string key) |
|
104 { |
|
105 for (int i = 0; i < OCTAVE_SPARSE_CONTROLS_SIZE; i++) |
|
106 if (keys (i) == key) |
|
107 return params(i); |
|
108 |
|
109 return octave_NaN; |
|
110 } |
|
111 |
|
112 void |
|
113 SparseParams::print_info (std::ostream& os, const std::string& prefix) const |
|
114 { |
|
115 for (int i = 0; i < OCTAVE_SPARSE_CONTROLS_SIZE; i++) |
|
116 os << prefix << keys(i) << ": " << params(i) << "\n"; |
|
117 } |
|
118 |
|
119 /* |
|
120 ;;; Local Variables: *** |
|
121 ;;; mode: C++ *** |
|
122 ;;; End: *** |
|
123 */ |