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