Package: Sequence        GrAL: Packages | Concepts | Homepage

Component-wise algebraic operations
[Operators for tuple]

Collaboration diagram for Component-wise algebraic operations:

Functions

template<class T , class U , unsigned N, class BinaryAlgebraicOp >
tuple< typename
numeric_types::promote< T, U >
::type, N > 
GrAL::componentwise (tuple< T, N > const &lhs, tuple< U, N > const &rhs, BinaryAlgebraicOp op)
 Generic component-wise operation.
template<class T , class U , unsigned N>
tuple< typename
numeric_types::promote< T, U >
::type, N > 
GrAL::product (tuple< T, N > const &lhs, tuple< U, N > const &rhs)
 component-wise product
template<class T , unsigned N>
tuple< T, N > GrAL::inverse (tuple< T, N > const &rhs)
 component-wise inverse.
template<class T , class U , unsigned N>
tuple< typename
numeric_types::promote< T, U >
::type, N > 
GrAL::quotient (tuple< T, N > const &lhs, tuple< U, N > const &rhs)
 component-wise quotient.
template<class T , class U , unsigned N>
tuple< T, N > GrAL::power (tuple< T, N > const &a, U k)
 component-wise power
template<class T , unsigned N>
tuple< T, N > GrAL::floor_tuple (tuple< T, N > const &a)
 component-wise floor
template<class T , unsigned N>
tuple< T, N > GrAL::ceil_tuple (tuple< T, N > const &a)
 component-wise ceiling
template<class T , unsigned N>
tuple< T, N > GrAL::round_tuple (tuple< T, N > const &a)
 component-wise rounding to next integer
template<class T , class U , unsigned N>
bool GrAL::does_divide (tuple< T, N > const &lhs, tuple< U, N > const &rhs)
 Test for component-wise divisibility.
template<class T , class U , unsigned N>
tuple< T, N > GrAL::clamp_tuple (tuple< U, N > const &low, tuple< U, N > const &high, tuple< T, N > const p)
 Restrict (clamp) a tuple to a box.
template<class T , unsigned N>
tuple< T, N > GrAL::max_tuple (tuple< T, N > const &lhs, tuple< T, N > const &rhs)
 Component-wise maximum.
template<class T , unsigned N>
tuple< T, N > GrAL::min_tuple (tuple< T, N > const &lhs, tuple< T, N > const &rhs)
 Component-wise minimum.

Function Documentation

template<class T , class U , unsigned N>
tuple<typename numeric_types::promote<T,U>::type, N> GrAL::product ( tuple< T, N > const &  lhs,
tuple< U, N > const &  rhs 
) [inline]

component-wise product

We do not use operator* syntax which could be confused with the dot-product.

Definition at line 462 of file tuple.h.

References GrAL::componentwise().

Referenced by GrAL::does_divide().

template<class T , unsigned N>
tuple<T, N> GrAL::inverse ( tuple< T, N > const &  rhs  )  [inline]

component-wise inverse.

Equivalent to quotient(tuble<T,N>(1), rhs)

Definition at line 476 of file tuple.h.

References GrAL::quotient().

template<class T , class U , unsigned N>
tuple<typename numeric_types::promote<T,U>::type, N> GrAL::quotient ( tuple< T, N > const &  lhs,
tuple< U, N > const &  rhs 
) [inline]

component-wise quotient.

For consistency with product(), the operator/ syntax is not used.

Definition at line 488 of file tuple.h.

References GrAL::componentwise().

Referenced by GrAL::does_divide(), and GrAL::inverse().

template<class T , class U , unsigned N>
tuple<T,N> GrAL::power ( tuple< T, N > const &  a,
k 
) [inline]

component-wise power

$ (a_0, \ldots, a_{N-1}) \mapsto (a_0^k, \ldots, a_{N-1}^k) $

Definition at line 502 of file tuple.h.

Referenced by GrAL::combinatorial::mirror_bits().

template<class T , unsigned N>
RES GrAL::floor_tuple ( tuple< T, N > const &  a  )  [inline]

component-wise floor

$ (a_0, \ldots, a_{N-1}) \mapsto (\lfloor a_0\rfloor, \ldots, \lfloor a_{N-1}\rfloor) $

Definition at line 521 of file tuple.h.

template<class T , unsigned N>
RES GrAL::ceil_tuple ( tuple< T, N > const &  a  )  [inline]

component-wise ceiling

$ (a_0, \ldots, a_{N-1}) \mapsto (\lceil a_0\rceil, \ldots, \lceil a_{N-1}\rceil) $

Definition at line 545 of file tuple.h.

template<class T , unsigned N>
RES GrAL::round_tuple ( tuple< T, N > const &  a  )  [inline]

component-wise rounding to next integer

$ (a_0, \ldots, a_{N-1}) \mapsto (\lceil a_0-0.5\rceil, \ldots, \lceil a_{N-1}-0.5\rceil) $

Definition at line 571 of file tuple.h.

template<class T , class U , unsigned N>
bool GrAL::does_divide ( tuple< T, N > const &  lhs,
tuple< U, N > const &  rhs 
) [inline]

Test for component-wise divisibility.

This makes sense only for integral types!

does_divide(lhs, rhs) == true $ \Leftrightarrow $ lhs[i] divides rhs[i] $ \forall i $

Definition at line 601 of file tuple.h.

References GrAL::product(), and GrAL::quotient().

template<class T , class U , unsigned N>
tuple<T,N> GrAL::clamp_tuple ( tuple< U, N > const &  low,
tuple< U, N > const &  high,
tuple< T, N > const   p 
) [inline]

Restrict (clamp) a tuple to a box.

clamp_tuple(low,high,p) is the point nearest to p within [low,high].

Definition at line 615 of file tuple.h.

template<class T , unsigned N>
tuple<T,N> GrAL::max_tuple ( tuple< T, N > const &  lhs,
tuple< T, N > const &  rhs 
) [inline]

Component-wise maximum.

max_tuple(lhs, rhs) contains the component-wise maximum

Definition at line 634 of file tuple.h.

References GrAL::componentwise().

template<class T , unsigned N>
tuple<T,N> GrAL::min_tuple ( tuple< T, N > const &  lhs,
tuple< T, N > const &  rhs 
) [inline]

Component-wise minimum.

min_tuple(lhs, rhs) contains the component-wise minimum

Definition at line 648 of file tuple.h.

References GrAL::componentwise().


©  Guntram Berti 1997-2009. See the GrAL Homepage for up-to-date information.

Generated on Tue Mar 31 18:53:25 2009 for Sequence by doxygen 1.5.8