GNU Octave  4.4.1
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) 2004-2018 David Bateman
4 Copyright (C) 1998-2004 Andy Adler
5 
6 This file is part of Octave.
7 
8 Octave is free software: you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12 
13 Octave is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with Octave; see the file COPYING. If not, see
20 <https://www.gnu.org/licenses/>.
21 
22 */
23 
24 #if ! defined (octave_oct_spparms_h)
25 #define octave_oct_spparms_h 1
26 
27 #include "octave-config.h"
28 
29 #include <iosfwd>
30 #include <string>
31 
32 #include "str-vec.h"
33 #include "dColVector.h"
34 
35 class NDArray;
36 
37 #define OCTAVE_SPARSE_CONTROLS_SIZE 13
38 
39 class
40 OCTAVE_API
42 {
43 protected:
44 
46  : params (OCTAVE_SPARSE_CONTROLS_SIZE),
48  {
49  init_keys ();
50  do_defaults ();
51  }
52 
53 public:
54 
56  : params (a.params), keys (a.keys) { }
57 
59  {
60  if (&a != this)
61  {
62  params = a.params;
63  keys = a.keys;
64  }
65 
66  return *this;
67  }
68 
69  ~octave_sparse_params (void) = default;
70 
71  static bool instance_ok (void);
72 
73  static void defaults (void);
74 
75  static void tight (void);
76 
77  static string_vector get_keys (void);
78 
79  static ColumnVector get_vals (void);
80 
81  static bool set_vals (const NDArray& vals);
82 
83  static bool set_key (const std::string& key, const double& val);
84 
85  static double get_key (const std::string& key);
86 
87  static double get_bandden (void);
88 
89  static void print_info (std::ostream& os, const std::string& prefix);
90 
91 private:
92 
94 
96 
98 
99  static void cleanup_instance (void) { delete instance; instance = nullptr; }
100 
101  void do_defaults (void);
102 
103  void do_tight (void);
104 
105  string_vector do_get_keys (void) const { return keys; }
106 
107  ColumnVector do_get_vals (void) const { return params; }
108 
109  bool do_set_vals (const NDArray& vals);
110 
111  bool do_set_key (const std::string& key, const double& val);
112 
113  double do_get_key (const std::string& key);
114 
115  double do_get_bandden (void);
116 
117  void do_print_info (std::ostream& os, const std::string& prefix) const;
118 
119  void init_keys (void);
120 };
121 
122 #endif
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:4986
#define OCTAVE_SPARSE_CONTROLS_SIZE
Definition: oct-spparms.h:37
NDArray & operator=(const NDArray &a)
Definition: dNDArray.h:69
static octave_sparse_params * instance
Definition: oct-spparms.h:97
ColumnVector do_get_vals(void) const
Definition: oct-spparms.h:107
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:400
string_vector do_get_keys(void) const
Definition: oct-spparms.h:105
ColumnVector params
Definition: oct-spparms.h:93
string_vector keys
Definition: oct-spparms.h:95
octave_sparse_params(const octave_sparse_params &a)
Definition: oct-spparms.h:55
void print_info(std::ostream &os, const std::string &prefix) const
Definition: Array.cc:2735
static void cleanup_instance(void)
Definition: oct-spparms.h:99
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:888
octave::stream os
Definition: file-io.cc:627