GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
oct-spparms.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1998-2025 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26#if ! defined (octave_oct_spparms_h)
27#define octave_oct_spparms_h 1
28
29#include "octave-config.h"
30
31#include <iosfwd>
32#include <string>
33
34#include "Array-fwd.h"
35#include "str-vec.h"
36#include "dColVector.h"
37
38#define OCTAVE_SPARSE_CONTROLS_SIZE 13
39
41
43{
44protected:
45
47 : m_params (OCTAVE_SPARSE_CONTROLS_SIZE),
49 {
50 init_keys ();
51 do_defaults ();
52 }
53
54public:
55
56 sparse_params (const sparse_params&) = default;
57
58 sparse_params& operator = (const sparse_params&) = default;
59
60 ~sparse_params () = default;
61
62 static bool instance_ok ();
63
64 static void defaults ();
65
66 static void tight ();
67
68 static string_vector get_keys ();
69
70 static ColumnVector get_vals ();
71
72 static bool set_vals (const Array<double>& vals);
73
74 static bool set_key (const std::string& key, const double& val);
75
76 static double get_key (const std::string& key);
77
78 static double get_bandden ();
79
80 static void print_info (std::ostream& os, const std::string& prefix);
81
82private:
83
84 ColumnVector m_params;
85
86 string_vector m_keys;
87
88 static sparse_params *s_instance;
89
90 static void cleanup_instance ()
91 {
92 delete s_instance;
93 s_instance = nullptr;
94 }
95
96 void do_defaults ();
97
98 void do_tight ();
99
100 string_vector do_get_keys () const { return m_keys; }
101
102 ColumnVector do_get_vals () const { return m_params; }
103
104 bool do_set_vals (const Array<double>& vals);
105
106 bool do_set_key (const std::string& key, const double& val);
107
108 double do_get_key (const std::string& key);
109
110 double do_get_bandden ();
111
112 void do_print_info (std::ostream& os, const std::string& prefix) const;
113
114 void init_keys ();
115};
116
117OCTAVE_END_NAMESPACE(octave)
118
119#endif
N Dimensional Array with copy-on-write semantics.
Definition Array.h:130
sparse_params(const sparse_params &)=default
~sparse_params()=default
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define OCTAVE_API
Definition main.in.cc:55
#define OCTAVE_SPARSE_CONTROLS_SIZE
Definition oct-spparms.h:38