12 for(
size_t i = 0; i <
n; i++)
p[i] = other[i];
16 template <
class Type,
int n>
21 for(
int i=0; i<n; i++)
data[i] = other.
data[i];
24 for(
int i=0; i<n; i++)
data[i] = other;
27 int size()
const {
return n; }
30 void setZero() {
for(
int i=0; i<n; i++) (*
this)[i] = 0;}
35 #define VBINARY_OPERATOR(OP) \
36 tiny_vec operator OP (const tiny_vec &other) const { \
38 for(int i=0; i<n; i++) ans.data[i] = data[i] OP other.data[i]; \
41 template<class Scalar> \
42 tiny_vec operator OP (const Scalar &other) const { \
44 for(int i=0; i<n; i++) ans.data[i] = data[i] OP other; \
51 #define VUNARY_OPERATOR(OP) \
52 tiny_vec operator OP () const { \
54 for(int i=0; i<n; i++) ans.data[i] = OP (*this).data[i]; \
59 #define COMPOUND_ASSIGNMENT_OPERATOR(OP) \
60 tiny_vec& operator OP (const Type &other) { \
61 for(int i=0; i<n; i++) (*this).data[i] OP other; \
64 tiny_vec& operator OP (const tiny_vec &other) { \
65 for(int i=0; i<n; i++) (*this).data[i] OP other[i]; \
74 operator vector<Type>(){
76 for(
int i=0; i<n; i++) ans[i] = (*
this)[i];
82 template<
class Type,
int n>
84 return y.operator* (
x);
87 template<
class Type,
int n>
88 std::ostream &operator<<(std::ostream &os, tiny_vec<Type, n>
const &
x) {
90 for(
int i=0; i <
x.size(); i++) os <<
x[i] <<
" ";
tiny_vec(const tiny_vec &other)
Type operator[](size_t i) const
#define VBINARY_OPERATOR(OP)
tiny_vec_ref(Type *p_, size_t n_)
dmatrix operator*(const d3_array &t, const dvector &v)
Description not yet available.
tiny_vec_ref< Type > segment(size_t start, size_t length)
tiny_vec_ref & operator=(const T &other)
#define VUNARY_OPERATOR(OP)
tiny_vec(const Type &other)
void resize(size_t length)
size_t length(const adstring &t)
Returns the size of adstr.
#define COMPOUND_ASSIGNMENT_OPERATOR(OP)