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