Mercurial > octave
annotate liboctave/numeric/oct-spparms.cc @ 31249:de6fc38c78c6
Make Jacobian types offered by dlsode.f accessible by lsode (bug #31626).
* liboctave/numeric/LSODE-opts.in: Add options "jacobian type", "lower jacobian
subdiagonals", and "upper jacobian subdiagonals".
* liboctave/numeric/LSODE.cc (file scope, lsode_j,
LSODE::do_integrate (double)): Handle new configurable Jacobian types.
* build-aux/mk-opts.pl: Don't implicitly convert to integer in condition.
author | Olaf Till <olaf.till@uni-jena.de> |
---|---|
date | Fri, 12 Nov 2010 08:53:05 +0100 |
parents | 796f54d4ddbf |
children | e88a07dec498 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
30394
diff
changeset
|
3 // Copyright (C) 1998-2022 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
5164 | 25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21723
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21202
diff
changeset
|
27 # include "config.h" |
5893 | 28 #endif |
29 | |
23475
d691ed308237
maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents:
23457
diff
changeset
|
30 #include <ostream> |
d691ed308237
maint: Clean up #includes in liboctave/numeric directory.
Rik <rik@octave.org>
parents:
23457
diff
changeset
|
31 |
29872
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
32 #include "Array.h" |
5893 | 33 #include "lo-error.h" |
5164 | 34 #include "lo-ieee.h" |
35 #include "oct-spparms.h" | |
13983
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
36 #include "singleton-cleanup.h" |
5164 | 37 |
29872
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
38 namespace octave |
5164 | 39 { |
29872
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
40 sparse_params *sparse_params::s_instance = nullptr; |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
41 |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
42 bool sparse_params::instance_ok (void) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
43 { |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
44 bool retval = true; |
5893 | 45 |
29872
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
46 if (! s_instance) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
47 { |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
48 s_instance = new sparse_params (); |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
49 singleton_cleanup_list::add (cleanup_instance); |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
50 } |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
51 |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
52 return retval; |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
53 } |
5893 | 54 |
29872
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
55 void sparse_params::defaults (void) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
56 { |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
57 if (instance_ok ()) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
58 s_instance->do_defaults (); |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
59 } |
5893 | 60 |
29872
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
61 void sparse_params::tight (void) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
62 { |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
63 if (instance_ok ()) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
64 s_instance->do_tight (); |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
65 } |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
66 |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
67 string_vector sparse_params::get_keys (void) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
68 { |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
69 return instance_ok () ? s_instance->do_get_keys () : string_vector (); |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
70 } |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
71 |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
72 ColumnVector sparse_params::get_vals (void) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
73 { |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
74 return instance_ok () ? s_instance->do_get_vals () : ColumnVector (); |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
75 } |
6460 | 76 |
29872
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
77 bool sparse_params::set_vals (const Array<double>& vals) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
78 { |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
79 return instance_ok () ? s_instance->do_set_vals (vals) : false; |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
80 } |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
81 |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
82 bool sparse_params::set_key (const std::string& key, const double& val) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
83 { |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
84 return instance_ok () ? s_instance->do_set_key (key, val) : false; |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
85 } |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
86 |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
87 double sparse_params::get_key (const std::string& key) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
88 { |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
89 return (instance_ok () |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
90 ? s_instance->do_get_key (key) : numeric_limits<double>::NaN ()); |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
91 } |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
92 |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
93 double sparse_params::get_bandden (void) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
94 { |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
95 return instance_ok () ? s_instance->do_get_bandden () : 0.0; |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
96 } |
5164 | 97 |
29872
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
98 void sparse_params::print_info (std::ostream& os, const std::string& prefix) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
99 { |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
100 if (instance_ok ()) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
101 s_instance->do_print_info (os, prefix); |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
102 } |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
103 |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
104 void sparse_params::do_defaults (void) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
105 { |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
106 m_params(0) = 0; // spumoni |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
107 m_params(1) = 1; // ths_rel |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
108 m_params(2) = 1; // ths_abs |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
109 m_params(3) = 0; // exact_d |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
110 m_params(4) = 3; // supernd |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
111 m_params(5) = 3; // rreduce |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
112 m_params(6) = 0.5; // wh_frac |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
113 m_params(7) = 1; // autommd |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
114 m_params(8) = 1; // autoamd |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
115 m_params(9) = 0.1; // piv_tol |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
116 m_params(10) = 0.5; // bandden |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
117 m_params(11) = 1; // umfpack |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
118 m_params(12) = 0.001; // sym_tol |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
119 } |
5893 | 120 |
29872
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
121 void sparse_params::do_tight (void) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
122 { |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
123 m_params(0) = 0; // spumoni |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
124 m_params(1) = 1; // ths_rel |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
125 m_params(2) = 0; // ths_abs |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
126 m_params(3) = 1; // exact_d |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
127 m_params(4) = 1; // supernd |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
128 m_params(5) = 1; // rreduce |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
129 m_params(6) = 0.5; // wh_frac |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
130 m_params(7) = 1; // autommd |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
131 m_params(8) = 1; // autoamd |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
132 m_params(9) = 0.1; // piv_tol |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
133 m_params(10) = 0.5; // bandden |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
134 m_params(11) = 1; // umfpack |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
135 m_params(12) = 0.001; // sym_tol |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
136 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
137 |
29872
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
138 void sparse_params::init_keys (void) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
139 { |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
140 m_keys(0) = "spumoni"; |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
141 m_keys(1) = "ths_rel"; |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
142 m_keys(2) = "ths_abs"; |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
143 m_keys(3) = "exact_d"; |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
144 m_keys(4) = "supernd"; |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
145 m_keys(5) = "rreduce"; |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
146 m_keys(6) = "wh_frac"; |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
147 m_keys(7) = "autommd"; |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
148 m_keys(8) = "autoamd"; |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
149 m_keys(9) = "piv_tol"; |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
150 m_keys(10) = "bandden"; |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
151 m_keys(11) = "umfpack"; |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
152 m_keys(12) = "sym_tol"; |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
153 } |
5164 | 154 |
29872
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
155 double sparse_params::do_get_bandden (void) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
156 { |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
157 return m_params(10); |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
158 } |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
159 |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
160 bool sparse_params::do_set_vals (const Array<double>& vals) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
161 { |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
162 octave_idx_type len = vals.numel (); |
6460 | 163 |
29872
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
164 if (len > OCTAVE_SPARSE_CONTROLS_SIZE) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
165 (*current_liboctave_error_handler) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
166 ("sparse_params::do_set_vals: too many values"); |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
167 |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
168 for (int i = 0; i < len; i++) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
169 m_params(i) = vals(i); |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
170 |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
171 return true; |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
172 } |
5893 | 173 |
29872
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
174 bool sparse_params::do_set_key (const std::string& key, const double& val) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
175 { |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
176 for (int i = 0; i < OCTAVE_SPARSE_CONTROLS_SIZE; i++) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
177 { |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
178 if (m_keys (i) == key) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
179 { |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
180 m_params(i) = val; |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
181 return true; |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
182 } |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
183 } |
5893 | 184 |
29872
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
185 return false; |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
186 } |
5893 | 187 |
29872
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
188 double sparse_params::do_get_key (const std::string& key) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
189 { |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
190 for (int i = 0; i < OCTAVE_SPARSE_CONTROLS_SIZE; i++) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
191 { |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
192 if (m_keys (i) == key) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
193 return m_params(i); |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
194 } |
5164 | 195 |
29872
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
196 return numeric_limits<double>::NaN (); |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
197 } |
5164 | 198 |
29872
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
199 void sparse_params::do_print_info (std::ostream& os, |
30394
f3f3e3793fb5
maint: style check C++ files in liboctave/ ahead of 7.1 release.
Rik <rik@octave.org>
parents:
29872
diff
changeset
|
200 const std::string& prefix) const |
29872
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
201 { |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
202 for (int i = 0; i < OCTAVE_SPARSE_CONTROLS_SIZE; i++) |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
203 os << prefix << m_keys(i) << ": " << m_params(i) << "\n"; |
df2cdf42a909
update coding style for octave_sparse_params class
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
204 } |
5164 | 205 } |