22#ifndef fixed_row_vector_h
23#define fixed_row_vector_h
25#include "fixed_general_matrix.h"
43 static constexpr bool isVector {
true};
45 using iterator = AT *;
46 using const_iterator =
const AT *;
48 using value_type = AT;
88 template<
class Type,
class Row,
class Col>
123 FMATVEC_ASSERT(x.size() == N, AT);
145 FMATVEC_ASSERT(i>=0, AT);
146 FMATVEC_ASSERT(i<N, AT);
155 FMATVEC_ASSERT(i>=0, AT);
156 FMATVEC_ASSERT(i<N, AT);
160 iterator begin() {
return &ele[0][0]; }
161 iterator end() {
return &ele[0][N]; }
162 const_iterator begin()
const {
return &ele[0][0]; }
163 const_iterator end()
const {
return &ele[0][N]; }
164 const_iterator cbegin() const noexcept {
return &ele[0][0]; }
165 const_iterator cend() const noexcept {
return &ele[0][N]; }
175 const AT&
e(
int i)
const {
188 inline RowVector<Fixed<N>,AT>& init(Noinit,
const AT &a=AT()) {
return *
this; }
194 constexpr int size()
const {
return N;}
200 throw std::runtime_error(
"A fixed row vector cannot be resized.");
209 int inc()
const {
return 1;}
217 explicit inline operator std::vector<AT>()
const;
223 explicit inline RowVector(
const std::vector<AT> &v);
243 template <
int N,
class AT>
245 for(
int i=0; i<N; i++)
250 template <
int N,
class AT>
253 for(
int i=0; i<N; i++)
258 template <
int N,
class AT>
260 std::vector<AT> ret(size());
261 for(
int i=0; i<size(); ++i)
266 template <
int N,
class AT>
268 for(
int i=0; i<size(); ++i)
274 template <
int N,
class AT>
template <
class Col>
276 for(
int i=0; i<N; i++)
Shape class for general matrices.
Definition: types.h:116
This is the basic matrix class for arbitrary matrices.
Definition: matrix.h:52
constexpr int size() const
Size.
Definition: fixed_row_vector.h:194
RowVector(const RowVector< Row, AT > &A)
Copy Constructor.
Definition: fixed_row_vector.h:81
RowVector< Fixed< N >, AT > & operator=(const RowVector< Fixed< N >, AT > &x)=default
Assignment operator.
RowVector(const RowVector< Fixed< N >, AT > &A)=default
Copy Constructor.
void resize(int n)
Definition: fixed_row_vector.h:198
int inc() const
Increment.
Definition: fixed_row_vector.h:209
const AT & e(int i) const
Element operator.
Definition: fixed_row_vector.h:175
RowVector(const char *str)
String Constructor.
Definition: fixed_row_vector.h:104
const AT & operator()(int i) const
Element operator.
Definition: fixed_row_vector.h:154
RowVector(const Matrix< Type, Row, Col, AT > &A)
Copy Constructor.
Definition: fixed_row_vector.h:89
AT & operator()(int i)
Element operator.
Definition: fixed_row_vector.h:144
Namespace fmatvec.
Definition: _memory.cc:28