Mercurial > octave
annotate liboctave/numeric/oct-spparms.h @ 23220:092078913d54
maint: Merge stable to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 22 Feb 2017 12:58:07 -0500 |
parents | ef4d915df748 3ac9f9ecfae5 |
children | d691ed308237 |
rev | line source |
---|---|
5164 | 1 /* |
2 | |
23219
3ac9f9ecfae5
maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents:
23083
diff
changeset
|
3 Copyright (C) 2004-2017 David Bateman |
11523 | 4 Copyright (C) 1998-2004 Andy Adler |
7016 | 5 |
6 This file is part of Octave. | |
5164 | 7 |
8 Octave is free software; you can redistribute it and/or modify it | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
9 under the terms of the GNU General Public License as published by |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
10 the Free Software Foundation; either version 3 of the License, or |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
11 (at your option) any later version. |
5164 | 12 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
13 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
14 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
16 GNU General Public License for more details. |
5164 | 17 |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
5164 | 21 |
22 */ | |
23 | |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
24 #if ! defined (octave_oct_spparms_h) |
5164 | 25 #define octave_oct_spparms_h 1 |
26 | |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
27 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
28 |
5164 | 29 #include <cassert> |
30 #include <cstddef> | |
31 | |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
32 #include <iosfwd> |
5164 | 33 |
34 #include "str-vec.h" | |
35 #include "dColVector.h" | |
5893 | 36 #include "dNDArray.h" |
5164 | 37 |
7515
f3c00dc0912b
Eliminate the rest of the dispatched sparse functions
David Bateman <dbateman@free.fr>
parents:
7017
diff
changeset
|
38 #define OCTAVE_SPARSE_CONTROLS_SIZE 13 |
5164 | 39 |
40 class | |
6108 | 41 OCTAVE_API |
5893 | 42 octave_sparse_params |
5164 | 43 { |
5893 | 44 protected: |
5164 | 45 |
5893 | 46 octave_sparse_params (void) |
47 : params (OCTAVE_SPARSE_CONTROLS_SIZE), | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
48 keys (OCTAVE_SPARSE_CONTROLS_SIZE) |
5893 | 49 { |
50 init_keys (); | |
51 do_defaults (); | |
52 } | |
53 | |
54 public: | |
55 | |
6482 | 56 octave_sparse_params (const octave_sparse_params& a) |
57 : params (a.params), keys (a.keys) { } | |
58 | |
59 octave_sparse_params& operator = (const octave_sparse_params& a) | |
60 { | |
61 if (&a != this) | |
62 { | |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
63 params = a.params; |
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10158
diff
changeset
|
64 keys = a.keys; |
6482 | 65 } |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
66 |
6482 | 67 return *this; |
68 } | |
69 | |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
70 ~octave_sparse_params (void) = default; |
6482 | 71 |
5893 | 72 static bool instance_ok (void); |
73 | |
74 static void defaults (void); | |
75 | |
76 static void tight (void); | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
77 |
5893 | 78 static string_vector get_keys (void); |
5164 | 79 |
5893 | 80 static ColumnVector get_vals (void); |
5164 | 81 |
5893 | 82 static bool set_vals (const NDArray& vals); |
5164 | 83 |
5893 | 84 static bool set_key (const std::string& key, const double& val); |
5164 | 85 |
5893 | 86 static double get_key (const std::string& key); |
5164 | 87 |
6460 | 88 static double get_bandden (void); |
89 | |
5893 | 90 static void print_info (std::ostream& os, const std::string& prefix); |
91 | |
92 private: | |
5164 | 93 |
94 ColumnVector params; | |
95 | |
96 string_vector keys; | |
5893 | 97 |
98 static octave_sparse_params *instance; | |
99 | |
13983
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
100 static void cleanup_instance (void) { delete instance; instance = 0; } |
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
101 |
5893 | 102 void do_defaults (void); |
103 | |
104 void do_tight (void); | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
105 |
5893 | 106 string_vector do_get_keys (void) const { return keys; } |
107 | |
108 ColumnVector do_get_vals (void) const { return params; } | |
5164 | 109 |
5893 | 110 bool do_set_vals (const NDArray& vals); |
111 | |
112 bool do_set_key (const std::string& key, const double& val); | |
113 | |
114 double do_get_key (const std::string& key); | |
115 | |
6460 | 116 double do_get_bandden (void); |
117 | |
5893 | 118 void do_print_info (std::ostream& os, const std::string& prefix) const; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
119 |
5893 | 120 void init_keys (void); |
121 }; | |
5164 | 122 |
123 #endif |