22 #ifndef fixed_vector_h 23 #define fixed_vector_h 25 #include "fixed_general_matrix.h" 40 template <
int M,
class AT>
47 typedef const AT* const_iterator;
49 typedef AT value_type;
87 template<
class Type,
class Row,
class Col>
122 FMATVEC_ASSERT(x.size() == M, AT);
138 for(
size_t i=0; i<M; ++i)
153 FMATVEC_ASSERT(i>=0, AT);
154 FMATVEC_ASSERT(i<M, AT);
165 FMATVEC_ASSERT(i>=0, AT);
166 FMATVEC_ASSERT(i<M, AT);
171 iterator begin() {
return &ele[0][0]; }
172 iterator end() {
return &ele[M][0]; }
173 const_iterator begin()
const {
return &ele[0][0]; }
174 const_iterator end()
const {
return &ele[M][0]; }
175 const_iterator cbegin() const noexcept {
return &ele[0][0]; }
176 const_iterator cend() const noexcept {
return &ele[M][0]; }
186 const AT&
e(
int i)
const {
199 inline Vector<Fixed<M>,AT>& init(Noinit,
const AT& a=AT()) {
return *
this; }
211 throw std::runtime_error(
"A fixed vector cannot be resized.");
220 int inc()
const {
return 1;}
222 template <
int M1,
int M2>
231 explicit inline operator std::vector<AT>()
const;
237 explicit inline Vector(
const std::vector<AT> &v);
262 template<
class Type,
class Row,
class Col>
266 template <
int M,
class AT>
268 for(
int i=0; i<M; i++)
273 template <
int M,
class AT>
template <
int M1,
int M2>
275 FMATVEC_ASSERT(M2<M, AT);
278 for(
int i=0; i<x.size(); i++)
284 template <
int M,
class AT>
287 for(
int i=0; i<M; i++)
292 template <
int M,
class AT>
294 std::vector<AT> ret(size());
295 if(size()>0) memcpy(&ret[0], &
operator()(0),
sizeof(AT)*size());
299 template <
int M,
class AT>
301 if(size()>0) memcpy(&
operator()(0), &v[0],
sizeof(AT)*size());
306 template <
int M,
class AT>
template<
class Row>
308 for(
int i=0; i<M; i++)
315 template<
int M,
class AT>
template<
class Type,
class Row,
class Col>
Vector(const Vector< Row, AT > &A)
Copy Constructor.
Definition: fixed_vector.h:80
This is the basic matrix class for arbitrary matrices.
Definition: fmatvec.h:41
void resize(int m)
Definition: fixed_vector.h:209
int inc() const
Increment.
Definition: fixed_vector.h:220
Vector(const Matrix< Type, Row, Col, AT > &A)
Copy Constructor.
Definition: fixed_vector.h:88
Vector< Fixed< M >, AT > & operator=(const Vector< Row, AT > &x)
Assignment operator.
Definition: fixed_vector.h:121
const AT & e(int i) const
Element operator.
Definition: fixed_vector.h:186
int size() const
Size.
Definition: fixed_vector.h:205
This is an index class for creating submatrices.
Definition: range.h:35
Namespace fmatvec.
Definition: _memory.cc:28
const AT & operator()(int i) const
Element operator.
Definition: fixed_vector.h:163
Basic shape class for matrices.
Definition: types.h:132
AT & operator()(int i)
Element operator.
Definition: fixed_vector.h:151
Vector(const char *str)
String Constructor.
Definition: fixed_vector.h:103
This is an index class for creating submatrices.
Definition: range.h:44