125 template<
int Size=Dynamic,
typename Precision=DefaultPrecision,
typename Base=Internal::VBase>
126 struct Vector :
public Base::template VLayout<Size, Precision> {
135 typedef typename Base::template VLayout<Size, Precision>::PointerType PointerType;
156 explicit inline Vector(
int size_in) : Base::template VLayout<Size, Precision>(size_in) {}
164 explicit inline Vector(PointerType data) : Base::template VLayout<Size, Precision> (data) {}
170 template<
typename X=Precision>
171 inline Vector(std::initializer_list<Precision> init,
typename std::enable_if<
sizeof(X)&&(Size <0)>::type* = 0)
172 :Base::template VLayout<Size, Precision> (init)
180 template<
typename Precision2,
int Size2>
181 inline Vector(
const Precision2(&init)[Size2])
182 :Base::template VLayout<Size, Precision> (init)
191 inline Vector(PointerType data,
int size_in) : Base::template VLayout<Size, Precision> (data, size_in) {}
195 : Base::template VLayout<Size, Precision>(data_in, size_in, stride_in) {}
197 using Base::template VLayout<Size, Precision>::size;
198 using Base::template VLayout<Size, Precision>::try_destructive_resize;
207 : Base::template VLayout<Size, Precision> (op)
222 template<
int Size2,
typename Precision2,
typename Base2>
224 Base::template VLayout<Size, Precision>(from.size()) {
230 #ifdef DOXYGEN_INCLUDE_ONLY_FOR_DOCS 245 Precision& operator[] (
int i);
250 const Precision& operator[] (
int i)
const;
264 try_destructive_resize(from.size());
267 for(
int i=0; i<s; i++){
276 template<
int Size2,
typename Precision2,
typename Base2>
278 try_destructive_resize(from.size());
281 for(
int i=0; i<s; i++){
293 try_destructive_resize(op);
304 for(
int i=0; i<size(); i++)
311 for(
int i=0; i<size(); i++)
317 template<
int Size2,
class Precision2,
class Base2>
320 for(
int i=0; i<size(); i++)
335 op.plusequals(*
this);
342 op.minusequals(*
this);
347 template<
int Size2,
class Precision2,
class Base2>
350 for(
int i=0; i<size(); i++)
361 template<
int Size2,
class Precision2,
class Base2>
364 for(
int i=0; i<size(); i++)
365 if((*
this)[i]!=rhs[i])
371 template<
int Size2,
class Precision2,
class Base2>
374 for(
int i=0; i<size(); i++)
375 if((*
this)[i]!=rhs[i])
384 return op.notequal(*
this);
398 #ifdef DOXYGEN_INCLUDE_ONLY_FOR_DOCS 419 Precision* get_data_ptr();
475 template<Start, Length>
491 template<Start, Length>
506 template<Start, Length>
522 template<Start, Length>
Vector & operator*=(const Precision rhs)
multiply this vector by a constant
Definition: vector.hh:310
Vector & operator+=(const Vector< Size2, Precision2, Base2 > &rhs)
add another vector onto this one
Definition: vector.hh:318
bool operator==(const Vector< Size2, Precision2, Base2 > &rhs) const
Test for equality with another vector.
Definition: vector.hh:362
Vector()
Default constructor for vectors.
Definition: vector.hh:148
static const int SizeParameter
Value of template Size parameter.
Definition: vector.hh:133
Vector & operator-=(const Vector< Size2, Precision2, Base2 > &rhs)
subtract another vector from this one
Definition: vector.hh:348
Vector(const Vector< Size2, Precision2, Base2 > &from)
constructor from arbitrary vector
Definition: vector.hh:223
Pretty generic SFINAE introspection generator.
Definition: vec_test.cc:21
A vector.
Definition: vector.hh:126
Vector & operator=(const Vector &from)
operator = from copy A size mismatch is a fatal error, unless the destination is resizable.
Definition: vector.hh:263
A matrix.
Definition: matrix.hh:105
Vector(const Precision2(&init)[Size2])
Construct from an array by reference.
Definition: vector.hh:181
Vector(PointerType data_in, int size_in, int stride_in, Internal::Slicing)
internal constructor
Definition: vector.hh:194
Vector(std::initializer_list< Precision > init, typename std::enable_if< sizeof(X)&&(Size< 0)>::type *=0)
Construct from an initializer list.
Definition: vector.hh:171
A diagonal matrix.
Definition: diagmatrix.h:108
Definition: operators.hh:119
Vector(const Operator< Op > &op)
construction from Operator object
Definition: vector.hh:206
Vector(int size_in)
Constructor for dynamically-size vectors.
Definition: vector.hh:156
Vector & operator/=(const Precision rhs)
divide this vector by a constant
Definition: vector.hh:303
Vector & operator+=(const Operator< Op > &op)
add an Operator object onto this vector
Definition: vector.hh:333
bool operator!=(const Vector< Size2, Precision2, Base2 > &rhs) const
Test for inequality with another vector.
Definition: vector.hh:372
Vector(PointerType data)
Constructor used when constructing a vector which references other data, e.g.
Definition: vector.hh:164
Vector & ref()
return me as a non const reference - useful for temporaries
Definition: vector.hh:393
Definition: size_mismatch.hh:103
Vector & operator=(const Operator< Op > &op)
assignment from an Operator object Assignment from sized operators causes a resize of Resizable Vecto...
Definition: vector.hh:292
Vector(PointerType data, int size_in)
Constructor used when constructing a dynamic vector which references other data, e.g.
Definition: vector.hh:191