class_ops.h File Reference

Vector class operators. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define _DO_VECTOR_SET_RESIZE(_N_)   cml::et::detail::Resize(*this,_N_)
#define CML_ASSIGN_VEC_2
 Set a vector from 2 values.
#define CML_ASSIGN_VEC_3
 Set a vector from 3 values.
#define CML_ASSIGN_VEC_4
 Create a vector from 4 values.
#define CML_CONSTRUCT_FROM_SUBVEC(_add_)
 Create a (fixed-size) N vector from an N-1-vector and a scalar.
#define CML_CONSTRUCT_VEC_2(_add_)
 Create a vector from 2 values.
#define CML_CONSTRUCT_VEC_3(_add_)
 Create a vector from 3 values.
#define CML_CONSTRUCT_VEC_4(_add_)
 Create a vector from 4 values.
#define CML_VEC_ASSIGN_FROM_SCALAR(_op_, _op_name_)
 Declare a function to assign this vector from a scalar.
#define CML_VEC_ASSIGN_FROM_VEC(_op_, _op_name_)
 Assign this vector from another using the given elementwise op.
#define CML_VEC_ASSIGN_FROM_VECTYPE
 Assign from the same vector type.
#define CML_VEC_ASSIGN_FROM_VECXPR(_op_, _op_name_)
 Declare a function to assign this vector from a vector expression.
#define CML_VEC_COPY_FROM_ARRAY(_add_)
 Copy-construct a vector from a runtime-sized array of values.
#define CML_VEC_COPY_FROM_FIXED_ARRAY(_N_, _add_)
 Copy-construct a vector from a fixed-size array of values.
#define CML_VEC_COPY_FROM_VEC
 Construct from an arbitrary vector.
#define CML_VEC_COPY_FROM_VECTYPE(_add_)
 Copy-construct a vector.
#define CML_VEC_COPY_FROM_VECXPR
 Construct from a vector expression.


Detailed Description

Vector class operators.

Definition in file class_ops.h.


Define Documentation

#define _DO_VECTOR_SET_RESIZE ( _N_   )     cml::et::detail::Resize(*this,_N_)

Definition at line 26 of file class_ops.h.

#define CML_ASSIGN_VEC_2

Value:

vector_type&                                                            \
set(ELEMENT_ARG_TYPE e0, ELEMENT_ARG_TYPE e1) {                         \
    _DO_VECTOR_SET_RESIZE(2);                                           \
    /* This is overkill, but simplifies size checking: */               \
    value_type v[] = {e0,e1};                                           \
    typedef et::OpAssign<Element,Element> OpT;                          \
    cml::vector< const value_type, external<2> > src(v);                \
    et::UnrollAssignment<OpT>(*this,src);                               \
    return *this;                                                       \
}
Set a vector from 2 values.

Definition at line 32 of file class_ops.h.

#define CML_ASSIGN_VEC_3

Value:

vector_type&                                                            \
set(                                                                    \
        ELEMENT_ARG_TYPE e0,                                            \
        ELEMENT_ARG_TYPE e1,                                            \
        ELEMENT_ARG_TYPE e2                                             \
        )                                                               \
{                                                                       \
    _DO_VECTOR_SET_RESIZE(3);                                           \
    /* This is overkill, but simplifies size checking: */               \
    value_type v[] = {e0,e1,e2};                                        \
    typedef et::OpAssign<Element,Element> OpT;                          \
    cml::vector< const value_type, external<3> > src(v);                \
    et::UnrollAssignment<OpT>(*this,src);                               \
    return *this;                                                       \
}
Set a vector from 3 values.

Definition at line 45 of file class_ops.h.

#define CML_ASSIGN_VEC_4

Value:

vector_type&                                                            \
set(                                                                    \
        ELEMENT_ARG_TYPE e0,                                            \
        ELEMENT_ARG_TYPE e1,                                            \
        ELEMENT_ARG_TYPE e2,                                            \
        ELEMENT_ARG_TYPE e3                                             \
        )                                                               \
{                                                                       \
    _DO_VECTOR_SET_RESIZE(4);                                           \
    /* This is overkill, but simplifies size checking: */               \
    value_type v[] = {e0,e1,e2,e3};                                     \
    typedef et::OpAssign<Element,Element> OpT;                          \
    cml::vector< const value_type, external<4> > src(v);                \
    et::UnrollAssignment<OpT>(*this,src);                               \
    return *this;                                                       \
}
Create a vector from 4 values.

Definition at line 63 of file class_ops.h.

#define CML_CONSTRUCT_FROM_SUBVEC ( _add_   ) 

Value:

vector(                                                                 \
        const subvector_type& s,                                        \
        ELEMENT_ARG_TYPE e                                              \
        ) _add_                                                         \
{                                                                       \
    _DO_VECTOR_SET_RESIZE(s.size()+1);                                  \
    for(size_t i = 0; i < s.size(); ++ i)                               \
        (*this)[i] = s[i];                                              \
    (*this)[s.size()] = e;                                              \
}
Create a (fixed-size) N vector from an N-1-vector and a scalar.

Definition at line 112 of file class_ops.h.

#define CML_CONSTRUCT_VEC_2 ( _add_   ) 

Value:

vector(ELEMENT_ARG_TYPE e0, ELEMENT_ARG_TYPE e1) _add_ {                \
    set(e0,e1);                                                         \
}
Create a vector from 2 values.

Definition at line 83 of file class_ops.h.

#define CML_CONSTRUCT_VEC_3 ( _add_   ) 

Value:

vector(                                                                 \
        ELEMENT_ARG_TYPE e0,                                            \
        ELEMENT_ARG_TYPE e1,                                            \
        ELEMENT_ARG_TYPE e2                                             \
        ) _add_                                                         \
{                                                                       \
    set(e0,e1,e2);                                                      \
}
Create a vector from 3 values.

Definition at line 89 of file class_ops.h.

#define CML_CONSTRUCT_VEC_4 ( _add_   ) 

Value:

vector(                                                                 \
        ELEMENT_ARG_TYPE e0,                                            \
        ELEMENT_ARG_TYPE e1,                                            \
        ELEMENT_ARG_TYPE e2,                                            \
        ELEMENT_ARG_TYPE e3                                             \
        ) _add_                                                         \
{                                                                       \
    set(e0,e1,e2,e3);                                                   \
}
Create a vector from 4 values.

Definition at line 100 of file class_ops.h.

#define CML_VEC_ASSIGN_FROM_SCALAR ( _op_,
_op_name_   ) 

Value:

vector_type& operator _op_ (ELEMENT_ARG_TYPE s) {                       \
    typedef _op_name_ <Element,Element> OpT;                            \
    cml::et::UnrollAssignment<OpT>(*this,s);                            \
    return *this;                                                       \
}
Declare a function to assign this vector from a scalar.

Parameters:
_op_ the operator (e.g. *=)
_op_name_ the op functor (e.g. et::OpAssign)

Definition at line 228 of file class_ops.h.

#define CML_VEC_ASSIGN_FROM_VEC ( _op_,
_op_name_   ) 

Value:

template<typename E, class AT> vector_type&                             \
operator _op_ (const cml::vector<E,AT>& m) {                            \
    typedef _op_name_ <Element,E> OpT;                                  \
    cml::et::UnrollAssignment<OpT>(*this,m);                            \
    return *this;                                                       \
}
Assign this vector from another using the given elementwise op.

This allows assignment from arbitrary vector types.

Parameters:
_op_ the operator (e.g. +=)
_op_name_ the op functor (e.g. et::OpAssign)

Definition at line 195 of file class_ops.h.

#define CML_VEC_ASSIGN_FROM_VECTYPE

Value:

vector_type& operator=(const vector_type& v) {                          \
    typedef et::OpAssign<Element,Element> OpT;                          \
    et::UnrollAssignment<OpT>(*this,v);                                 \
    return *this;                                                       \
}
Assign from the same vector type.

Parameters:
v the vector to copy from.

Definition at line 181 of file class_ops.h.

#define CML_VEC_ASSIGN_FROM_VECXPR ( _op_,
_op_name_   ) 

Value:

template<class XprT> vector_type&                                       \
operator _op_ (VECXPR_ARG_TYPE e) {                                     \
    /* Verify that a promotion exists at compile time: */               \
    typedef typename et::VectorPromote<                                 \
        vector_type, typename XprT::result_type>::type result_type;     \
    typedef typename XprT::value_type src_value_type;                   \
    typedef _op_name_ <Element,src_value_type> OpT;                     \
    cml::et::UnrollAssignment<OpT>(*this,e);                            \
    return *this;                                                       \
}
Declare a function to assign this vector from a vector expression.

Parameters:
_op_ the operator (e.g. +=)
_op_name_ the op functor (e.g. et::OpAssign)

Definition at line 208 of file class_ops.h.

#define CML_VEC_COPY_FROM_ARRAY ( _add_   ) 

Value:

vector(const value_type* const v, size_t N) _add_ {                     \
    typedef et::OpAssign<Element,Element> OpT;                          \
    cml::vector<const value_type, external<> > src(v,N);                \
    et::UnrollAssignment<OpT>(*this,src);                               \
}
Copy-construct a vector from a runtime-sized array of values.

Definition at line 133 of file class_ops.h.

#define CML_VEC_COPY_FROM_FIXED_ARRAY ( _N_,
_add_   ) 

Value:

vector(const value_type v[_N_]) _add_ {                                 \
    typedef et::OpAssign<Element,Element> OpT;                          \
    cml::vector< const value_type, external<_N_> > src(v);              \
    et::UnrollAssignment<OpT>(*this,src);                               \
}
Copy-construct a vector from a fixed-size array of values.

Definition at line 125 of file class_ops.h.

#define CML_VEC_COPY_FROM_VEC

Value:

template<typename E, class AT>                                          \
vector(const vector<E,AT>& m) {                                         \
    typedef et::OpAssign<Element,E> OpT;                                \
    et::UnrollAssignment<OpT>(*this,m);                                 \
}
Construct from an arbitrary vector.

Parameters:
v the vector to copy from.

Definition at line 155 of file class_ops.h.

#define CML_VEC_COPY_FROM_VECTYPE ( _add_   ) 

Value:

vector(const vector_type& v) _add_ {                                    \
    typedef et::OpAssign<Element,Element> OpT;                          \
    et::UnrollAssignment<OpT>(*this,v);                                 \
}
Copy-construct a vector.

Definition at line 145 of file class_ops.h.

#define CML_VEC_COPY_FROM_VECXPR

Value:

template<class XprT>                                                    \
vector(VECXPR_ARG_TYPE e) {                                             \
    /* Verify that a promotion exists at compile time: */               \
    typedef typename et::VectorPromote<                                 \
        vector_type, typename XprT::result_type>::type result_type;     \
    typedef typename XprT::value_type src_value_type;                   \
    typedef et::OpAssign<Element,src_value_type> OpT;                   \
    et::UnrollAssignment<OpT>(*this,e);                                 \
}
Construct from a vector expression.

Parameters:
expr the expression to copy from.

Definition at line 166 of file class_ops.h.


Generated on Sat Jul 18 19:35:36 2009 for CML 1.0 by  doxygen 1.5.9