comparison liboctave/sparse-base-chol.h @ 11505:9a308e96194e

more data member initialization fixes
author John W. Eaton <jwe@octave.org>
date Thu, 13 Jan 2011 03:57:11 -0500
parents cbc402e64d83
children fd0a3ac60b0e
comparison
equal deleted inserted replaced
11504:81ff63e43f54 11505:9a308e96194e
34 protected: 34 protected:
35 #ifdef HAVE_CHOLMOD 35 #ifdef HAVE_CHOLMOD
36 class sparse_base_chol_rep 36 class sparse_base_chol_rep
37 { 37 {
38 public: 38 public:
39 sparse_base_chol_rep (void) : count (1), Lsparse (0), 39 sparse_base_chol_rep (void)
40 is_pd (false), minor_p (0) { } 40 : count (1), Lsparse (0), Common (), is_pd (false), minor_p (0),
41 41 perms (), cond (0)
42 sparse_base_chol_rep (const chol_type& a, 42 { }
43 const bool natural) : count (1) 43
44 { init (a, natural); } 44 sparse_base_chol_rep (const chol_type& a, const bool natural)
45 : count (1), Lsparse (0), Common (), is_pd (false), minor_p (0),
46 perms (), cond (0)
47 {
48 init (a, natural);
49 }
45 50
46 sparse_base_chol_rep (const chol_type& a, octave_idx_type& info, 51 sparse_base_chol_rep (const chol_type& a, octave_idx_type& info,
47 const bool natural) : count (1) 52 const bool natural)
48 { info = init (a, natural); } 53 : count (1), Lsparse (0), Common (), is_pd (false), minor_p (0),
54 perms (), cond (0)
55 {
56 info = init (a, natural);
57 }
49 58
50 ~sparse_base_chol_rep (void) 59 ~sparse_base_chol_rep (void)
51 { if (is_pd) CHOLMOD_NAME(free_sparse) (&Lsparse, &Common); } 60 {
61 if (is_pd)
62 CHOLMOD_NAME (free_sparse) (&Lsparse, &Common);
63 }
52 64
53 cholmod_sparse * L (void) const { return Lsparse; } 65 cholmod_sparse * L (void) const { return Lsparse; }
54 66
55 octave_idx_type P (void) const 67 octave_idx_type P (void) const
56 { return (minor_p == static_cast<octave_idx_type>(Lsparse->ncol) ? 68 {
57 0 : minor_p + 1); } 69 return (minor_p == static_cast<octave_idx_type>(Lsparse->ncol) ?
70 0 : minor_p + 1);
71 }
58 72
59 ColumnVector perm (void) const { return perms + 1; } 73 ColumnVector perm (void) const { return perms + 1; }
60 74
61 p_type Q (void) const; 75 p_type Q (void) const;
62 76
88 }; 102 };
89 #else 103 #else
90 class sparse_base_chol_rep 104 class sparse_base_chol_rep
91 { 105 {
92 public: 106 public:
93 sparse_base_chol_rep (void) : count (1), is_pd (false), minor_p (0) { } 107 sparse_base_chol_rep (void)
108 : count (1), is_pd (false), minor_p (0), perms (), cond (0) { }
94 109
95 sparse_base_chol_rep (const chol_type& a, 110 sparse_base_chol_rep (const chol_type& a,
96 const bool natural) : count (1) 111 const bool natural)
112 : count (1), is_pd (false), minor_p (0), perms (), cond (0)
97 { init (a, natural); } 113 { init (a, natural); }
98 114
99 sparse_base_chol_rep (const chol_type& a, octave_idx_type& info, 115 sparse_base_chol_rep (const chol_type& a, octave_idx_type& info,
100 const bool natural) : count (1) 116 const bool natural)
117 : count (1), is_pd (false), minor_p (0), perms (), cond (0)
101 { info = init (a, natural); } 118 { info = init (a, natural); }
102 119
103 ~sparse_base_chol_rep (void) { } 120 ~sparse_base_chol_rep (void) { }
104 121
105 octave_idx_type P (void) const { return 0; } 122 octave_idx_type P (void) const { return 0; }
133 private: 150 private:
134 sparse_base_chol_rep *rep; 151 sparse_base_chol_rep *rep;
135 152
136 public: 153 public:
137 154
138 sparse_base_chol (void) : rep (new typename 155 sparse_base_chol (void)
139 sparse_base_chol<chol_type, chol_elt, p_type>::sparse_base_chol_rep ()) { } 156 : rep (new typename
140 157 sparse_base_chol<chol_type, chol_elt, p_type>::sparse_base_chol_rep ())
141 sparse_base_chol (const chol_type& a, const bool n) : rep (new typename 158 { }
142 sparse_base_chol<chol_type, chol_elt, p_type>:: 159
143 sparse_base_chol_rep (a, n)) { } 160 sparse_base_chol (const chol_type& a, const bool n)
144 161 : rep (new typename
145 sparse_base_chol (const chol_type& a, octave_idx_type& info, const bool n) : 162 sparse_base_chol<chol_type, chol_elt, p_type>::sparse_base_chol_rep (a, n))
146 rep (new typename sparse_base_chol<chol_type, chol_elt, p_type>:: 163 { }
147 sparse_base_chol_rep (a, info, n)) { } 164
148 165 sparse_base_chol (const chol_type& a, octave_idx_type& info, const bool n)
149 sparse_base_chol (const sparse_base_chol<chol_type, chol_elt, p_type>& a) : 166 : rep (new typename sparse_base_chol<chol_type, chol_elt, p_type>::sparse_base_chol_rep (a, info, n))
150 rep (a.rep) { rep->count++; } 167 { }
151 168
152 ~sparse_base_chol (void) 169 sparse_base_chol (const sparse_base_chol<chol_type, chol_elt, p_type>& a)
170 : rep (a.rep)
171 { rep->count++; }
172
173 virtual ~sparse_base_chol (void)
153 { 174 {
154 if (--rep->count <= 0) 175 if (--rep->count <= 0)
155 delete rep; 176 delete rep;
156 } 177 }
157 178