comparison armadillo-3.900.4/include/armadillo_bits/Row_bones.hpp @ 49:1ec0e2823891

Switch to using subrepo copies of qm-dsp, nnls-chroma, vamp-plugin-sdk; update Armadillo version; assume build without external BLAS/LAPACK
author Chris Cannam
date Thu, 13 Jun 2013 10:25:24 +0100
parents
children
comparison
equal deleted inserted replaced
48:69251e11a913 49:1ec0e2823891
1 // Copyright (C) 2008-2013 NICTA (www.nicta.com.au)
2 // Copyright (C) 2008-2013 Conrad Sanderson
3 //
4 // This Source Code Form is subject to the terms of the Mozilla Public
5 // License, v. 2.0. If a copy of the MPL was not distributed with this
6 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
8
9 //! \addtogroup Row
10 //! @{
11
12 //! Class for row vectors (matrices with only one row)
13
14 template<typename eT>
15 class Row : public Mat<eT>
16 {
17 public:
18
19 typedef eT elem_type;
20 typedef typename get_pod_type<eT>::result pod_type;
21
22 static const bool is_col = false;
23 static const bool is_row = true;
24
25 inline Row();
26 inline Row(const Row<eT>& X);
27 inline explicit Row(const uword N);
28 inline Row(const uword in_rows, const uword in_cols);
29
30 inline Row(const char* text);
31 inline const Row& operator=(const char* text);
32
33 inline Row(const std::string& text);
34 inline const Row& operator=(const std::string& text);
35
36 inline Row(const std::vector<eT>& x);
37 inline const Row& operator=(const std::vector<eT>& x);
38
39 #if defined(ARMA_USE_CXX11)
40 inline Row(const std::initializer_list<eT>& list);
41 inline const Row& operator=(const std::initializer_list<eT>& list);
42 #endif
43
44 inline explicit Row(const SpRow<eT>& X);
45
46 inline const Row& operator=(const eT val);
47
48 template<typename T1> inline Row(const Base<eT,T1>& X);
49 template<typename T1> inline const Row& operator=(const Base<eT,T1>& X);
50
51 inline Row( eT* aux_mem, const uword aux_length, const bool copy_aux_mem = true, const bool strict = true);
52 inline Row(const eT* aux_mem, const uword aux_length);
53
54 template<typename T1, typename T2>
55 inline explicit Row(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
56
57 template<typename T1> inline Row(const BaseCube<eT,T1>& X);
58 template<typename T1> inline const Row& operator=(const BaseCube<eT,T1>& X);
59
60 inline Row(const subview_cube<eT>& X);
61 inline const Row& operator=(const subview_cube<eT>& X);
62
63 inline mat_injector<Row> operator<<(const eT val);
64
65 arma_inline const Op<Row<eT>,op_htrans> t() const;
66 arma_inline const Op<Row<eT>,op_htrans> ht() const;
67 arma_inline const Op<Row<eT>,op_strans> st() const;
68
69 arma_inline eT& col(const uword col_num);
70 arma_inline eT col(const uword col_num) const;
71
72 arma_inline subview_row<eT> cols(const uword in_col1, const uword in_col2);
73 arma_inline const subview_row<eT> cols(const uword in_col1, const uword in_col2) const;
74
75 arma_inline subview_row<eT> subvec(const uword in_col1, const uword in_col2);
76 arma_inline const subview_row<eT> subvec(const uword in_col1, const uword in_col2) const;
77
78 arma_inline subview_row<eT> subvec(const span& col_span);
79 arma_inline const subview_row<eT> subvec(const span& col_span) const;
80
81 using Mat<eT>::operator();
82
83 arma_inline subview_row<eT> operator()(const span& col_span);
84 arma_inline const subview_row<eT> operator()(const span& col_span) const;
85
86
87 inline void shed_col (const uword col_num);
88 inline void shed_cols(const uword in_col1, const uword in_col2);
89
90 inline void insert_cols(const uword col_num, const uword N, const bool set_to_zero = true);
91 template<typename T1> inline void insert_cols(const uword col_num, const Base<eT,T1>& X);
92
93
94 arma_inline arma_warn_unused eT& at(const uword i);
95 arma_inline arma_warn_unused const eT& at(const uword i) const;
96
97 arma_inline arma_warn_unused eT& at(const uword in_row, const uword in_col);
98 arma_inline arma_warn_unused const eT& at(const uword in_row, const uword in_col) const;
99
100
101 typedef eT* row_iterator;
102 typedef const eT* const_row_iterator;
103
104 inline row_iterator begin_row(const uword row_num);
105 inline const_row_iterator begin_row(const uword row_num) const;
106
107 inline row_iterator end_row (const uword row_num);
108 inline const_row_iterator end_row (const uword row_num) const;
109
110
111 template<uword fixed_n_elem> class fixed;
112
113
114 protected:
115
116 inline Row(const arma_fixed_indicator&, const uword in_n_elem, const eT* in_mem);
117
118
119 public:
120
121 #ifdef ARMA_EXTRA_ROW_PROTO
122 #include ARMA_INCFILE_WRAP(ARMA_EXTRA_ROW_PROTO)
123 #endif
124 };
125
126
127
128 template<typename eT>
129 template<uword fixed_n_elem>
130 class Row<eT>::fixed : public Row<eT>
131 {
132 private:
133
134 static const bool use_extra = (fixed_n_elem > arma_config::mat_prealloc);
135
136 arma_align_mem eT mem_local_extra[ (use_extra) ? fixed_n_elem : 1 ];
137
138
139 public:
140
141 typedef fixed<fixed_n_elem> Row_fixed_type;
142
143 typedef eT elem_type;
144 typedef typename get_pod_type<eT>::result pod_type;
145
146 static const bool is_col = false;
147 static const bool is_row = true;
148
149 static const uword n_rows = 1;
150 static const uword n_cols = fixed_n_elem;
151 static const uword n_elem = fixed_n_elem;
152
153 arma_inline fixed();
154 arma_inline fixed(const fixed<fixed_n_elem>& X);
155 inline fixed(const subview_cube<eT>& X);
156
157 template<typename T1> inline fixed(const Base<eT,T1>& A);
158 template<typename T1, typename T2> inline fixed(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
159
160 inline fixed(const eT* aux_mem);
161
162 inline fixed(const char* text);
163 inline fixed(const std::string& text);
164
165 template<typename T1> inline const Row& operator=(const Base<eT,T1>& A);
166
167 inline const Row& operator=(const eT val);
168 inline const Row& operator=(const char* text);
169 inline const Row& operator=(const std::string& text);
170 inline const Row& operator=(const subview_cube<eT>& X);
171
172 using Row<eT>::operator();
173
174 #if defined(ARMA_USE_CXX11)
175 inline fixed(const std::initializer_list<eT>& list);
176 inline const Row& operator=(const std::initializer_list<eT>& list);
177 #endif
178
179 arma_inline const Op< Row_fixed_type, op_htrans > t() const;
180 arma_inline const Op< Row_fixed_type, op_htrans > ht() const;
181 arma_inline const Op< Row_fixed_type, op_strans > st() const;
182
183 arma_inline arma_warn_unused const eT& at_alt (const uword i) const;
184
185 arma_inline arma_warn_unused eT& operator[] (const uword i);
186 arma_inline arma_warn_unused const eT& operator[] (const uword i) const;
187 arma_inline arma_warn_unused eT& at (const uword i);
188 arma_inline arma_warn_unused const eT& at (const uword i) const;
189 arma_inline arma_warn_unused eT& operator() (const uword i);
190 arma_inline arma_warn_unused const eT& operator() (const uword i) const;
191
192 arma_inline arma_warn_unused eT& at (const uword in_row, const uword in_col);
193 arma_inline arma_warn_unused const eT& at (const uword in_row, const uword in_col) const;
194 arma_inline arma_warn_unused eT& operator() (const uword in_row, const uword in_col);
195 arma_inline arma_warn_unused const eT& operator() (const uword in_row, const uword in_col) const;
196
197 arma_inline arma_warn_unused eT* memptr();
198 arma_inline arma_warn_unused const eT* memptr() const;
199
200 arma_hot inline const Row<eT>& fill(const eT val);
201 arma_hot inline const Row<eT>& zeros();
202 arma_hot inline const Row<eT>& ones();
203 };
204
205
206
207 //! @}