Mercurial > octave
comparison libinterp/octave-value/ov-base-mat.h @ 31138:b3ca7f891750
maint: use "m_" prefix for member variables in class octave_base_matrix.
* ov-base-int.cc, ov-base-mat.cc, ov-base-mat.h, ov-base.h, ov-bool-mat.cc,
ov-bool-mat.h, ov-cell.cc, ov-cell.h, ov-ch-mat.cc, ov-ch-mat.h, ov-cx-mat.cc,
ov-cx-mat.h, ov-flt-cx-mat.cc, ov-flt-cx-mat.h, ov-flt-re-mat.cc,
ov-flt-re-mat.h, ov-intx.h, ov-re-mat.cc, ov-re-mat.h, ov-str-mat.cc,
ov-str-mat.h:
use "m_" prefix for member variables in class octave_base_matrix.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 10 Jul 2022 18:26:24 -0700 |
parents | 796f54d4ddbf |
children | aac27ad79be6 |
comparison
equal
deleted
inserted
replaced
31137:6308ce73bdca | 31138:b3ca7f891750 |
---|---|
52 public: | 52 public: |
53 | 53 |
54 typedef MT object_type; | 54 typedef MT object_type; |
55 | 55 |
56 octave_base_matrix (void) | 56 octave_base_matrix (void) |
57 : octave_base_value (), matrix (), typ (), idx_cache () { } | 57 : octave_base_value (), m_matrix (), m_typ (), m_idx_cache () { } |
58 | 58 |
59 octave_base_matrix (const MT& m, const MatrixType& t = MatrixType ()) | 59 octave_base_matrix (const MT& m, const MatrixType& t = MatrixType ()) |
60 : octave_base_value (), matrix (m), | 60 : octave_base_value (), m_matrix (m), |
61 typ (t.is_known () ? new MatrixType (t) : nullptr), idx_cache () | 61 m_typ (t.is_known () ? new MatrixType (t) : nullptr), m_idx_cache () |
62 { | 62 { |
63 if (matrix.ndims () == 0) | 63 if (m_matrix.ndims () == 0) |
64 matrix.resize (dim_vector (0, 0)); | 64 m_matrix.resize (dim_vector (0, 0)); |
65 } | 65 } |
66 | 66 |
67 octave_base_matrix (const octave_base_matrix& m) | 67 octave_base_matrix (const octave_base_matrix& m) |
68 : octave_base_value (), matrix (m.matrix), | 68 : octave_base_value (), m_matrix (m.m_matrix), |
69 typ (m.typ ? new MatrixType (*m.typ) : nullptr), | 69 m_typ (m.m_typ ? new MatrixType (*m.m_typ) : nullptr), |
70 idx_cache (m.idx_cache ? new octave::idx_vector (*m.idx_cache) : nullptr) | 70 m_idx_cache (m.m_idx_cache ? new octave::idx_vector (*m.m_idx_cache) |
71 : nullptr) | |
71 { } | 72 { } |
72 | 73 |
73 ~octave_base_matrix (void) { clear_cached_info (); } | 74 ~octave_base_matrix (void) { clear_cached_info (); } |
74 | 75 |
75 std::size_t byte_size (void) const { return matrix.byte_size (); } | 76 std::size_t byte_size (void) const { return m_matrix.byte_size (); } |
76 | 77 |
77 octave_value squeeze (void) const { return MT (matrix.squeeze ()); } | 78 octave_value squeeze (void) const { return MT (m_matrix.squeeze ()); } |
78 | 79 |
79 octave_value full_value (void) const { return matrix; } | 80 octave_value full_value (void) const { return m_matrix; } |
80 | 81 |
81 void maybe_economize (void) { matrix.maybe_economize (); } | 82 void maybe_economize (void) { m_matrix.maybe_economize (); } |
82 | 83 |
83 // We don't need to override all three forms of subsref. The using | 84 // We don't need to override all three forms of subsref. The using |
84 // declaration will avoid warnings about partially-overloaded virtual | 85 // declaration will avoid warnings about partially-overloaded virtual |
85 // functions. | 86 // functions. |
86 using octave_base_value::subsref; | 87 using octave_base_value::subsref; |
111 OCTINTERP_API void | 112 OCTINTERP_API void |
112 assign (const octave_value_list& idx, typename MT::element_type rhs); | 113 assign (const octave_value_list& idx, typename MT::element_type rhs); |
113 | 114 |
114 OCTINTERP_API void delete_elements (const octave_value_list& idx); | 115 OCTINTERP_API void delete_elements (const octave_value_list& idx); |
115 | 116 |
116 dim_vector dims (void) const { return matrix.dims (); } | 117 dim_vector dims (void) const { return m_matrix.dims (); } |
117 | 118 |
118 octave_idx_type numel (void) const { return matrix.numel (); } | 119 octave_idx_type numel (void) const { return m_matrix.numel (); } |
119 | 120 |
120 int ndims (void) const { return matrix.ndims (); } | 121 int ndims (void) const { return m_matrix.ndims (); } |
121 | 122 |
122 octave_idx_type nnz (void) const { return matrix.nnz (); } | 123 octave_idx_type nnz (void) const { return m_matrix.nnz (); } |
123 | 124 |
124 octave_value reshape (const dim_vector& new_dims) const | 125 octave_value reshape (const dim_vector& new_dims) const |
125 { return MT (matrix.reshape (new_dims)); } | 126 { return MT (m_matrix.reshape (new_dims)); } |
126 | 127 |
127 octave_value permute (const Array<int>& vec, bool inv = false) const | 128 octave_value permute (const Array<int>& vec, bool inv = false) const |
128 { return MT (matrix.permute (vec, inv)); } | 129 { return MT (m_matrix.permute (vec, inv)); } |
129 | 130 |
130 octave_value resize (const dim_vector& dv, bool fill = false) const; | 131 octave_value resize (const dim_vector& dv, bool fill = false) const; |
131 | 132 |
132 octave_value all (int dim = 0) const { return matrix.all (dim); } | 133 octave_value all (int dim = 0) const { return m_matrix.all (dim); } |
133 octave_value any (int dim = 0) const { return matrix.any (dim); } | 134 octave_value any (int dim = 0) const { return m_matrix.any (dim); } |
134 | 135 |
135 MatrixType matrix_type (void) const { return typ ? *typ : MatrixType (); } | 136 MatrixType matrix_type (void) const { return m_typ ? *m_typ : MatrixType (); } |
136 MatrixType matrix_type (const MatrixType& _typ) const; | 137 MatrixType matrix_type (const MatrixType& _typ) const; |
137 | 138 |
138 octave_value diag (octave_idx_type k = 0) const | 139 octave_value diag (octave_idx_type k = 0) const |
139 { return octave_value (matrix.diag (k)); } | 140 { return octave_value (m_matrix.diag (k)); } |
140 | 141 |
141 octave_value diag (octave_idx_type m, octave_idx_type n) const | 142 octave_value diag (octave_idx_type m, octave_idx_type n) const |
142 { return octave_value (matrix.diag (m, n)); } | 143 { return octave_value (m_matrix.diag (m, n)); } |
143 | 144 |
144 octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const | 145 octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const |
145 { return octave_value (matrix.sort (dim, mode)); } | 146 { return octave_value (m_matrix.sort (dim, mode)); } |
146 octave_value sort (Array<octave_idx_type>& sidx, octave_idx_type dim = 0, | 147 octave_value sort (Array<octave_idx_type>& sidx, octave_idx_type dim = 0, |
147 sortmode mode = ASCENDING) const | 148 sortmode mode = ASCENDING) const |
148 { return octave_value (matrix.sort (sidx, dim, mode)); } | 149 { return octave_value (m_matrix.sort (sidx, dim, mode)); } |
149 | 150 |
150 sortmode issorted (sortmode mode = UNSORTED) const | 151 sortmode issorted (sortmode mode = UNSORTED) const |
151 { return matrix.issorted (mode); } | 152 { return m_matrix.issorted (mode); } |
152 | 153 |
153 Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const | 154 Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const |
154 { return matrix.sort_rows_idx (mode); } | 155 { return m_matrix.sort_rows_idx (mode); } |
155 | 156 |
156 sortmode is_sorted_rows (sortmode mode = UNSORTED) const | 157 sortmode is_sorted_rows (sortmode mode = UNSORTED) const |
157 { return matrix.is_sorted_rows (mode); } | 158 { return m_matrix.is_sorted_rows (mode); } |
158 | 159 |
159 bool is_matrix_type (void) const { return true; } | 160 bool is_matrix_type (void) const { return true; } |
160 | 161 |
161 bool isnumeric (void) const { return true; } | 162 bool isnumeric (void) const { return true; } |
162 | 163 |
182 octave_idx_type i, octave_idx_type j) const; | 183 octave_idx_type i, octave_idx_type j) const; |
183 | 184 |
184 MT& matrix_ref (void) | 185 MT& matrix_ref (void) |
185 { | 186 { |
186 clear_cached_info (); | 187 clear_cached_info (); |
187 return matrix; | 188 return m_matrix; |
188 } | 189 } |
189 | 190 |
190 const MT& matrix_ref (void) const | 191 const MT& matrix_ref (void) const |
191 { | 192 { |
192 return matrix; | 193 return m_matrix; |
193 } | 194 } |
194 | 195 |
195 OCTINTERP_API octave_value | 196 OCTINTERP_API octave_value |
196 fast_elem_extract (octave_idx_type n) const; | 197 fast_elem_extract (octave_idx_type n) const; |
197 | 198 |
198 OCTINTERP_API bool | 199 OCTINTERP_API bool |
199 fast_elem_insert (octave_idx_type n, const octave_value& x); | 200 fast_elem_insert (octave_idx_type n, const octave_value& x); |
200 | 201 |
201 // This function exists to support the MEX interface. | 202 // This function exists to support the MEX interface. |
202 // You should not use it anywhere else. | 203 // You should not use it anywhere else. |
203 const void * mex_get_data (void) const { return matrix.data (); } | 204 const void * mex_get_data (void) const { return m_matrix.data (); } |
204 | 205 |
205 protected: | 206 protected: |
206 | 207 |
207 MT matrix; | 208 MT m_matrix; |
208 | 209 |
209 octave::idx_vector set_idx_cache (const octave::idx_vector& idx) const | 210 octave::idx_vector set_idx_cache (const octave::idx_vector& idx) const |
210 { | 211 { |
211 delete idx_cache; | 212 delete m_idx_cache; |
212 idx_cache = (idx ? new octave::idx_vector (idx) : nullptr); | 213 m_idx_cache = (idx ? new octave::idx_vector (idx) : nullptr); |
213 return idx; | 214 return idx; |
214 } | 215 } |
215 | 216 |
216 void clear_cached_info (void) const | 217 void clear_cached_info (void) const |
217 { | 218 { |
218 delete typ; typ = nullptr; | 219 delete m_typ; m_typ = nullptr; |
219 delete idx_cache; idx_cache = nullptr; | 220 delete m_idx_cache; m_idx_cache = nullptr; |
220 } | 221 } |
221 | 222 |
222 mutable MatrixType *typ; | 223 mutable MatrixType *m_typ; |
223 mutable octave::idx_vector *idx_cache; | 224 mutable octave::idx_vector *m_idx_cache; |
224 | 225 |
225 private: | 226 private: |
226 | 227 |
227 // No assignment. | 228 // No assignment. |
228 | 229 |