For internal use only.
An expression template represents a valarray expression parsed at compile time; each term is then a node of the parse tree. This class defines all the member and free functions of valarray, except for index and size, and limits templated operator overloads to its subclasses.
| T | The element type, see stdext::valarray. | |
| Term | The actual term, which should be the subclass. |
Public Member Functions | |
Appliers | |
Each returns a new term with elements of type T. | |
| template<typename Fn> | |
| apply_term< Term, Fn > | apply (Fn func) const |
| Applies the function func to each element. | |
Shifters | |
Each returns a new term with elements of type T. | |
| cshift_term< Term > | cshift (int n) const |
| Shifts circularly each element left n places. | |
| shift_term< Term > | shift (int n) const |
| Shifts each element left n places, then fills shifted places with zero. | |
Summarizers | |
| T | max () const |
| Gets the maximum element. | |
| T | min () const |
| Gets the minimum element. | |
| T | sum () const |
| Sums all the elements. | |
Computed Assignments | |
You can also use a value of type T for rhs. | |
| template<typename Term2> | |
| Term & | operator &= (const term< T, Term2 > &rhs) |
| Applies operator&= between the corresponding elements of this and rhs. | |
| template<typename Term2> | |
| Term & | operator *= (const term< T, Term2 > &rhs) |
| Applies operator*= between the corresponding elements of this and rhs. | |
| template<typename Term2> | |
| Term & | operator%= (const term< T, Term2 > &rhs) |
| Applies operator%= between the corresponding elements of this and rhs. | |
| template<typename Term2> | |
| Term & | operator+= (const term< T, Term2 > &rhs) |
| Applies operator+= between the corresponding elements of this and rhs. | |
| template<typename Term2> | |
| Term & | operator-= (const term< T, Term2 > &rhs) |
| Applies operator-= between the corresponding elements of this and rhs. | |
| template<typename Term2> | |
| Term & | operator/= (const term< T, Term2 > &rhs) |
| Applies operator/= between the corresponding elements of this and rhs. | |
| template<typename Term2> | |
| Term & | operator<<= (const term< T, Term2 > &rhs) |
| Applies operator<<= between the corresponding elements of this and rhs. | |
| template<typename Term2> | |
| Term & | operator>>= (const term< T, Term2 > &rhs) |
| Applies operator>>= between the corresponding elements of this and rhs. | |
| template<typename Term2> | |
| Term & | operator^= (const term< T, Term2 > &rhs) |
| Applies operator^= between the corresponding elements of this and rhs. | |
| template<typename Term2> | |
| Term & | operator|= (const term< T, Term2 > &rhs) |
| Applies operator|= between the corresponding elements of this and rhs. | |
Subsetters | |
Each returns a new term with elements of type T. | |
| template<typename InTerm> | |
| indirect_term< Term, InTerm > | operator[] (const term< std::size_t, InTerm > &sub) |
| Selects the elements indirected by sub out of the term. | |
| template<typename BTerm> | |
| mask_term< Term, BTerm > | operator[] (const term< bool, BTerm > &sub) |
| Selects the elements masked by sub out of the term. | |
| gslice_term< Term > | operator[] (const gslice &sub) |
| Selects a generalized slice sub out of the term. | |
| slice_term< Term > | operator[] (const slice &sub) |
| Selects a BLAS-like slice sub out of the term. | |
| template<typename InTerm> | |
| const indirect_term< Term, InTerm > | operator[] (const term< std::size_t, InTerm > &sub) const |
| Selects the elements indirected by sub out of the term. | |
| template<typename BTerm> | |
| const mask_term< Term, BTerm > | operator[] (const term< bool, BTerm > &sub) const |
| Selects the elements masked by sub out of the term. | |
| const gslice_term< Term > | operator[] (const gslice &sub) const |
| Selects a generalized slice sub out of the term. | |
| const slice_term< Term > | operator[] (const slice &sub) const |
| Selects a BLAS-like slice sub out of the term. | |
Reference | |
| Term & | that () |
| Gets the wrapped term. | |
| const Term & | that () const |
| Gets the wrapped term. | |
Related Functions | |
| (Note that these are not member functions.) | |
Transcendentals | |
Each returns a new term with elements of type T. You can also use a value of type T for either lhs or rhs. | |
| const unary_term< Term, stdext::absolute > | abs (const term< T, Term > &lhs) |
| Applies abs to each element of lhs. | |
| const unary_term< Term, stdext::arc_cosine > | acos (const term< T, Term > &lhs) |
| Applies acos to each element of lhs. | |
| const unary_term< Term, stdext::arc_sine > | asin (const term< T, Term > &lhs) |
| Applies asin to each element of lhs. | |
| const unary_term< Term, stdext::arc_tangent > | atan (const term< T, Term > &lhs) |
| Applies atan to each element of lhs. | |
|
const binary_term< LTerm, RTerm, stdext::arc_tangent2 > | atan2 (const term< T, LTerm > &lhs, const term< T, RTerm > &rhs) |
| Applies atan2 between the corresponding elements of lhs and rhs. | |
| const unary_term< Term, stdext::cosine > | cos (const term< T, Term > &lhs) |
| Applies cos to each element of lhs. | |
| const unary_term< Term, stdext::hyperbolic_cosine > | cosh (const term< T, Term > &lhs) |
| Applies cosh to each element of lhs. | |
| const unary_term< Term, stdext::exponent > | exp (const term< T, Term > &lhs) |
| Applies exp to each element of lhs. | |
| const unary_term< Term, stdext::logarithm > | log (const term< T, Term > &lhs) |
| Applies log to each element of lhs. | |
| const unary_term< Term, stdext::logarithm10 > | log10 (const term< T, Term > &lhs) |
| Applies log10 to each element of lhs. | |
|
const binary_term< LTerm, RTerm, stdext::power > | pow (const term< T, LTerm > &lhs, const term< T, RTerm > &rhs) |
| Applies pow between the corresponding elements of lhs and rhs. | |
| const unary_term< Term, stdext::sine > | sin (const term< T, Term > &lhs) |
| Applies sin to each element of lhs. | |
| const unary_term< Term, stdext::hyperbolic_sine > | sinh (const term< T, Term > &lhs) |
| Applies sinh to each element of lhs. | |
| const unary_term< Term, stdext::square_root > | sqrt (const term< T, Term > &lhs) |
| Applies sqrt to each element of lhs. | |
| const unary_term< Term, stdext::tangent > | tan (const term< T, Term > &lhs) |
| Applies tan to each element of lhs. | |
| const unary_term< Term, stdext::hyperbolic_tangent > | tanh (const term< T, Term > &lhs) |
| Applies tanh to each element of lhs. | |
Binary Arithmetic | |
Each returns a new term with elements of type T. You can also use a value of type T for either lhs or rhs. | |
|
const binary_term< LTerm, RTerm, stdext::bitwise_and > | operator & (const term< T, LTerm > &lhs, const term< T, RTerm > &rhs) |
| Applies operator& between the corresponding elements of lhs and rhs. | |
|
const binary_term< LTerm, RTerm, std::multiplies > | operator * (const term< T, LTerm > &lhs, const term< T, RTerm > &rhs) |
| Applies operator* between the corresponding elements of lhs and rhs. | |
|
const binary_term< LTerm, RTerm, std::modulus > | operator% (const term< T, LTerm > &lhs, const term< T, RTerm > &rhs) |
| Applies operator% between the corresponding elements of lhs and rhs. | |
|
const binary_term< LTerm, RTerm, std::plus > | operator+ (const term< T, LTerm > &lhs, const term< T, RTerm > &rhs) |
| Applies operator+ between the corresponding elements of lhs and rhs. | |
|
const binary_term< LTerm, RTerm, std::minus > | operator- (const term< T, LTerm > &lhs, const term< T, RTerm > &rhs) |
| Applies operator- between the corresponding elements of lhs and rhs. | |
|
const binary_term< LTerm, RTerm, std::divides > | operator/ (const term< T, LTerm > &lhs, const term< T, RTerm > &rhs) |
| Applies operator/ between the corresponding elements of lhs and rhs. | |
|
const binary_term< LTerm, RTerm, stdext::shift_left > | operator<< (const term< T, LTerm > &lhs, const term< T, RTerm > &rhs) |
| Applies operator<< between the corresponding elements of lhs and rhs. | |
|
const binary_term< LTerm, RTerm, stdext::shift_right > | operator>> (const term< T, LTerm > &lhs, const term< T, RTerm > &rhs) |
| Applies operator>> between the corresponding elements of lhs and rhs. | |
|
const binary_term< LTerm, RTerm, stdext::bitwise_xor > | operator^ (const term< T, LTerm > &lhs, const term< T, RTerm > &rhs) |
| Applies operator^ between the corresponding elements of lhs and rhs. | |
|
const binary_term< LTerm, RTerm, stdext::bitwise_or > | operator| (const term< T, LTerm > &lhs, const term< T, RTerm > &rhs) |
| Applies operator| between the corresponding elements of lhs and rhs. | |
Binary Logic | |
Each returns a new term with bool elements. You can also use a value of type T for either lhs or rhs. | |
|
const binary_term< LTerm, RTerm, std::logical_and > | operator && (const term< T, LTerm > &lhs, const term< T, RTerm > &rhs) |
| Applies operator&& between the corresponding elements of lhs and rhs. | |
|
const binary_term< LTerm, RTerm, std::not_equal_to > | operator!= (const term< T, LTerm > &lhs, const term< T, RTerm > &rhs) |
| Applies operator!= between the corresponding elements of lhs and rhs. | |
|
const binary_term< LTerm, RTerm, std::less > | operator< (const term< T, LTerm > &lhs, const term< T, RTerm > &rhs) |
| Applies operator< between the corresponding elements of lhs and rhs. | |
|
const binary_term< LTerm, RTerm, std::less_equal > | operator<= (const term< T, LTerm > &lhs, const term< T, RTerm > &rhs) |
| Applies operator<= between the corresponding elements of lhs and rhs. | |
|
const binary_term< LTerm, RTerm, std::equal_to > | operator== (const term< T, LTerm > &lhs, const term< T, RTerm > &rhs) |
| Applies operator== between the corresponding elements of lhs and rhs. | |
|
const binary_term< LTerm, RTerm, std::greater > | operator> (const term< T, LTerm > &lhs, const term< T, RTerm > &rhs) |
| Applies operator> between the corresponding elements of lhs and rhs. | |
|
const binary_term< LTerm, RTerm, std::greater_equal > | operator>= (const term< T, LTerm > &lhs, const term< T, RTerm > &rhs) |
| Applies operator>= between the corresponding elements of lhs and rhs. | |
|
const binary_term< LTerm, RTerm, std::logical_or > | operator|| (const term< T, LTerm > &lhs, const term< T, RTerm > &rhs) |
| Applies operator|| between the corresponding elements of lhs and rhs. | |
Unary Logic | |
Each returns a new term with bool elements. | |
| const unary_term< Term, std::logical_not > | operator! (const term< T, Term > &lhs) |
| Applies operator! to each element of lhs. | |
Unary Arithmetic | |
Each returns a new term with elements of type T. | |
| const unary_term< Term, stdext::identity > | operator+ (const term< T, Term > &lhs) |
| Applies operator+ to each element of lhs. | |
| const unary_term< Term, std::negate > | operator- (const term< T, Term > &lhs) |
| Applies operator- to each element of lhs. | |
| const unary_term< Term, stdext::bitwise_not > | operator~ (const term< T, Term > &lhs) |
| Applies operator~ to each element of lhs. | |