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 Col
|
max@0
|
15 //! @{
|
max@0
|
16
|
max@0
|
17 //! Class for column vectors (matrices with only one column)
|
max@0
|
18
|
max@0
|
19 template<typename eT>
|
max@0
|
20 class Col : public Mat<eT>
|
max@0
|
21 {
|
max@0
|
22 public:
|
max@0
|
23
|
max@0
|
24 typedef eT elem_type;
|
max@0
|
25 typedef typename get_pod_type<eT>::result pod_type;
|
max@0
|
26
|
max@0
|
27
|
max@0
|
28 inline Col();
|
max@0
|
29 inline Col(const Col<eT>& X);
|
max@0
|
30 inline explicit Col(const uword n_elem);
|
max@0
|
31 inline Col(const uword in_rows, const uword in_cols);
|
max@0
|
32
|
max@0
|
33 inline Col(const char* text);
|
max@0
|
34 inline const Col& operator=(const char* text);
|
max@0
|
35
|
max@0
|
36 inline Col(const std::string& text);
|
max@0
|
37 inline const Col& operator=(const std::string& text);
|
max@0
|
38
|
max@0
|
39 #if defined(ARMA_USE_CXX11)
|
max@0
|
40 inline Col(const std::initializer_list<eT>& list);
|
max@0
|
41 inline const Col& operator=(const std::initializer_list<eT>& list);
|
max@0
|
42 #endif
|
max@0
|
43
|
max@0
|
44
|
max@0
|
45 inline const Col& operator=(const eT val);
|
max@0
|
46
|
max@0
|
47 template<typename T1> inline Col(const Base<eT,T1>& X);
|
max@0
|
48 template<typename T1> inline const Col& operator=(const Base<eT,T1>& X);
|
max@0
|
49
|
max@0
|
50 inline Col( eT* aux_mem, const uword aux_length, const bool copy_aux_mem = true, const bool strict = true);
|
max@0
|
51 inline Col(const eT* aux_mem, const uword aux_length);
|
max@0
|
52
|
max@0
|
53 template<typename T1, typename T2>
|
max@0
|
54 inline explicit Col(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
|
max@0
|
55
|
max@0
|
56 template<typename T1> inline Col(const BaseCube<eT,T1>& X);
|
max@0
|
57 template<typename T1> inline const Col& operator=(const BaseCube<eT,T1>& X);
|
max@0
|
58
|
max@0
|
59 inline Col(const subview_cube<eT>& X);
|
max@0
|
60 inline const Col& operator=(const subview_cube<eT>& X);
|
max@0
|
61
|
max@0
|
62 inline mat_injector<Col> operator<<(const eT val);
|
max@0
|
63
|
max@0
|
64 arma_inline eT& row(const uword row_num);
|
max@0
|
65 arma_inline eT row(const uword row_num) const;
|
max@0
|
66
|
max@0
|
67 arma_inline subview_col<eT> rows(const uword in_row1, const uword in_row2);
|
max@0
|
68 arma_inline const subview_col<eT> rows(const uword in_row1, const uword in_row2) const;
|
max@0
|
69
|
max@0
|
70 arma_inline subview_col<eT> subvec(const uword in_row1, const uword in_row2);
|
max@0
|
71 arma_inline const subview_col<eT> subvec(const uword in_row1, const uword in_row2) const;
|
max@0
|
72
|
max@0
|
73 arma_inline subview_col<eT> subvec(const span& row_span);
|
max@0
|
74 arma_inline const subview_col<eT> subvec(const span& row_span) const;
|
max@0
|
75
|
max@0
|
76 //arma_inline subview_col<eT> operator()(const span& row_span);
|
max@0
|
77 //arma_inline const subview_col<eT> operator()(const span& row_span) const;
|
max@0
|
78
|
max@0
|
79
|
max@0
|
80 inline void shed_row (const uword row_num);
|
max@0
|
81 inline void shed_rows(const uword in_row1, const uword in_row2);
|
max@0
|
82
|
max@0
|
83 inline void insert_rows(const uword row_num, const uword N, const bool set_to_zero = true);
|
max@0
|
84 template<typename T1> inline void insert_rows(const uword row_num, const Base<eT,T1>& X);
|
max@0
|
85
|
max@0
|
86
|
max@0
|
87 typedef eT* row_iterator;
|
max@0
|
88 typedef const eT* const_row_iterator;
|
max@0
|
89
|
max@0
|
90 inline row_iterator begin_row(const uword row_num);
|
max@0
|
91 inline const_row_iterator begin_row(const uword row_num) const;
|
max@0
|
92
|
max@0
|
93 inline row_iterator end_row (const uword row_num);
|
max@0
|
94 inline const_row_iterator end_row (const uword row_num) const;
|
max@0
|
95
|
max@0
|
96
|
max@0
|
97 template<uword fixed_n_elem>
|
max@0
|
98 class fixed : public Col<eT>
|
max@0
|
99 {
|
max@0
|
100 private:
|
max@0
|
101
|
max@0
|
102 static const bool use_extra = (fixed_n_elem > arma_config::mat_prealloc);
|
max@0
|
103
|
max@0
|
104 arma_aligned eT mem_local_extra[ (use_extra) ? fixed_n_elem : 1 ];
|
max@0
|
105
|
max@0
|
106 arma_inline void mem_setup();
|
max@0
|
107 arma_inline void change_to_row();
|
max@0
|
108
|
max@0
|
109
|
max@0
|
110 public:
|
max@0
|
111
|
max@0
|
112 static const uword n_rows = fixed_n_elem;
|
max@0
|
113 static const uword n_cols = 1;
|
max@0
|
114 static const uword n_elem = fixed_n_elem;
|
max@0
|
115
|
max@0
|
116 arma_inline fixed();
|
max@0
|
117 arma_inline fixed(const fixed<fixed_n_elem>& X);
|
max@0
|
118 inline fixed(const subview_cube<eT>& X);
|
max@0
|
119
|
max@0
|
120 template<typename T1> inline fixed(const Base<eT,T1>& A);
|
max@0
|
121 template<typename T1, typename T2> inline fixed(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
|
max@0
|
122
|
max@0
|
123 inline fixed( eT* aux_mem, const bool copy_aux_mem = true);
|
max@0
|
124 inline fixed(const eT* aux_mem);
|
max@0
|
125
|
max@0
|
126 inline fixed(const char* text);
|
max@0
|
127 inline fixed(const std::string& text);
|
max@0
|
128
|
max@0
|
129 template<typename T1> inline const Col& operator=(const Base<eT,T1>& A);
|
max@0
|
130
|
max@0
|
131 inline const Col& operator=(const eT val);
|
max@0
|
132 inline const Col& operator=(const char* text);
|
max@0
|
133 inline const Col& operator=(const std::string& text);
|
max@0
|
134 inline const Col& operator=(const subview_cube<eT>& X);
|
max@0
|
135
|
max@0
|
136 inline subview_row<eT> operator()(const uword row_num, const span& col_span);
|
max@0
|
137 inline const subview_row<eT> operator()(const uword row_num, const span& col_span) const;
|
max@0
|
138
|
max@0
|
139 inline subview_col<eT> operator()(const span& row_span, const uword col_num );
|
max@0
|
140 inline const subview_col<eT> operator()(const span& row_span, const uword col_num ) const;
|
max@0
|
141
|
max@0
|
142 inline subview<eT> operator()(const span& row_span, const span& col_span);
|
max@0
|
143 inline const subview<eT> operator()(const span& row_span, const span& col_span) const;
|
max@0
|
144
|
max@0
|
145 arma_inline arma_warn_unused eT& operator[] (const uword i);
|
max@0
|
146 arma_inline arma_warn_unused eT operator[] (const uword i) const;
|
max@0
|
147 arma_inline arma_warn_unused eT& at (const uword i);
|
max@0
|
148 arma_inline arma_warn_unused eT at (const uword i) const;
|
max@0
|
149 arma_inline arma_warn_unused eT& operator() (const uword i);
|
max@0
|
150 arma_inline arma_warn_unused eT operator() (const uword i) const;
|
max@0
|
151
|
max@0
|
152 arma_inline arma_warn_unused eT& at (const uword in_row, const uword in_col);
|
max@0
|
153 arma_inline arma_warn_unused eT at (const uword in_row, const uword in_col) const;
|
max@0
|
154 arma_inline arma_warn_unused eT& operator() (const uword in_row, const uword in_col);
|
max@0
|
155 arma_inline arma_warn_unused eT operator() (const uword in_row, const uword in_col) const;
|
max@0
|
156
|
max@0
|
157 arma_hot inline const Col<eT>& fill(const eT val);
|
max@0
|
158 arma_hot inline const Col<eT>& zeros();
|
max@0
|
159 arma_hot inline const Col<eT>& ones();
|
max@0
|
160 };
|
max@0
|
161
|
max@0
|
162
|
max@0
|
163 #ifdef ARMA_EXTRA_COL_PROTO
|
max@0
|
164 #include ARMA_INCFILE_WRAP(ARMA_EXTRA_COL_PROTO)
|
max@0
|
165 #endif
|
max@0
|
166
|
max@0
|
167 };
|
max@0
|
168
|
max@0
|
169
|
max@0
|
170
|
max@0
|
171 //! @}
|