SourceForge Logo Tiny Vector Matrix library using Expression Templates Sourceforge Project Page

include/tvmet/xpr/VectorFunctions.h File Reference

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

Go to the source code of this file.

Namespaces

namespace  tvmet
namespace  tvmet::element_wise

Defines

#define TVMET_DECLARE_MACRO(NAME)
#define TVMET_DECLARE_MACRO(NAME, POD)
#define TVMET_DECLARE_MACRO(NAME)
#define TVMET_IMPLEMENT_MACRO(NAME)
#define TVMET_IMPLEMENT_MACRO(NAME, POD)
#define TVMET_IMPLEMENT_MACRO(NAME)

Functions

template<class E1, class E2, std::size_t Sz>
XprVector< XprBinOp< Fcnl_add<
typename E1::value_type,
typename E2::value_type >,
XprVector< E1, Sz >, XprVector<
E2, Sz > >, Sz > 
tvmet::add (const XprVector< E1, Sz > &lhs, const XprVector< E2, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E1, class E2, std::size_t Sz>
XprVector< XprBinOp< Fcnl_sub<
typename E1::value_type,
typename E2::value_type >,
XprVector< E1, Sz >, XprVector<
E2, Sz > >, Sz > 
tvmet::sub (const XprVector< E1, Sz > &lhs, const XprVector< E2, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E1, class E2, std::size_t Sz>
XprVector< XprBinOp< Fcnl_mul<
typename E1::value_type,
typename E2::value_type >,
XprVector< E1, Sz >, XprVector<
E2, Sz > >, Sz > 
tvmet::mul (const XprVector< E1, Sz > &lhs, const XprVector< E2, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E1, class E2, std::size_t Sz>
XprVector< XprBinOp< Fcnl_div<
typename E1::value_type,
typename E2::value_type >,
XprVector< E1, Sz >, XprVector<
E2, Sz > >, Sz > 
tvmet::element_wise::div (const XprVector< E1, Sz > &lhs, const XprVector< E2, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_add<
typename E::value_type, int >,
XprVector< E, Sz >, XprLiteral<
int > >, Sz > 
tvmet::add (const XprVector< E, Sz > &lhs, int rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_add<
int, typename E::value_type >,
XprLiteral< int >, XprVector<
E, Sz > >, Sz > 
tvmet::add (int lhs, const XprVector< E, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_sub<
typename E::value_type, int >,
XprVector< E, Sz >, XprLiteral<
int > >, Sz > 
tvmet::sub (const XprVector< E, Sz > &lhs, int rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_sub<
int, typename E::value_type >,
XprLiteral< int >, XprVector<
E, Sz > >, Sz > 
tvmet::sub (int lhs, const XprVector< E, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_mul<
typename E::value_type, int >,
XprVector< E, Sz >, XprLiteral<
int > >, Sz > 
tvmet::mul (const XprVector< E, Sz > &lhs, int rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_mul<
int, typename E::value_type >,
XprLiteral< int >, XprVector<
E, Sz > >, Sz > 
tvmet::mul (int lhs, const XprVector< E, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_div<
typename E::value_type, int >,
XprVector< E, Sz >, XprLiteral<
int > >, Sz > 
tvmet::div (const XprVector< E, Sz > &lhs, int rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_div<
int, typename E::value_type >,
XprLiteral< int >, XprVector<
E, Sz > >, Sz > 
tvmet::div (int lhs, const XprVector< E, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_add<
typename E::value_type, float >,
XprVector< E, Sz >, XprLiteral<
float > >, Sz > 
tvmet::add (const XprVector< E, Sz > &lhs, float rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_add<
float, typename E::value_type >,
XprLiteral< float >, XprVector<
E, Sz > >, Sz > 
tvmet::add (float lhs, const XprVector< E, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_sub<
typename E::value_type, float >,
XprVector< E, Sz >, XprLiteral<
float > >, Sz > 
tvmet::sub (const XprVector< E, Sz > &lhs, float rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_sub<
float, typename E::value_type >,
XprLiteral< float >, XprVector<
E, Sz > >, Sz > 
tvmet::sub (float lhs, const XprVector< E, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_mul<
typename E::value_type, float >,
XprVector< E, Sz >, XprLiteral<
float > >, Sz > 
tvmet::mul (const XprVector< E, Sz > &lhs, float rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_mul<
float, typename E::value_type >,
XprLiteral< float >, XprVector<
E, Sz > >, Sz > 
tvmet::mul (float lhs, const XprVector< E, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_div<
typename E::value_type, float >,
XprVector< E, Sz >, XprLiteral<
float > >, Sz > 
tvmet::div (const XprVector< E, Sz > &lhs, float rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_div<
float, typename E::value_type >,
XprLiteral< float >, XprVector<
E, Sz > >, Sz > 
tvmet::div (float lhs, const XprVector< E, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_add<
typename E::value_type, double >,
XprVector< E, Sz >, XprLiteral<
double > >, Sz > 
tvmet::add (const XprVector< E, Sz > &lhs, double rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_add<
double, typename E::value_type >,
XprLiteral< double >, XprVector<
E, Sz > >, Sz > 
tvmet::add (double lhs, const XprVector< E, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_sub<
typename E::value_type, double >,
XprVector< E, Sz >, XprLiteral<
double > >, Sz > 
tvmet::sub (const XprVector< E, Sz > &lhs, double rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_sub<
double, typename E::value_type >,
XprLiteral< double >, XprVector<
E, Sz > >, Sz > 
tvmet::sub (double lhs, const XprVector< E, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_mul<
typename E::value_type, double >,
XprVector< E, Sz >, XprLiteral<
double > >, Sz > 
tvmet::mul (const XprVector< E, Sz > &lhs, double rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_mul<
double, typename E::value_type >,
XprLiteral< double >, XprVector<
E, Sz > >, Sz > 
tvmet::mul (double lhs, const XprVector< E, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_div<
typename E::value_type, double >,
XprVector< E, Sz >, XprLiteral<
double > >, Sz > 
tvmet::div (const XprVector< E, Sz > &lhs, double rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_div<
double, typename E::value_type >,
XprLiteral< double >, XprVector<
E, Sz > >, Sz > 
tvmet::div (double lhs, const XprVector< E, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_add<
typename E::value_type, long
double >, XprVector< E, Sz >,
XprLiteral< long double > >,
Sz > 
tvmet::add (const XprVector< E, Sz > &lhs, long double rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_add<
long double, typename E::value_type >,
XprLiteral< long double >,
XprVector< E, Sz > >, Sz > 
tvmet::add (long double lhs, const XprVector< E, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_sub<
typename E::value_type, long
double >, XprVector< E, Sz >,
XprLiteral< long double > >,
Sz > 
tvmet::sub (const XprVector< E, Sz > &lhs, long double rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_sub<
long double, typename E::value_type >,
XprLiteral< long double >,
XprVector< E, Sz > >, Sz > 
tvmet::sub (long double lhs, const XprVector< E, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_mul<
typename E::value_type, long
double >, XprVector< E, Sz >,
XprLiteral< long double > >,
Sz > 
tvmet::mul (const XprVector< E, Sz > &lhs, long double rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_mul<
long double, typename E::value_type >,
XprLiteral< long double >,
XprVector< E, Sz > >, Sz > 
tvmet::mul (long double lhs, const XprVector< E, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_div<
typename E::value_type, long
double >, XprVector< E, Sz >,
XprLiteral< long double > >,
Sz > 
tvmet::div (const XprVector< E, Sz > &lhs, long double rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_div<
long double, typename E::value_type >,
XprLiteral< long double >,
XprVector< E, Sz > >, Sz > 
tvmet::div (long double lhs, const XprVector< E, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz, class T>
XprVector< XprBinOp< Fcnl_add<
typename E::value_type, std::complex<
T > >, XprVector< E, Sz >,
XprLiteral< std::complex<
T > > >, Sz > 
tvmet::add (const XprVector< E, Sz > &lhs, const std::complex< T > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz, class T>
XprVector< XprBinOp< Fcnl_add<
std::complex< T >, typename
E::value_type >, XprLiteral<
std::complex< T > >, XprVector<
E, Sz > >, Sz > 
tvmet::add (const std::complex< T > &lhs, const XprVector< E, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz, class T>
XprVector< XprBinOp< Fcnl_sub<
typename E::value_type, std::complex<
T > >, XprVector< E, Sz >,
XprLiteral< std::complex<
T > > >, Sz > 
tvmet::sub (const XprVector< E, Sz > &lhs, const std::complex< T > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz, class T>
XprVector< XprBinOp< Fcnl_sub<
std::complex< T >, typename
E::value_type >, XprLiteral<
std::complex< T > >, XprVector<
E, Sz > >, Sz > 
tvmet::sub (const std::complex< T > &lhs, const XprVector< E, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz, class T>
XprVector< XprBinOp< Fcnl_mul<
typename E::value_type, std::complex<
T > >, XprVector< E, Sz >,
XprLiteral< std::complex<
T > > >, Sz > 
tvmet::mul (const XprVector< E, Sz > &lhs, const std::complex< T > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz, class T>
XprVector< XprBinOp< Fcnl_mul<
std::complex< T >, typename
E::value_type >, XprLiteral<
std::complex< T > >, XprVector<
E, Sz > >, Sz > 
tvmet::mul (const std::complex< T > &lhs, const XprVector< E, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz, class T>
XprVector< XprBinOp< Fcnl_div<
typename E::value_type, std::complex<
T > >, XprVector< E, Sz >,
XprLiteral< std::complex<
T > > >, Sz > 
tvmet::div (const XprVector< E, Sz > &lhs, const std::complex< T > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz, class T>
XprVector< XprBinOp< Fcnl_div<
std::complex< T >, typename
E::value_type >, XprLiteral<
std::complex< T > >, XprVector<
E, Sz > >, Sz > 
tvmet::div (const std::complex< T > &lhs, const XprVector< E, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
template<class E, std::size_t Sz>
NumericTraits< typename E::value_type
>::sum_type 
tvmet::sum (const XprVector< E, Sz > &v) TVMET_CXX_ALWAYS_INLINE
 Compute the sum of the vector expression.
template<class E, std::size_t Sz>
NumericTraits< typename E::value_type
>::sum_type 
tvmet::product (const XprVector< E, Sz > &v) TVMET_CXX_ALWAYS_INLINE
 Compute the product of the vector elements.
template<class E1, class E2, std::size_t Sz>
PromoteTraits< typename E1::value_type,
typename E2::value_type
>::value_type 
tvmet::dot (const XprVector< E1, Sz > &lhs, const XprVector< E2, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
 Compute the dot/inner product.
template<class T, class E, std::size_t Sz>
PromoteTraits< T, typename
E::value_type >::value_type 
tvmet::dot (const Vector< T, Sz > &lhs, const XprVector< E, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
 Compute the dot/inner product.
template<class E, class T, std::size_t Sz>
PromoteTraits< T, typename
E::value_type >::value_type 
tvmet::dot (const XprVector< E, Sz > &lhs, const Vector< T, Sz > &rhs) TVMET_CXX_ALWAYS_INLINE
 Compute the dot/inner product.
template<class E1, class E2>
Vector< typename PromoteTraits<
typename E1::value_type,
typename E2::value_type
>::value_type, 3 > 
tvmet::cross (const XprVector< E1, 3 > &lhs, const XprVector< E2, 3 > &rhs) TVMET_CXX_ALWAYS_INLINE
 Compute the cross/outer product.
template<class T, class E>
Vector< typename PromoteTraits<
T, typename E::value_type
>::value_type, 3 > 
tvmet::cross (const Vector< T, 3 > &lhs, const XprVector< E, 3 > &rhs) TVMET_CXX_ALWAYS_INLINE
 Compute the cross/outer product.
template<class E, class T>
Vector< typename PromoteTraits<
T, typename E::value_type
>::value_type, 3 > 
tvmet::cross (const XprVector< E, 3 > &lhs, const Vector< T, 3 > &rhs) TVMET_CXX_ALWAYS_INLINE
 Compute the cross/outer product.
template<class E, std::size_t Sz>
NumericTraits< typename E::value_type
>::sum_type 
tvmet::norm1 (const XprVector< E, Sz > &v) TVMET_CXX_ALWAYS_INLINE
 The $l_1$ norm of a vector expression.
template<class E, std::size_t Sz>
NumericTraits< typename E::value_type
>::sum_type 
tvmet::norm2 (const XprVector< E, Sz > &v) TVMET_CXX_ALWAYS_INLINE
 The euklidian norm (or $l_2$ norm) of a vector expression.
template<class E, std::size_t Sz>
XprVector< XprBinOp< Fcnl_div<
typename E::value_type, typename
E::value_type >, XprVector<
E, Sz >, XprLiteral< typename
E::value_type > >, Sz > 
tvmet::normalize (const XprVector< E, Sz > &v) TVMET_CXX_ALWAYS_INLINE
 Normalize the given vector expression.
template<class T1, class E2>
Vector< typename PromoteTraits<
T1, typename E2::value_type
>::value_type, 3 > 
tvmet::cross (const Vector< T1, 3 > &lhs, const XprVector< E2, 3 > &rhs)


Define Documentation

#define TVMET_DECLARE_MACRO ( NAME   ) 

Value:

template<class E, std::size_t Sz, class T>      \
XprVector<              \
  XprBinOp<             \
    Fcnl_##NAME< typename E::value_type, std::complex<T> >, \
    XprVector<E, Sz>,           \
    XprLiteral< std::complex<T> >       \
  >,                \
  Sz                \
>               \
NAME (const XprVector<E, Sz>& lhs,        \
      const std::complex<T>& rhs) TVMET_CXX_ALWAYS_INLINE;  \
                \
template<class E, std::size_t Sz, class T>      \
XprVector<              \
  XprBinOp<             \
    Fcnl_##NAME< std::complex<T>, typename E::value_type>,  \
    XprLiteral< std::complex<T> >,        \
    XprVector<E, Sz>            \
  >,                \
  Sz                \
>               \
NAME (const std::complex<T>& lhs,         \
      const XprVector<E, Sz>& rhs) TVMET_CXX_ALWAYS_INLINE;

#define TVMET_DECLARE_MACRO ( NAME,
POD   ) 

Value:

template<class E, std::size_t Sz>       \
XprVector<              \
  XprBinOp<             \
    Fcnl_##NAME< typename E::value_type, POD >,     \
    XprVector<E, Sz>,           \
    XprLiteral< POD >           \
  >,                \
  Sz                \
>               \
NAME (const XprVector<E, Sz>& lhs,        \
      POD rhs) TVMET_CXX_ALWAYS_INLINE;       \
                \
template<class E, std::size_t Sz>       \
XprVector<              \
  XprBinOp<             \
    Fcnl_##NAME< POD, typename E::value_type>,      \
    XprLiteral< POD >,            \
    XprVector<E, Sz>            \
  >,                \
  Sz                \
>               \
NAME (POD lhs,              \
      const XprVector<E, Sz>& rhs) TVMET_CXX_ALWAYS_INLINE;

#define TVMET_DECLARE_MACRO ( NAME   ) 

Value:

template<class E1, class E2, std::size_t Sz>        \
XprVector<                \
  XprBinOp<               \
    Fcnl_##NAME<typename E1::value_type, typename E2::value_type>,  \
    XprVector<E1, Sz>,              \
    XprVector<E2, Sz>             \
  >,                  \
  Sz                  \
>                 \
NAME (const XprVector<E1, Sz>& lhs,         \
      const XprVector<E2, Sz>& rhs) TVMET_CXX_ALWAYS_INLINE;

#define TVMET_IMPLEMENT_MACRO ( NAME   ) 

#define TVMET_IMPLEMENT_MACRO ( NAME,
POD   ) 

#define TVMET_IMPLEMENT_MACRO ( NAME   ) 

Value:

template<class E1, class E2, std::size_t Sz>        \
inline                  \
XprVector<                \
  XprBinOp<               \
    Fcnl_##NAME<typename E1::value_type, typename E2::value_type>,  \
    XprVector<E1, Sz>,              \
    XprVector<E2, Sz>             \
  >,                  \
  Sz                  \
>                 \
NAME (const XprVector<E1, Sz>& lhs, const XprVector<E2, Sz>& rhs) { \
  typedef XprBinOp<             \
    Fcnl_##NAME<typename E1::value_type, typename E2::value_type>,  \
    XprVector<E1, Sz>,              \
    XprVector<E2, Sz>             \
  >                expr_type; \
  return XprVector<expr_type, Sz>(expr_type(lhs, rhs));     \
}


Author: