comparison armadillo-3.900.4/include/armadillo_bits/Col_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 Col
10 //! @{
11
12 //! Class for column vectors (matrices with only one column)
13
14 template<typename eT>
15 class Col : 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 = true;
23 static const bool is_row = false;
24
25 inline Col();
26 inline Col(const Col<eT>& X);
27 inline explicit Col(const uword n_elem);
28 inline Col(const uword in_rows, const uword in_cols);
29
30 inline Col(const char* text);
31 inline const Col& operator=(const char* text);
32
33 inline Col(const std::string& text);
34 inline const Col& operator=(const std::string& text);
35
36 inline Col(const std::vector<eT>& x);
37 inline const Col& operator=(const std::vector<eT>& x);
38
39 #if defined(ARMA_USE_CXX11)
40 inline Col(const std::initializer_list<eT>& list);
41 inline const Col& operator=(const std::initializer_list<eT>& list);
42 #endif
43
44 inline explicit Col(const SpCol<eT>& X);
45
46 inline const Col& operator=(const eT val);
47
48 template<typename T1> inline Col(const Base<eT,T1>& X);
49 template<typename T1> inline const Col& operator=(const Base<eT,T1>& X);
50
51 inline Col( eT* aux_mem, const uword aux_length, const bool copy_aux_mem = true, const bool strict = true);
52 inline Col(const eT* aux_mem, const uword aux_length);
53
54 template<typename T1, typename T2>
55 inline explicit Col(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
56
57 template<typename T1> inline Col(const BaseCube<eT,T1>& X);
58 template<typename T1> inline const Col& operator=(const BaseCube<eT,T1>& X);
59
60 inline Col(const subview_cube<eT>& X);
61 inline const Col& operator=(const subview_cube<eT>& X);
62
63 inline mat_injector<Col> operator<<(const eT val);
64
65 arma_inline const Op<Col<eT>,op_htrans> t() const;
66 arma_inline const Op<Col<eT>,op_htrans> ht() const;
67 arma_inline const Op<Col<eT>,op_strans> st() const;
68
69 arma_inline eT& row(const uword row_num);
70 arma_inline eT row(const uword row_num) const;
71
72 arma_inline subview_col<eT> rows(const uword in_row1, const uword in_row2);
73 arma_inline const subview_col<eT> rows(const uword in_row1, const uword in_row2) const;
74
75 arma_inline subview_col<eT> subvec(const uword in_row1, const uword in_row2);
76 arma_inline const subview_col<eT> subvec(const uword in_row1, const uword in_row2) const;
77
78 arma_inline subview_col<eT> subvec(const span& row_span);
79 arma_inline const subview_col<eT> subvec(const span& row_span) const;
80
81 using Mat<eT>::operator();
82
83 arma_inline subview_col<eT> operator()(const span& row_span);
84 arma_inline const subview_col<eT> operator()(const span& row_span) const;
85
86
87 inline void shed_row (const uword row_num);
88 inline void shed_rows(const uword in_row1, const uword in_row2);
89
90 inline void insert_rows(const uword row_num, const uword N, const bool set_to_zero = true);
91 template<typename T1> inline void insert_rows(const uword row_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 Col(const arma_fixed_indicator&, const uword in_n_elem, const eT* in_mem);
117
118
119 public:
120
121 #ifdef ARMA_EXTRA_COL_PROTO
122 #include ARMA_INCFILE_WRAP(ARMA_EXTRA_COL_PROTO)
123 #endif
124 };
125
126
127
128 template<typename eT>
129 template<uword fixed_n_elem>
130 class Col<eT>::fixed : public Col<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 arma_inline void change_to_row();
139
140
141 public:
142
143 typedef fixed<fixed_n_elem> Col_fixed_type;
144
145 typedef eT elem_type;
146 typedef typename get_pod_type<eT>::result pod_type;
147
148 static const bool is_col = true;
149 static const bool is_row = false;
150
151 static const uword n_rows = fixed_n_elem;
152 static const uword n_cols = 1;
153 static const uword n_elem = fixed_n_elem;
154
155 arma_inline fixed();
156 arma_inline fixed(const fixed<fixed_n_elem>& X);
157 inline fixed(const subview_cube<eT>& X);
158
159 template<typename T1> inline fixed(const Base<eT,T1>& A);
160 template<typename T1, typename T2> inline fixed(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
161
162 inline fixed(const eT* aux_mem);
163
164 inline fixed(const char* text);
165 inline fixed(const std::string& text);
166
167 template<typename T1> inline const Col& operator=(const Base<eT,T1>& A);
168
169 inline const Col& operator=(const eT val);
170 inline const Col& operator=(const char* text);
171 inline const Col& operator=(const std::string& text);
172 inline const Col& operator=(const subview_cube<eT>& X);
173
174 using Col<eT>::operator();
175
176 #if defined(ARMA_USE_CXX11)
177 inline fixed(const std::initializer_list<eT>& list);
178 inline const Col& operator=(const std::initializer_list<eT>& list);
179 #endif
180
181 arma_inline const Op< Col_fixed_type, op_htrans > t() const;
182 arma_inline const Op< Col_fixed_type, op_htrans > ht() const;
183 arma_inline const Op< Col_fixed_type, op_strans > st() const;
184
185 arma_inline arma_warn_unused const eT& at_alt (const uword i) const;
186
187 arma_inline arma_warn_unused eT& operator[] (const uword i);
188 arma_inline arma_warn_unused const eT& operator[] (const uword i) const;
189 arma_inline arma_warn_unused eT& at (const uword i);
190 arma_inline arma_warn_unused const eT& at (const uword i) const;
191 arma_inline arma_warn_unused eT& operator() (const uword i);
192 arma_inline arma_warn_unused const eT& operator() (const uword i) const;
193
194 arma_inline arma_warn_unused eT& at (const uword in_row, const uword in_col);
195 arma_inline arma_warn_unused const eT& at (const uword in_row, const uword in_col) const;
196 arma_inline arma_warn_unused eT& operator() (const uword in_row, const uword in_col);
197 arma_inline arma_warn_unused const eT& operator() (const uword in_row, const uword in_col) const;
198
199 arma_inline arma_warn_unused eT* memptr();
200 arma_inline arma_warn_unused const eT* memptr() const;
201
202 arma_hot inline const Col<eT>& fill(const eT val);
203 arma_hot inline const Col<eT>& zeros();
204 arma_hot inline const Col<eT>& ones();
205 };
206
207
208
209 //! @}