max@0
|
1 // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
|
max@0
|
2 // Copyright (C) 2008-2011 Conrad Sanderson
|
max@0
|
3 //
|
max@0
|
4 // This file is part of the Armadillo C++ library.
|
max@0
|
5 // It is provided without any warranty of fitness
|
max@0
|
6 // for any purpose. You can redistribute this file
|
max@0
|
7 // and/or modify it under the terms of the GNU
|
max@0
|
8 // Lesser General Public License (LGPL) as published
|
max@0
|
9 // by the Free Software Foundation, either version 3
|
max@0
|
10 // of the License or (at your option) any later version.
|
max@0
|
11 // (see http://www.opensource.org/licenses for more info)
|
max@0
|
12
|
max@0
|
13
|
max@0
|
14 //! \addtogroup Mat
|
max@0
|
15 //! @{
|
max@0
|
16
|
max@0
|
17
|
max@0
|
18
|
max@0
|
19 //! Dense matrix class
|
max@0
|
20
|
max@0
|
21 template<typename eT>
|
max@0
|
22 class Mat : public Base< eT, Mat<eT> >
|
max@0
|
23 {
|
max@0
|
24 public:
|
max@0
|
25
|
max@0
|
26 typedef eT elem_type; //!< the type of elements stored in the matrix
|
max@0
|
27 typedef typename get_pod_type<eT>::result pod_type; //!< if eT is non-complex, pod_type is same as eT. otherwise, pod_type is the underlying type used by std::complex
|
max@0
|
28
|
max@0
|
29 const uword n_rows; //!< number of rows in the matrix (read-only)
|
max@0
|
30 const uword n_cols; //!< number of columns in the matrix (read-only)
|
max@0
|
31 const uword n_elem; //!< number of elements in the matrix (read-only)
|
max@0
|
32 const uhword vec_state; //!< 0: matrix layout; 1: column vector layout; 2: row vector layout
|
max@0
|
33 const uhword mem_state;
|
max@0
|
34
|
max@0
|
35 // mem_state = 0: normal matrix that can be resized;
|
max@0
|
36 // mem_state = 1: use auxiliary memory until change in the number of elements is requested;
|
max@0
|
37 // mem_state = 2: use auxiliary memory and don't allow the number of elements to be changed;
|
max@0
|
38 // mem_state = 3: fixed size (e.g. via template based size specification).
|
max@0
|
39
|
max@0
|
40 arma_aligned const eT* const mem; //!< pointer to the memory used by the matrix (memory is read-only)
|
max@0
|
41
|
max@0
|
42 protected:
|
max@0
|
43 arma_aligned eT mem_local[ arma_config::mat_prealloc ];
|
max@0
|
44
|
max@0
|
45
|
max@0
|
46 public:
|
max@0
|
47
|
max@0
|
48 inline ~Mat();
|
max@0
|
49 inline Mat();
|
max@0
|
50
|
max@0
|
51 inline Mat(const uword in_rows, const uword in_cols);
|
max@0
|
52
|
max@0
|
53 inline Mat(const char* text);
|
max@0
|
54 inline const Mat& operator=(const char* text);
|
max@0
|
55
|
max@0
|
56 inline Mat(const std::string& text);
|
max@0
|
57 inline const Mat& operator=(const std::string& text);
|
max@0
|
58
|
max@0
|
59 #if defined(ARMA_USE_CXX11)
|
max@0
|
60 inline Mat(const std::initializer_list<eT>& list);
|
max@0
|
61 inline const Mat& operator=(const std::initializer_list<eT>& list);
|
max@0
|
62 #endif
|
max@0
|
63
|
max@0
|
64 inline Mat( eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols, const bool copy_aux_mem = true, const bool strict = true);
|
max@0
|
65 inline Mat(const eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols);
|
max@0
|
66
|
max@0
|
67 arma_inline const Mat& operator=(const eT val);
|
max@0
|
68 arma_inline const Mat& operator+=(const eT val);
|
max@0
|
69 arma_inline const Mat& operator-=(const eT val);
|
max@0
|
70 arma_inline const Mat& operator*=(const eT val);
|
max@0
|
71 arma_inline const Mat& operator/=(const eT val);
|
max@0
|
72
|
max@0
|
73 inline Mat(const Mat& m);
|
max@0
|
74 inline const Mat& operator=(const Mat& m);
|
max@0
|
75 inline const Mat& operator+=(const Mat& m);
|
max@0
|
76 inline const Mat& operator-=(const Mat& m);
|
max@0
|
77 inline const Mat& operator*=(const Mat& m);
|
max@0
|
78 inline const Mat& operator%=(const Mat& m);
|
max@0
|
79 inline const Mat& operator/=(const Mat& m);
|
max@0
|
80
|
max@0
|
81 template<typename T1> inline Mat(const BaseCube<eT,T1>& X);
|
max@0
|
82 template<typename T1> inline const Mat& operator=(const BaseCube<eT,T1>& X);
|
max@0
|
83 template<typename T1> inline const Mat& operator+=(const BaseCube<eT,T1>& X);
|
max@0
|
84 template<typename T1> inline const Mat& operator-=(const BaseCube<eT,T1>& X);
|
max@0
|
85 template<typename T1> inline const Mat& operator*=(const BaseCube<eT,T1>& X);
|
max@0
|
86 template<typename T1> inline const Mat& operator%=(const BaseCube<eT,T1>& X);
|
max@0
|
87 template<typename T1> inline const Mat& operator/=(const BaseCube<eT,T1>& X);
|
max@0
|
88
|
max@0
|
89 template<typename T1, typename T2>
|
max@0
|
90 inline explicit Mat(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
|
max@0
|
91
|
max@0
|
92 inline Mat(const subview<eT>& X);
|
max@0
|
93 inline const Mat& operator=(const subview<eT>& X);
|
max@0
|
94 inline const Mat& operator+=(const subview<eT>& X);
|
max@0
|
95 inline const Mat& operator-=(const subview<eT>& X);
|
max@0
|
96 inline const Mat& operator*=(const subview<eT>& X);
|
max@0
|
97 inline const Mat& operator%=(const subview<eT>& X);
|
max@0
|
98 inline const Mat& operator/=(const subview<eT>& X);
|
max@0
|
99
|
max@0
|
100 //inline explicit Mat(const subview_cube<eT>& X);
|
max@0
|
101 inline Mat(const subview_cube<eT>& X);
|
max@0
|
102 inline const Mat& operator=(const subview_cube<eT>& X);
|
max@0
|
103 inline const Mat& operator+=(const subview_cube<eT>& X);
|
max@0
|
104 inline const Mat& operator-=(const subview_cube<eT>& X);
|
max@0
|
105 inline const Mat& operator*=(const subview_cube<eT>& X);
|
max@0
|
106 inline const Mat& operator%=(const subview_cube<eT>& X);
|
max@0
|
107 inline const Mat& operator/=(const subview_cube<eT>& X);
|
max@0
|
108
|
max@0
|
109 //inline explicit Mat(const diagview<eT>& X);
|
max@0
|
110 inline Mat(const diagview<eT>& X);
|
max@0
|
111 inline const Mat& operator=(const diagview<eT>& X);
|
max@0
|
112 inline const Mat& operator+=(const diagview<eT>& X);
|
max@0
|
113 inline const Mat& operator-=(const diagview<eT>& X);
|
max@0
|
114 inline const Mat& operator*=(const diagview<eT>& X);
|
max@0
|
115 inline const Mat& operator%=(const diagview<eT>& X);
|
max@0
|
116 inline const Mat& operator/=(const diagview<eT>& X);
|
max@0
|
117
|
max@0
|
118 template<typename T1> inline Mat(const subview_elem1<eT,T1>& X);
|
max@0
|
119 template<typename T1> inline const Mat& operator= (const subview_elem1<eT,T1>& X);
|
max@0
|
120 template<typename T1> inline const Mat& operator+=(const subview_elem1<eT,T1>& X);
|
max@0
|
121 template<typename T1> inline const Mat& operator-=(const subview_elem1<eT,T1>& X);
|
max@0
|
122 template<typename T1> inline const Mat& operator*=(const subview_elem1<eT,T1>& X);
|
max@0
|
123 template<typename T1> inline const Mat& operator%=(const subview_elem1<eT,T1>& X);
|
max@0
|
124 template<typename T1> inline const Mat& operator/=(const subview_elem1<eT,T1>& X);
|
max@0
|
125
|
max@0
|
126
|
max@0
|
127 inline mat_injector<Mat> operator<<(const eT val);
|
max@0
|
128 inline mat_injector<Mat> operator<<(const injector_end_of_row& x);
|
max@0
|
129
|
max@0
|
130
|
max@0
|
131 arma_inline subview_row<eT> row(const uword row_num);
|
max@0
|
132 arma_inline const subview_row<eT> row(const uword row_num) const;
|
max@0
|
133
|
max@0
|
134 inline subview_row<eT> operator()(const uword row_num, const span& col_span);
|
max@0
|
135 inline const subview_row<eT> operator()(const uword row_num, const span& col_span) const;
|
max@0
|
136
|
max@0
|
137
|
max@0
|
138 arma_inline subview_col<eT> col(const uword col_num);
|
max@0
|
139 arma_inline const subview_col<eT> col(const uword col_num) const;
|
max@0
|
140
|
max@0
|
141 inline subview_col<eT> operator()(const span& row_span, const uword col_num);
|
max@0
|
142 inline const subview_col<eT> operator()(const span& row_span, const uword col_num) const;
|
max@0
|
143
|
max@0
|
144 inline Col<eT> unsafe_col(const uword col_num);
|
max@0
|
145 inline const Col<eT> unsafe_col(const uword col_num) const;
|
max@0
|
146
|
max@0
|
147
|
max@0
|
148 arma_inline subview<eT> rows(const uword in_row1, const uword in_row2);
|
max@0
|
149 arma_inline const subview<eT> rows(const uword in_row1, const uword in_row2) const;
|
max@0
|
150
|
max@0
|
151 arma_inline subview<eT> cols(const uword in_col1, const uword in_col2);
|
max@0
|
152 arma_inline const subview<eT> cols(const uword in_col1, const uword in_col2) const;
|
max@0
|
153
|
max@0
|
154 arma_inline subview<eT> submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2);
|
max@0
|
155 arma_inline const subview<eT> submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const;
|
max@0
|
156
|
max@0
|
157
|
max@0
|
158 inline subview<eT> submat (const span& row_span, const span& col_span);
|
max@0
|
159 inline const subview<eT> submat (const span& row_span, const span& col_span) const;
|
max@0
|
160
|
max@0
|
161 inline subview<eT> operator()(const span& row_span, const span& col_span);
|
max@0
|
162 inline const subview<eT> operator()(const span& row_span, const span& col_span) const;
|
max@0
|
163
|
max@0
|
164
|
max@0
|
165 template<typename T1> arma_inline subview_elem1<eT,T1> elem(const Base<uword,T1>& a);
|
max@0
|
166 template<typename T1> arma_inline const subview_elem1<eT,T1> elem(const Base<uword,T1>& a) const;
|
max@0
|
167
|
max@0
|
168 // template<typename T1, typename T2> arma_inline subview_elem2<eT,T1,T2> submat(const Base<uword,T1>& a, const Base<uword,T2>& b);
|
max@0
|
169 // template<typename T1, typename T2> arma_inline const subview_elem2<eT,T1,T2> submat(const Base<uword,T1>& a, const Base<uword,T2>& b) const;
|
max@0
|
170
|
max@0
|
171
|
max@0
|
172 arma_inline diagview<eT> diag(const sword in_id = 0);
|
max@0
|
173 arma_inline const diagview<eT> diag(const sword in_id = 0) const;
|
max@0
|
174
|
max@0
|
175
|
max@0
|
176 inline void swap_rows(const uword in_row1, const uword in_row2);
|
max@0
|
177 inline void swap_cols(const uword in_col1, const uword in_col2);
|
max@0
|
178
|
max@0
|
179 inline void shed_row(const uword row_num);
|
max@0
|
180 inline void shed_col(const uword col_num);
|
max@0
|
181
|
max@0
|
182 inline void shed_rows(const uword in_row1, const uword in_row2);
|
max@0
|
183 inline void shed_cols(const uword in_col1, const uword in_col2);
|
max@0
|
184
|
max@0
|
185 inline void insert_rows(const uword row_num, const uword N, const bool set_to_zero = true);
|
max@0
|
186 inline void insert_cols(const uword col_num, const uword N, const bool set_to_zero = true);
|
max@0
|
187
|
max@0
|
188 template<typename T1> inline void insert_rows(const uword row_num, const Base<eT,T1>& X);
|
max@0
|
189 template<typename T1> inline void insert_cols(const uword col_num, const Base<eT,T1>& X);
|
max@0
|
190
|
max@0
|
191
|
max@0
|
192 template<typename gen_type> inline Mat(const Gen<eT, gen_type>& X);
|
max@0
|
193 template<typename gen_type> inline const Mat& operator=(const Gen<eT, gen_type>& X);
|
max@0
|
194 template<typename gen_type> inline const Mat& operator+=(const Gen<eT, gen_type>& X);
|
max@0
|
195 template<typename gen_type> inline const Mat& operator-=(const Gen<eT, gen_type>& X);
|
max@0
|
196 template<typename gen_type> inline const Mat& operator*=(const Gen<eT, gen_type>& X);
|
max@0
|
197 template<typename gen_type> inline const Mat& operator%=(const Gen<eT, gen_type>& X);
|
max@0
|
198 template<typename gen_type> inline const Mat& operator/=(const Gen<eT, gen_type>& X);
|
max@0
|
199
|
max@0
|
200 template<typename T1, typename op_type> inline Mat(const Op<T1, op_type>& X);
|
max@0
|
201 template<typename T1, typename op_type> inline const Mat& operator=(const Op<T1, op_type>& X);
|
max@0
|
202 template<typename T1, typename op_type> inline const Mat& operator+=(const Op<T1, op_type>& X);
|
max@0
|
203 template<typename T1, typename op_type> inline const Mat& operator-=(const Op<T1, op_type>& X);
|
max@0
|
204 template<typename T1, typename op_type> inline const Mat& operator*=(const Op<T1, op_type>& X);
|
max@0
|
205 template<typename T1, typename op_type> inline const Mat& operator%=(const Op<T1, op_type>& X);
|
max@0
|
206 template<typename T1, typename op_type> inline const Mat& operator/=(const Op<T1, op_type>& X);
|
max@0
|
207
|
max@0
|
208 template<typename T1, typename eop_type> inline Mat(const eOp<T1, eop_type>& X);
|
max@0
|
209 template<typename T1, typename eop_type> inline const Mat& operator=(const eOp<T1, eop_type>& X);
|
max@0
|
210 template<typename T1, typename eop_type> inline const Mat& operator+=(const eOp<T1, eop_type>& X);
|
max@0
|
211 template<typename T1, typename eop_type> inline const Mat& operator-=(const eOp<T1, eop_type>& X);
|
max@0
|
212 template<typename T1, typename eop_type> inline const Mat& operator*=(const eOp<T1, eop_type>& X);
|
max@0
|
213 template<typename T1, typename eop_type> inline const Mat& operator%=(const eOp<T1, eop_type>& X);
|
max@0
|
214 template<typename T1, typename eop_type> inline const Mat& operator/=(const eOp<T1, eop_type>& X);
|
max@0
|
215
|
max@0
|
216 template<typename T1, typename op_type> inline Mat(const mtOp<eT, T1, op_type>& X);
|
max@0
|
217 template<typename T1, typename op_type> inline const Mat& operator=(const mtOp<eT, T1, op_type>& X);
|
max@0
|
218 template<typename T1, typename op_type> inline const Mat& operator+=(const mtOp<eT, T1, op_type>& X);
|
max@0
|
219 template<typename T1, typename op_type> inline const Mat& operator-=(const mtOp<eT, T1, op_type>& X);
|
max@0
|
220 template<typename T1, typename op_type> inline const Mat& operator*=(const mtOp<eT, T1, op_type>& X);
|
max@0
|
221 template<typename T1, typename op_type> inline const Mat& operator%=(const mtOp<eT, T1, op_type>& X);
|
max@0
|
222 template<typename T1, typename op_type> inline const Mat& operator/=(const mtOp<eT, T1, op_type>& X);
|
max@0
|
223
|
max@0
|
224 template<typename T1, typename T2, typename glue_type> inline Mat(const Glue<T1, T2, glue_type>& X);
|
max@0
|
225 template<typename T1, typename T2, typename glue_type> inline const Mat& operator=(const Glue<T1, T2, glue_type>& X);
|
max@0
|
226 template<typename T1, typename T2, typename glue_type> inline const Mat& operator+=(const Glue<T1, T2, glue_type>& X);
|
max@0
|
227 template<typename T1, typename T2, typename glue_type> inline const Mat& operator-=(const Glue<T1, T2, glue_type>& X);
|
max@0
|
228 template<typename T1, typename T2, typename glue_type> inline const Mat& operator*=(const Glue<T1, T2, glue_type>& X);
|
max@0
|
229 template<typename T1, typename T2, typename glue_type> inline const Mat& operator%=(const Glue<T1, T2, glue_type>& X);
|
max@0
|
230 template<typename T1, typename T2, typename glue_type> inline const Mat& operator/=(const Glue<T1, T2, glue_type>& X);
|
max@0
|
231
|
max@0
|
232 template<typename T1, typename T2> inline const Mat& operator+=(const Glue<T1, T2, glue_times>& X);
|
max@0
|
233 template<typename T1, typename T2> inline const Mat& operator-=(const Glue<T1, T2, glue_times>& X);
|
max@0
|
234
|
max@0
|
235 template<typename T1, typename T2, typename eglue_type> inline Mat(const eGlue<T1, T2, eglue_type>& X);
|
max@0
|
236 template<typename T1, typename T2, typename eglue_type> inline const Mat& operator=(const eGlue<T1, T2, eglue_type>& X);
|
max@0
|
237 template<typename T1, typename T2, typename eglue_type> inline const Mat& operator+=(const eGlue<T1, T2, eglue_type>& X);
|
max@0
|
238 template<typename T1, typename T2, typename eglue_type> inline const Mat& operator-=(const eGlue<T1, T2, eglue_type>& X);
|
max@0
|
239 template<typename T1, typename T2, typename eglue_type> inline const Mat& operator*=(const eGlue<T1, T2, eglue_type>& X);
|
max@0
|
240 template<typename T1, typename T2, typename eglue_type> inline const Mat& operator%=(const eGlue<T1, T2, eglue_type>& X);
|
max@0
|
241 template<typename T1, typename T2, typename eglue_type> inline const Mat& operator/=(const eGlue<T1, T2, eglue_type>& X);
|
max@0
|
242
|
max@0
|
243 template<typename T1, typename T2, typename glue_type> inline Mat(const mtGlue<eT, T1, T2, glue_type>& X);
|
max@0
|
244 template<typename T1, typename T2, typename glue_type> inline const Mat& operator=(const mtGlue<eT, T1, T2, glue_type>& X);
|
max@0
|
245 template<typename T1, typename T2, typename glue_type> inline const Mat& operator+=(const mtGlue<eT, T1, T2, glue_type>& X);
|
max@0
|
246 template<typename T1, typename T2, typename glue_type> inline const Mat& operator-=(const mtGlue<eT, T1, T2, glue_type>& X);
|
max@0
|
247 template<typename T1, typename T2, typename glue_type> inline const Mat& operator*=(const mtGlue<eT, T1, T2, glue_type>& X);
|
max@0
|
248 template<typename T1, typename T2, typename glue_type> inline const Mat& operator%=(const mtGlue<eT, T1, T2, glue_type>& X);
|
max@0
|
249 template<typename T1, typename T2, typename glue_type> inline const Mat& operator/=(const mtGlue<eT, T1, T2, glue_type>& X);
|
max@0
|
250
|
max@0
|
251
|
max@0
|
252 arma_inline arma_warn_unused eT& operator[] (const uword i);
|
max@0
|
253 arma_inline arma_warn_unused eT operator[] (const uword i) const;
|
max@0
|
254 arma_inline arma_warn_unused eT& at (const uword i);
|
max@0
|
255 arma_inline arma_warn_unused eT at (const uword i) const;
|
max@0
|
256 arma_inline arma_warn_unused eT& operator() (const uword i);
|
max@0
|
257 arma_inline arma_warn_unused eT operator() (const uword i) const;
|
max@0
|
258
|
max@0
|
259 arma_inline arma_warn_unused eT& at (const uword in_row, const uword in_col);
|
max@0
|
260 arma_inline arma_warn_unused eT at (const uword in_row, const uword in_col) const;
|
max@0
|
261 arma_inline arma_warn_unused eT& operator() (const uword in_row, const uword in_col);
|
max@0
|
262 arma_inline arma_warn_unused eT operator() (const uword in_row, const uword in_col) const;
|
max@0
|
263
|
max@0
|
264 arma_inline const Mat& operator++();
|
max@0
|
265 arma_inline void operator++(int);
|
max@0
|
266
|
max@0
|
267 arma_inline const Mat& operator--();
|
max@0
|
268 arma_inline void operator--(int);
|
max@0
|
269
|
max@0
|
270 arma_inline arma_warn_unused bool is_empty() const;
|
max@0
|
271 arma_inline arma_warn_unused bool is_vec() const;
|
max@0
|
272 arma_inline arma_warn_unused bool is_rowvec() const;
|
max@0
|
273 arma_inline arma_warn_unused bool is_colvec() const;
|
max@0
|
274 arma_inline arma_warn_unused bool is_square() const;
|
max@0
|
275 inline arma_warn_unused bool is_finite() const;
|
max@0
|
276
|
max@0
|
277 arma_inline arma_warn_unused bool in_range(const uword i) const;
|
max@0
|
278 arma_inline arma_warn_unused bool in_range(const span& x) const;
|
max@0
|
279
|
max@0
|
280 arma_inline arma_warn_unused bool in_range(const uword in_row, const uword in_col) const;
|
max@0
|
281 arma_inline arma_warn_unused bool in_range(const span& row_span, const uword in_col) const;
|
max@0
|
282 arma_inline arma_warn_unused bool in_range(const uword in_row, const span& col_span) const;
|
max@0
|
283 arma_inline arma_warn_unused bool in_range(const span& row_span, const span& col_span) const;
|
max@0
|
284
|
max@0
|
285 arma_inline arma_warn_unused eT* colptr(const uword in_col);
|
max@0
|
286 arma_inline arma_warn_unused const eT* colptr(const uword in_col) const;
|
max@0
|
287
|
max@0
|
288 arma_inline arma_warn_unused eT* memptr();
|
max@0
|
289 arma_inline arma_warn_unused const eT* memptr() const;
|
max@0
|
290
|
max@0
|
291
|
max@0
|
292 inline void impl_print(const std::string& extra_text) const;
|
max@0
|
293 inline void impl_print(std::ostream& user_stream, const std::string& extra_text) const;
|
max@0
|
294
|
max@0
|
295 inline void impl_print_trans(const std::string& extra_text) const;
|
max@0
|
296 inline void impl_print_trans(std::ostream& user_stream, const std::string& extra_text) const;
|
max@0
|
297
|
max@0
|
298 inline void impl_raw_print(const std::string& extra_text) const;
|
max@0
|
299 inline void impl_raw_print(std::ostream& user_stream, const std::string& extra_text) const;
|
max@0
|
300
|
max@0
|
301 inline void impl_raw_print_trans(const std::string& extra_text) const;
|
max@0
|
302 inline void impl_raw_print_trans(std::ostream& user_stream, const std::string& extra_text) const;
|
max@0
|
303
|
max@0
|
304
|
max@0
|
305 template<typename eT2>
|
max@0
|
306 inline void copy_size(const Mat<eT2>& m);
|
max@0
|
307
|
max@0
|
308 inline void set_size(const uword in_elem);
|
max@0
|
309 inline void set_size(const uword in_rows, const uword in_cols);
|
max@0
|
310
|
max@0
|
311 inline void resize(const uword in_elem);
|
max@0
|
312 inline void resize(const uword in_rows, const uword in_cols);
|
max@0
|
313 inline void reshape(const uword in_rows, const uword in_cols, const uword dim = 0);
|
max@0
|
314
|
max@0
|
315
|
max@0
|
316 arma_hot inline const Mat& fill(const eT val);
|
max@0
|
317
|
max@0
|
318 inline const Mat& zeros();
|
max@0
|
319 inline const Mat& zeros(const uword in_elem);
|
max@0
|
320 inline const Mat& zeros(const uword in_rows, const uword in_cols);
|
max@0
|
321
|
max@0
|
322 inline const Mat& ones();
|
max@0
|
323 inline const Mat& ones(const uword in_elem);
|
max@0
|
324 inline const Mat& ones(const uword in_rows, const uword in_cols);
|
max@0
|
325
|
max@0
|
326 inline const Mat& randu();
|
max@0
|
327 inline const Mat& randu(const uword in_elem);
|
max@0
|
328 inline const Mat& randu(const uword in_rows, const uword in_cols);
|
max@0
|
329
|
max@0
|
330 inline const Mat& randn();
|
max@0
|
331 inline const Mat& randn(const uword in_elem);
|
max@0
|
332 inline const Mat& randn(const uword in_rows, const uword in_cols);
|
max@0
|
333
|
max@0
|
334 inline const Mat& eye();
|
max@0
|
335 inline const Mat& eye(const uword in_rows, const uword in_cols);
|
max@0
|
336
|
max@0
|
337 inline void reset();
|
max@0
|
338
|
max@0
|
339
|
max@0
|
340 template<typename T1> inline void set_real(const Base<pod_type,T1>& X);
|
max@0
|
341 template<typename T1> inline void set_imag(const Base<pod_type,T1>& X);
|
max@0
|
342
|
max@0
|
343
|
max@0
|
344 inline arma_warn_unused eT min() const;
|
max@0
|
345 inline arma_warn_unused eT max() const;
|
max@0
|
346
|
max@0
|
347 inline eT min(uword& index_of_min_val) const;
|
max@0
|
348 inline eT max(uword& index_of_max_val) const;
|
max@0
|
349
|
max@0
|
350 inline eT min(uword& row_of_min_val, uword& col_of_min_val) const;
|
max@0
|
351 inline eT max(uword& row_of_max_val, uword& col_of_max_val) const;
|
max@0
|
352
|
max@0
|
353
|
max@0
|
354 inline bool save(const std::string name, const file_type type = arma_binary, const bool print_status = true) const;
|
max@0
|
355 inline bool save( std::ostream& os, const file_type type = arma_binary, const bool print_status = true) const;
|
max@0
|
356
|
max@0
|
357 inline bool load(const std::string name, const file_type type = auto_detect, const bool print_status = true);
|
max@0
|
358 inline bool load( std::istream& is, const file_type type = auto_detect, const bool print_status = true);
|
max@0
|
359
|
max@0
|
360 inline bool quiet_save(const std::string name, const file_type type = arma_binary) const;
|
max@0
|
361 inline bool quiet_save( std::ostream& os, const file_type type = arma_binary) const;
|
max@0
|
362
|
max@0
|
363 inline bool quiet_load(const std::string name, const file_type type = auto_detect);
|
max@0
|
364 inline bool quiet_load( std::istream& is, const file_type type = auto_detect);
|
max@0
|
365
|
max@0
|
366
|
max@0
|
367 // for container-like functionality
|
max@0
|
368
|
max@0
|
369 typedef eT value_type;
|
max@0
|
370 typedef uword size_type;
|
max@0
|
371
|
max@0
|
372 typedef eT* iterator;
|
max@0
|
373 typedef const eT* const_iterator;
|
max@0
|
374
|
max@0
|
375 typedef eT* col_iterator;
|
max@0
|
376 typedef const eT* const_col_iterator;
|
max@0
|
377
|
max@0
|
378 class row_iterator
|
max@0
|
379 {
|
max@0
|
380 public:
|
max@0
|
381
|
max@0
|
382 inline row_iterator(Mat<eT>& in_M, const uword in_row);
|
max@0
|
383
|
max@0
|
384 inline eT& operator* ();
|
max@0
|
385
|
max@0
|
386 inline row_iterator& operator++();
|
max@0
|
387 inline void operator++(int);
|
max@0
|
388
|
max@0
|
389 inline row_iterator& operator--();
|
max@0
|
390 inline void operator--(int);
|
max@0
|
391
|
max@0
|
392 inline bool operator!=(const row_iterator& X) const;
|
max@0
|
393 inline bool operator==(const row_iterator& X) const;
|
max@0
|
394
|
max@0
|
395 arma_aligned Mat<eT>& M;
|
max@0
|
396 arma_aligned uword row;
|
max@0
|
397 arma_aligned uword col;
|
max@0
|
398 };
|
max@0
|
399
|
max@0
|
400
|
max@0
|
401 class const_row_iterator
|
max@0
|
402 {
|
max@0
|
403 public:
|
max@0
|
404
|
max@0
|
405 const_row_iterator(const Mat<eT>& in_M, const uword in_row);
|
max@0
|
406 const_row_iterator(const row_iterator& X);
|
max@0
|
407
|
max@0
|
408 inline eT operator*() const;
|
max@0
|
409
|
max@0
|
410 inline const_row_iterator& operator++();
|
max@0
|
411 inline void operator++(int);
|
max@0
|
412
|
max@0
|
413 inline const_row_iterator& operator--();
|
max@0
|
414 inline void operator--(int);
|
max@0
|
415
|
max@0
|
416 inline bool operator!=(const const_row_iterator& X) const;
|
max@0
|
417 inline bool operator==(const const_row_iterator& X) const;
|
max@0
|
418
|
max@0
|
419 arma_aligned const Mat<eT>& M;
|
max@0
|
420 arma_aligned uword row;
|
max@0
|
421 arma_aligned uword col;
|
max@0
|
422 };
|
max@0
|
423
|
max@0
|
424 inline iterator begin();
|
max@0
|
425 inline const_iterator begin() const;
|
max@0
|
426
|
max@0
|
427 inline iterator end();
|
max@0
|
428 inline const_iterator end() const;
|
max@0
|
429
|
max@0
|
430 inline col_iterator begin_col(const uword col_num);
|
max@0
|
431 inline const_col_iterator begin_col(const uword col_num) const;
|
max@0
|
432
|
max@0
|
433 inline col_iterator end_col (const uword col_num);
|
max@0
|
434 inline const_col_iterator end_col (const uword col_num) const;
|
max@0
|
435
|
max@0
|
436 inline row_iterator begin_row(const uword row_num);
|
max@0
|
437 inline const_row_iterator begin_row(const uword row_num) const;
|
max@0
|
438
|
max@0
|
439 inline row_iterator end_row (const uword row_num);
|
max@0
|
440 inline const_row_iterator end_row (const uword row_num) const;
|
max@0
|
441
|
max@0
|
442 inline void clear();
|
max@0
|
443 inline bool empty() const;
|
max@0
|
444 inline uword size() const;
|
max@0
|
445
|
max@0
|
446 template<uword fixed_n_rows, uword fixed_n_cols>
|
max@0
|
447 class fixed : public Mat<eT>
|
max@0
|
448 {
|
max@0
|
449 private:
|
max@0
|
450
|
max@0
|
451 static const uword fixed_n_elem = fixed_n_rows * fixed_n_cols;
|
max@0
|
452 static const bool use_extra = (fixed_n_elem > arma_config::mat_prealloc);
|
max@0
|
453
|
max@0
|
454 arma_aligned eT mem_local_extra[ (use_extra) ? fixed_n_elem : 1 ];
|
max@0
|
455
|
max@0
|
456 arma_inline void mem_setup();
|
max@0
|
457
|
max@0
|
458
|
max@0
|
459 public:
|
max@0
|
460
|
max@0
|
461 static const uword n_rows = fixed_n_rows;
|
max@0
|
462 static const uword n_cols = fixed_n_cols;
|
max@0
|
463 static const uword n_elem = fixed_n_elem;
|
max@0
|
464
|
max@0
|
465
|
max@0
|
466 arma_inline fixed();
|
max@0
|
467 arma_inline fixed(const fixed<fixed_n_rows, fixed_n_cols>& X);
|
max@0
|
468
|
max@0
|
469 template<typename T1> inline fixed(const Base<eT,T1>& A);
|
max@0
|
470 template<typename T1, typename T2> inline fixed(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
|
max@0
|
471
|
max@0
|
472 inline fixed( eT* aux_mem, const bool copy_aux_mem = true);
|
max@0
|
473 inline fixed(const eT* aux_mem);
|
max@0
|
474
|
max@0
|
475 inline fixed(const char* text);
|
max@0
|
476 inline fixed(const std::string& text);
|
max@0
|
477
|
max@0
|
478 // TODO: handling of initializer_list ?
|
max@0
|
479
|
max@0
|
480 template<typename T1> inline const Mat& operator=(const Base<eT,T1>& A);
|
max@0
|
481
|
max@0
|
482 inline const Mat& operator=(const eT val);
|
max@0
|
483 inline const Mat& operator=(const char* text);
|
max@0
|
484 inline const Mat& operator=(const std::string& text);
|
max@0
|
485
|
max@0
|
486
|
max@0
|
487 inline subview_row<eT> operator()(const uword row_num, const span& col_span);
|
max@0
|
488 inline const subview_row<eT> operator()(const uword row_num, const span& col_span) const;
|
max@0
|
489
|
max@0
|
490 inline subview_col<eT> operator()(const span& row_span, const uword col_num);
|
max@0
|
491 inline const subview_col<eT> operator()(const span& row_span, const uword col_num) const;
|
max@0
|
492
|
max@0
|
493 inline subview<eT> operator()(const span& row_span, const span& col_span);
|
max@0
|
494 inline const subview<eT> operator()(const span& row_span, const span& col_span) const;
|
max@0
|
495
|
max@0
|
496
|
max@0
|
497 arma_inline arma_warn_unused eT& operator[] (const uword i);
|
max@0
|
498 arma_inline arma_warn_unused eT operator[] (const uword i) const;
|
max@0
|
499 arma_inline arma_warn_unused eT& at (const uword i);
|
max@0
|
500 arma_inline arma_warn_unused eT at (const uword i) const;
|
max@0
|
501 arma_inline arma_warn_unused eT& operator() (const uword i);
|
max@0
|
502 arma_inline arma_warn_unused eT operator() (const uword i) const;
|
max@0
|
503
|
max@0
|
504 arma_inline arma_warn_unused eT& at (const uword in_row, const uword in_col);
|
max@0
|
505 arma_inline arma_warn_unused eT at (const uword in_row, const uword in_col) const;
|
max@0
|
506 arma_inline arma_warn_unused eT& operator() (const uword in_row, const uword in_col);
|
max@0
|
507 arma_inline arma_warn_unused eT operator() (const uword in_row, const uword in_col) const;
|
max@0
|
508
|
max@0
|
509
|
max@0
|
510 arma_hot inline const Mat<eT>& fill(const eT val);
|
max@0
|
511 arma_hot inline const Mat<eT>& zeros();
|
max@0
|
512 arma_hot inline const Mat<eT>& ones();
|
max@0
|
513 };
|
max@0
|
514
|
max@0
|
515
|
max@0
|
516 protected:
|
max@0
|
517
|
max@0
|
518 inline void init_cold();
|
max@0
|
519 inline void init_warm(uword in_rows, uword in_cols);
|
max@0
|
520
|
max@0
|
521 inline void init(const std::string& text);
|
max@0
|
522
|
max@0
|
523 #if defined(ARMA_USE_CXX11)
|
max@0
|
524 inline void init(const std::initializer_list<eT>& list);
|
max@0
|
525 #endif
|
max@0
|
526
|
max@0
|
527 template<typename T1, typename T2>
|
max@0
|
528 inline void init(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
|
max@0
|
529
|
max@0
|
530 inline void steal_mem(Mat& X);
|
max@0
|
531
|
max@0
|
532 inline Mat(const char junk, const eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols);
|
max@0
|
533
|
max@0
|
534 friend class Cube<eT>;
|
max@0
|
535 friend class glue_join;
|
max@0
|
536 friend class op_strans;
|
max@0
|
537 friend class op_htrans;
|
max@0
|
538 friend class op_resize;
|
max@0
|
539
|
max@0
|
540
|
max@0
|
541 public:
|
max@0
|
542
|
max@0
|
543 #ifdef ARMA_EXTRA_MAT_PROTO
|
max@0
|
544 #include ARMA_INCFILE_WRAP(ARMA_EXTRA_MAT_PROTO)
|
max@0
|
545 #endif
|
max@0
|
546 };
|
max@0
|
547
|
max@0
|
548
|
max@0
|
549
|
max@0
|
550 class Mat_aux
|
max@0
|
551 {
|
max@0
|
552 public:
|
max@0
|
553
|
max@0
|
554 template<typename eT> arma_inline static void prefix_pp(Mat<eT>& x);
|
max@0
|
555 template<typename T> arma_inline static void prefix_pp(Mat< std::complex<T> >& x);
|
max@0
|
556
|
max@0
|
557 template<typename eT> arma_inline static void postfix_pp(Mat<eT>& x);
|
max@0
|
558 template<typename T> arma_inline static void postfix_pp(Mat< std::complex<T> >& x);
|
max@0
|
559
|
max@0
|
560 template<typename eT> arma_inline static void prefix_mm(Mat<eT>& x);
|
max@0
|
561 template<typename T> arma_inline static void prefix_mm(Mat< std::complex<T> >& x);
|
max@0
|
562
|
max@0
|
563 template<typename eT> arma_inline static void postfix_mm(Mat<eT>& x);
|
max@0
|
564 template<typename T> arma_inline static void postfix_mm(Mat< std::complex<T> >& x);
|
max@0
|
565
|
max@0
|
566 template<typename eT, typename T1> inline static void set_real(Mat<eT>& out, const Base<eT,T1>& X);
|
max@0
|
567 template<typename T, typename T1> inline static void set_real(Mat< std::complex<T> >& out, const Base< T,T1>& X);
|
max@0
|
568
|
max@0
|
569 template<typename eT, typename T1> inline static void set_imag(Mat<eT>& out, const Base<eT,T1>& X);
|
max@0
|
570 template<typename T, typename T1> inline static void set_imag(Mat< std::complex<T> >& out, const Base< T,T1>& X);
|
max@0
|
571 };
|
max@0
|
572
|
max@0
|
573
|
max@0
|
574
|
max@0
|
575 //! @}
|