comparison liboctave/oct-spparms.h @ 5893:d73ffe42f2c8

[project @ 2006-07-16 07:48:19 by jwe]
author jwe
date Sun, 16 Jul 2006 07:49:03 +0000
parents 4c8a2e4e0717
children 143b556ce725
comparison
equal deleted inserted replaced
5892:13aa80fc7839 5893:d73ffe42f2c8
28 28
29 #include <iostream> 29 #include <iostream>
30 30
31 #include "str-vec.h" 31 #include "str-vec.h"
32 #include "dColVector.h" 32 #include "dColVector.h"
33 #include "dNDArray.h"
33 34
34 #define OCTAVE_SPARSE_CONTROLS_SIZE 12 35 #define OCTAVE_SPARSE_CONTROLS_SIZE 12
35 36
36 class 37 class
37 SparseParams 38 octave_sparse_params
38 { 39 {
39 public: 40 protected:
40 SparseParams (void) : params (ColumnVector (OCTAVE_SPARSE_CONTROLS_SIZE)), 41
41 keys (string_vector (OCTAVE_SPARSE_CONTROLS_SIZE)) 42 octave_sparse_params (void)
42 { defaults (); init_keys (); } 43 : params (OCTAVE_SPARSE_CONTROLS_SIZE),
44 keys (OCTAVE_SPARSE_CONTROLS_SIZE)
45 {
46 init_keys ();
47 do_defaults ();
48 }
49
50 public:
51
52 static bool instance_ok (void);
53
54 static void defaults (void);
55
56 static void tight (void);
43 57
44 void defaults (void); 58 static string_vector get_keys (void);
45 59
46 void tight (void); 60 static ColumnVector get_vals (void);
47
48 SparseParams& operator = (const SparseParams& a);
49
50 double& operator () (int n) { return params (n); }
51 double operator () (int n) const { return params (n); }
52 61
53 string_vector get_keys (void) const { return keys; } 62 static bool set_vals (const NDArray& vals);
54 63
55 ColumnVector get_vals (void) const { return params; } 64 static bool set_key (const std::string& key, const double& val);
56 65
57 bool set_key (const std::string key, const double& val); 66 static double get_key (const std::string& key);
58 67
59 double get_key (const std::string key); 68 static void print_info (std::ostream& os, const std::string& prefix);
60 69
61 void print_info (std::ostream& os, const std::string& prefix) const; 70 private:
62
63 private:
64 void init_keys (void);
65 71
66 ColumnVector params; 72 ColumnVector params;
67 73
68 string_vector keys; 74 string_vector keys;
75
76 static octave_sparse_params *instance;
77
78 void do_defaults (void);
79
80 void do_tight (void);
81
82 string_vector do_get_keys (void) const { return keys; }
83
84 ColumnVector do_get_vals (void) const { return params; }
85
86 bool do_set_vals (const NDArray& vals);
87
88 bool do_set_key (const std::string& key, const double& val);
89
90 double do_get_key (const std::string& key);
91
92 void do_print_info (std::ostream& os, const std::string& prefix) const;
93
94 void init_keys (void);
69 }; 95 };
70
71 extern SparseParams Voctave_sparse_controls;
72 96
73 #endif 97 #endif
74 98
75 /* 99 /*
76 ;;; Local Variables: *** 100 ;;; Local Variables: ***