GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
oct-spparms.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1998-2021 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 "str-vec.h"
35 #include "dColVector.h"
36 
37 class NDArray;
38 
39 #define OCTAVE_SPARSE_CONTROLS_SIZE 13
40 
41 class
42 OCTAVE_API
44 {
45 protected:
46 
48  : params (OCTAVE_SPARSE_CONTROLS_SIZE),
50  {
51  init_keys ();
52  do_defaults ();
53  }
54 
55 public:
56 
58  : params (a.params), keys (a.keys) { }
59 
61  {
62  if (&a != this)
63  {
64  params = a.params;
65  keys = a.keys;
66  }
67 
68  return *this;
69  }
70 
71  ~octave_sparse_params (void) = default;
72 
73  static bool instance_ok (void);
74 
75  static void defaults (void);
76 
77  static void tight (void);
78 
79  static string_vector get_keys (void);
80 
81  static ColumnVector get_vals (void);
82 
83  static bool set_vals (const NDArray& vals);
84 
85  static bool set_key (const std::string& key, const double& val);
86 
87  static double get_key (const std::string& key);
88 
89  static double get_bandden (void);
90 
91  static void print_info (std::ostream& os, const std::string& prefix);
92 
93 private:
94 
96 
98 
100 
101  static void cleanup_instance (void) { delete instance; instance = nullptr; }
102 
103  void do_defaults (void);
104 
105  void do_tight (void);
106 
107  string_vector do_get_keys (void) const { return keys; }
108 
109  ColumnVector do_get_vals (void) const { return params; }
110 
111  bool do_set_vals (const NDArray& vals);
112 
113  bool do_set_key (const std::string& key, const double& val);
114 
115  double do_get_key (const std::string& key);
116 
117  double do_get_bandden (void);
118 
119  void do_print_info (std::ostream& os, const std::string& prefix) const;
120 
121  void init_keys (void);
122 };
123 
124 #endif
void print_info(std::ostream &os, const std::string &prefix) const
Definition: Array.cc:2734
NDArray & operator=(const NDArray &a)
Definition: dNDArray.h:72
string_vector do_get_keys(void) const
Definition: oct-spparms.h:107
octave_sparse_params(const octave_sparse_params &a)
Definition: oct-spparms.h:57
static octave_sparse_params * instance
Definition: oct-spparms.h:99
static void cleanup_instance(void)
Definition: oct-spparms.h:101
string_vector keys
Definition: oct-spparms.h:97
ColumnVector do_get_vals(void) const
Definition: oct-spparms.h:109
~octave_sparse_params(void)=default
ColumnVector params
Definition: oct-spparms.h:95
#define OCTAVE_SPARSE_CONTROLS_SIZE
Definition: oct-spparms.h:39