comparison armadillo-2.4.4/include/armadillo_bits/Col_bones.hpp @ 0:8b6102e2a9b0

Armadillo Library
author maxzanoni76 <max.zanoni@eecs.qmul.ac.uk>
date Wed, 11 Apr 2012 09:27:06 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:8b6102e2a9b0
1 // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
2 // Copyright (C) 2008-2011 Conrad Sanderson
3 //
4 // This file is part of the Armadillo C++ library.
5 // It is provided without any warranty of fitness
6 // for any purpose. You can redistribute this file
7 // and/or modify it under the terms of the GNU
8 // Lesser General Public License (LGPL) as published
9 // by the Free Software Foundation, either version 3
10 // of the License or (at your option) any later version.
11 // (see http://www.opensource.org/licenses for more info)
12
13
14 //! \addtogroup Col
15 //! @{
16
17 //! Class for column vectors (matrices with only one column)
18
19 template<typename eT>
20 class Col : public Mat<eT>
21 {
22 public:
23
24 typedef eT elem_type;
25 typedef typename get_pod_type<eT>::result pod_type;
26
27
28 inline Col();
29 inline Col(const Col<eT>& X);
30 inline explicit Col(const uword n_elem);
31 inline Col(const uword in_rows, const uword in_cols);
32
33 inline Col(const char* text);
34 inline const Col& operator=(const char* text);
35
36 inline Col(const std::string& text);
37 inline const Col& operator=(const std::string& text);
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
45 inline const Col& operator=(const eT val);
46
47 template<typename T1> inline Col(const Base<eT,T1>& X);
48 template<typename T1> inline const Col& operator=(const Base<eT,T1>& X);
49
50 inline Col( eT* aux_mem, const uword aux_length, const bool copy_aux_mem = true, const bool strict = true);
51 inline Col(const eT* aux_mem, const uword aux_length);
52
53 template<typename T1, typename T2>
54 inline explicit Col(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
55
56 template<typename T1> inline Col(const BaseCube<eT,T1>& X);
57 template<typename T1> inline const Col& operator=(const BaseCube<eT,T1>& X);
58
59 inline Col(const subview_cube<eT>& X);
60 inline const Col& operator=(const subview_cube<eT>& X);
61
62 inline mat_injector<Col> operator<<(const eT val);
63
64 arma_inline eT& row(const uword row_num);
65 arma_inline eT row(const uword row_num) const;
66
67 arma_inline subview_col<eT> rows(const uword in_row1, const uword in_row2);
68 arma_inline const subview_col<eT> rows(const uword in_row1, const uword in_row2) const;
69
70 arma_inline subview_col<eT> subvec(const uword in_row1, const uword in_row2);
71 arma_inline const subview_col<eT> subvec(const uword in_row1, const uword in_row2) const;
72
73 arma_inline subview_col<eT> subvec(const span& row_span);
74 arma_inline const subview_col<eT> subvec(const span& row_span) const;
75
76 //arma_inline subview_col<eT> operator()(const span& row_span);
77 //arma_inline const subview_col<eT> operator()(const span& row_span) const;
78
79
80 inline void shed_row (const uword row_num);
81 inline void shed_rows(const uword in_row1, const uword in_row2);
82
83 inline void insert_rows(const uword row_num, const uword N, const bool set_to_zero = true);
84 template<typename T1> inline void insert_rows(const uword row_num, const Base<eT,T1>& X);
85
86
87 typedef eT* row_iterator;
88 typedef const eT* const_row_iterator;
89
90 inline row_iterator begin_row(const uword row_num);
91 inline const_row_iterator begin_row(const uword row_num) const;
92
93 inline row_iterator end_row (const uword row_num);
94 inline const_row_iterator end_row (const uword row_num) const;
95
96
97 template<uword fixed_n_elem>
98 class fixed : public Col<eT>
99 {
100 private:
101
102 static const bool use_extra = (fixed_n_elem > arma_config::mat_prealloc);
103
104 arma_aligned eT mem_local_extra[ (use_extra) ? fixed_n_elem : 1 ];
105
106 arma_inline void mem_setup();
107 arma_inline void change_to_row();
108
109
110 public:
111
112 static const uword n_rows = fixed_n_elem;
113 static const uword n_cols = 1;
114 static const uword n_elem = fixed_n_elem;
115
116 arma_inline fixed();
117 arma_inline fixed(const fixed<fixed_n_elem>& X);
118 inline fixed(const subview_cube<eT>& X);
119
120 template<typename T1> inline fixed(const Base<eT,T1>& A);
121 template<typename T1, typename T2> inline fixed(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
122
123 inline fixed( eT* aux_mem, const bool copy_aux_mem = true);
124 inline fixed(const eT* aux_mem);
125
126 inline fixed(const char* text);
127 inline fixed(const std::string& text);
128
129 template<typename T1> inline const Col& operator=(const Base<eT,T1>& A);
130
131 inline const Col& operator=(const eT val);
132 inline const Col& operator=(const char* text);
133 inline const Col& operator=(const std::string& text);
134 inline const Col& operator=(const subview_cube<eT>& X);
135
136 inline subview_row<eT> operator()(const uword row_num, const span& col_span);
137 inline const subview_row<eT> operator()(const uword row_num, const span& col_span) const;
138
139 inline subview_col<eT> operator()(const span& row_span, const uword col_num );
140 inline const subview_col<eT> operator()(const span& row_span, const uword col_num ) const;
141
142 inline subview<eT> operator()(const span& row_span, const span& col_span);
143 inline const subview<eT> operator()(const span& row_span, const span& col_span) const;
144
145 arma_inline arma_warn_unused eT& operator[] (const uword i);
146 arma_inline arma_warn_unused eT operator[] (const uword i) const;
147 arma_inline arma_warn_unused eT& at (const uword i);
148 arma_inline arma_warn_unused eT at (const uword i) const;
149 arma_inline arma_warn_unused eT& operator() (const uword i);
150 arma_inline arma_warn_unused eT operator() (const uword i) const;
151
152 arma_inline arma_warn_unused eT& at (const uword in_row, const uword in_col);
153 arma_inline arma_warn_unused eT at (const uword in_row, const uword in_col) const;
154 arma_inline arma_warn_unused eT& operator() (const uword in_row, const uword in_col);
155 arma_inline arma_warn_unused eT operator() (const uword in_row, const uword in_col) const;
156
157 arma_hot inline const Col<eT>& fill(const eT val);
158 arma_hot inline const Col<eT>& zeros();
159 arma_hot inline const Col<eT>& ones();
160 };
161
162
163 #ifdef ARMA_EXTRA_COL_PROTO
164 #include ARMA_INCFILE_WRAP(ARMA_EXTRA_COL_PROTO)
165 #endif
166
167 };
168
169
170
171 //! @}