25#include "fixed_general_matrix.h"
40 template <
int M,
class AT>
45 static constexpr bool isVector {
true};
47 using iterator = AT *;
48 using const_iterator =
const AT *;
50 using value_type = AT;
88 template<
class Type,
class Row,
class Col>
123 FMATVEC_ASSERT(x.size() == M, AT);
137 operator Vector<Fixed<M>,AT2>()
const {
138 Vector<Fixed<M>,AT2> ret;
139 for(
size_t i=0; i<M; ++i)
154 FMATVEC_ASSERT(i>=0, AT);
155 FMATVEC_ASSERT(i<M, AT);
166 FMATVEC_ASSERT(i>=0, AT);
167 FMATVEC_ASSERT(i<M, AT);
172 iterator begin() {
return &ele[0][0]; }
173 iterator end() {
return &ele[M-1][1]; }
174 const_iterator begin()
const {
return &ele[0][0]; }
175 const_iterator end()
const {
return &ele[M-1][1]; }
176 const_iterator cbegin() const noexcept {
return &ele[0][0]; }
177 const_iterator cend() const noexcept {
return &ele[M-1][1]; }
187 const AT&
e(
int i)
const {
200 inline Vector<Fixed<M>,AT>& init(Noinit,
const AT& a=AT()) {
return *
this; }
206 constexpr int size()
const {
return M;}
212 throw std::runtime_error(
"A fixed vector cannot be resized.");
221 int inc()
const {
return 1;}
223 template <
int M1,
int M2>
232 explicit inline operator std::vector<AT>()
const;
238 explicit inline Vector(
const std::vector<AT> &v);
263 template<
class Type,
class Row,
class Col>
267 template <
int M,
class AT>
269 for(
int i=0; i<M; i++)
274 template <
int M,
class AT>
template <
int M1,
int M2>
276 FMATVEC_ASSERT(M2<M, AT);
279 for(
int i=0; i<x.size(); i++)
285 template <
int M,
class AT>
288 for(
int i=0; i<M; i++)
293 template <
int M,
class AT>
295 std::vector<AT> ret(size());
296 for(
int i=0; i<size(); ++i)
301 template <
int M,
class AT>
303 for(
int i=0; i<size(); ++i)
309 template <
int M,
class AT>
template<
class Row>
311 for(
int i=0; i<M; i++)
318 template<
int M,
class AT>
template<
class Type,
class Row,
class Col>
Shape class for general matrices.
Definition: types.h:116
This is the basic matrix class for arbitrary matrices.
Definition: matrix.h:52
This is an index class for creating submatrices.
Definition: range.h:44
This is an index class for creating submatrices.
Definition: range.h:35
void resize(int m)
Definition: fixed_vector.h:210
constexpr int size() const
Size.
Definition: fixed_vector.h:206
const AT & operator()(int i) const
Element operator.
Definition: fixed_vector.h:164
Vector(const char *str)
String Constructor.
Definition: fixed_vector.h:104
const AT & e(int i) const
Element operator.
Definition: fixed_vector.h:187
Vector< Fixed< M >, AT > & operator=(const Vector< Fixed< M >, AT > &x)=default
Assignment operator.
AT & operator()(int i)
Element operator.
Definition: fixed_vector.h:152
Vector(const Matrix< Type, Row, Col, AT > &A)
Copy Constructor.
Definition: fixed_vector.h:89
int inc() const
Increment.
Definition: fixed_vector.h:221
Vector(const Vector< Fixed< M >, AT > &x)=default
Copy Constructor.
Vector(const Vector< Row, AT > &A)
Copy Constructor.
Definition: fixed_vector.h:81
Namespace fmatvec.
Definition: _memory.cc:28