1 #ifndef RKSmallVector_H
2 #define RKSmallVector_H
8 template<
typename T,
int N>
27 int dim()
const {
return N;}
89 template <
class T,
int N>
90 inline std::ostream & operator<<( std::ostream& s, const RKSmallVector<T,N>&
v) {
92 for (
int i=0;
i<
N; ++
i)
s <<
"v[" <<
i <<
"] = " <<
v[
i] << std::endl;
97 template <
class T,
class U,
int N>
102 for (
int i=0;
i<
N; ++
i) r[
i] = a[
i]+b[
i];
105 template <
class T,
class U,
int N>
110 for (
int i=0;
i<
N; ++
i) r[
i] = a[
i]-b[
i];
117 template <
class T,
class Scal,
int N>
119 T
t =
static_cast<T
>(
s);
121 for (
int i=0;
i<
N; ++
i) r[
i] = t*v[
i];
124 template <
class T,
class Scal,
int N>
126 T
t =
static_cast<T
>(
s);
128 for (
int i=0;
i<
N; ++
i) r[
i] = t*v[
i];
135 template <
class T,
class Scal,
int N>
137 T
t =
static_cast<T
>(
s);
139 for (
int i=0;
i<
N; ++
i) r[
i] = v[
i]/t;
T dot(const RKSmallVector &v) const
Scalar product, or "dot" product, with a vector of same type.
RKSmallVector & operator+=(const RKSmallVector< U, N > &v)
Operations with vector of same size.
MatrixMeschach operator+(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
RKSmallVector & operator*=(const T &t)
Scaling by a scalar value (multiplication)
MatrixMeschach operator-(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
RKSmallVector(Iter begin, Iter end)
const T & operator()(int i) const
access to values
RKSmallVector & operator/=(const T &t)
Scaling by a scalar value (division)
RKSmallVector(const Scalar *d)
Construct from array.
RKSmallVector & operator-=(const RKSmallVector< U, N > &v)
Basic2DVector< T > operator/(const Basic2DVector< T > &v, const Scalar &s)
RKSmallVector operator-() const
Unary minus, returns a vector with negated components.
const T & operator[](int i) const
RKSmallVector & increment(const RKSmallVector< U, N > &v, const T &t)
Increment by another vector multiplied by a scalar.
MatrixMeschach operator*(const MatrixMeschach &mat1, const MatrixMeschach &mat2)