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;
101 template<
class Type,
class Row,
class Col>
120 #ifndef FMATVEC_NO_BOUNDS_CHECK
134 #ifndef FMATVEC_NO_BOUNDS_CHECK
142 iterator begin() {
return &ele[0][0]; }
143 iterator end() {
return &ele[M][0]; }
144 const_iterator begin()
const {
return &ele[0][0]; }
145 const_iterator end()
const {
return &ele[M][0]; }
146 const_iterator cbegin() const noexcept {
return &ele[0][0]; }
147 const_iterator cend() const noexcept {
return &ele[M][0]; }
157 const AT&
e(
int i)
const {
170 inline Vector<Fixed<M>,AT>& init(Noinit,
const AT& a=0) {
return *
this; }
182 throw std::runtime_error(
"A fixed vector cannot be resized.");
191 int inc()
const {
return 1;};
193 template <
int M1,
int M2>
202 inline operator std::vector<AT>()
const;
208 inline Vector(std::vector<AT> v);
218 template<
class Type,
class Row,
class Col>
223 template <
int M,
class AT>
225 for(
int i=0; i<M; i++)
230 template <
int M,
class AT>
template <
int M1,
int M2>
232 #ifndef FMATVEC_NO_BOUNDS_CHECK
237 for(
int i=0; i<x.size(); i++)
243 template <
int M,
class AT>
template <
class Row>
244 inline Vector<Fixed<M>,AT>& Vector<Fixed<M>,AT>::operator=(
const Vector<Row,AT> &x) {
246 #ifndef FMATVEC_NO_SIZE_CHECK
247 assert(x.size() == M);
255 template <
int M,
class AT>
258 for(
int i=0; i<M; i++)
263 template <
int M,
class AT>
265 std::vector<AT> ret(size());
266 if(size()>0) memcpy(&ret[0], &
operator()(0),
sizeof(AT)*size());
270 template <
int M,
class AT>
272 if(size()>0) memcpy(&
operator()(0), &v[0],
sizeof(AT)*size());
277 template <
int M,
class AT>
template<
class Row>
279 for(
int i=0; i<M; i++)
285 template<
int M,
class AT>
template<
class Type,
class Row,
class Col>
This is the basic matrix class for arbitrary matrices.
Definition: fmatvec.h:41
void resize(int m)
Definition: fixed_vector.h:180
Vector(const Matrix< Type, Row, Col, AT > &A)
Copy Constructor.
Definition: fixed_vector.h:102
Vector(const Vector< Row, AT > &x)
Copy Constructor.
Definition: fixed_vector.h:94
This is an index class for creating submatrices.
Definition: range.h:35
const AT & e(int i) const
Element operator.
Definition: fixed_vector.h:157
int size() const
Size.
Definition: fixed_vector.h:176
int inc() const
Increment.
Definition: fixed_vector.h:191
Basic shape class for matrices.
Definition: types.h:100
AT & operator()(int i)
Element operator.
Definition: fixed_vector.h:118
const AT & operator()(int i) const
Element operator.
Definition: fixed_vector.h:132
Vector(const char *str)
String Constructor.
Definition: fixed_vector.h:83
This is an index class for creating submatrices.
Definition: range.h:44