22 #ifndef fixed_vector_h
23 #define fixed_vector_h
25 #include "fixed_general_matrix.h"
40 template <
int M,
class AT>
46 typedef AT AtomicType;
98 template<
class Type,
class Row,
class Col>
117 #ifndef FMATVEC_NO_BOUNDS_CHECK
131 #ifndef FMATVEC_NO_BOUNDS_CHECK
147 const AT&
e(
int i)
const {
160 inline Vector<Fixed<M>,AT>& init(Noinit,
const AT& a=0) {
return *
this; }
172 throw std::runtime_error(
"A fixed vector cannot be resized.");
181 int inc()
const {
return 1;};
183 template <
int M1,
int M2>
192 inline operator std::vector<AT>();
198 inline Vector(std::vector<AT> v);
208 template<
class Type,
class Row,
class Col>
213 template <
int M,
class AT>
215 for(
int i=0; i<M; i++)
220 template <
int M,
class AT>
template <
int M1,
int M2>
222 #ifndef FMATVEC_NO_BOUNDS_CHECK
227 for(
int i=0; i<x.size(); i++)
233 template <
int M,
class AT>
template <
class Row>
234 inline Vector<Fixed<M>,AT>& Vector<Fixed<M>,AT>::operator=(
const Vector<Row,AT> &x) {
236 #ifndef FMATVEC_NO_SIZE_CHECK
237 assert(x.size() == M);
245 template <
int M,
class AT>
248 for(
int i=0; i<M; i++)
253 template <
int M,
class AT>
255 std::vector<AT> ret(size());
256 if(size()>0) memcpy(&ret[0], &
operator()(0),
sizeof(AT)*size());
260 template <
int M,
class AT>
262 if(size()>0) memcpy(&
operator()(0), &v[0],
sizeof(AT)*size());
267 template <
int M,
class AT>
template<
class Row>
269 for(
int i=0; i<M; i++)
275 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:170
Vector(const Matrix< Type, Row, Col, AT > &A)
Copy Constructor.
Definition: fixed_vector.h:99
Vector(const Vector< Row, AT > &x)
Copy Constructor.
Definition: fixed_vector.h:91
This is an index class for creating submatrices.
Definition: range.h:35
const AT & e(int i) const
Element operator.
Definition: fixed_vector.h:147
int size() const
Size.
Definition: fixed_vector.h:166
int inc() const
Increment.
Definition: fixed_vector.h:181
Basic shape class for matrices.
Definition: types.h:100
AT & operator()(int i)
Element operator.
Definition: fixed_vector.h:115
const AT & operator()(int i) const
Element operator.
Definition: fixed_vector.h:129
Vector(const char *str)
String Constructor.
Definition: fixed_vector.h:80
This is an index class for creating submatrices.
Definition: range.h:44