ALPSCore reference
Classes | Namespaces | Macros | Functions
vector_functions.hpp File Reference
#include <alps/utilities/stacktrace.hpp>
#include <alps/numeric/inf.hpp>
#include <alps/numeric/special_functions.hpp>
#include <boost/accumulators/numeric/functional/vector.hpp>
#include <boost/accumulators/numeric/functional.hpp>
#include <boost/bind.hpp>
#include <boost/lambda/bind.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/throw_exception.hpp>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdexcept>
Include dependency graph for vector_functions.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  alps::numeric::inf< std::vector< T > >
 Class convertible to std::vector<T> infinity. More...
 
struct  alps::numeric::negate< T >
 "Imported" negation functor class (needed to define template specializations in this namespace) More...
 
struct  alps::numeric::negate< std::vector< T > >
 Negation for vectors (specialization of the standard template, here to avoid changes in std::) More...
 
struct  alps::numeric::invert< T >
 A service functor class for numerical inversion, to be used in transform() More...
 
struct  alps::numeric::invert< std::vector< T > >
 Inversion for vectors, to be used in transform() More...
 
struct  alps::numeric::unary_minus< T >
 
struct  alps::numeric::plus< T, U, R >
 
struct  alps::numeric::plus< T, T, T >
 
struct  alps::numeric::minus< T, U, R >
 
struct  alps::numeric::minus< T, T, T >
 
struct  alps::numeric::multiplies< T, U, R >
 
struct  alps::numeric::multiplies< T, T, T >
 
struct  alps::numeric::divides< T, U, R >
 
struct  alps::numeric::divides< T, T, T >
 

Namespaces

 alps
 
 alps::numeric
 

Macros

#define IMPLEMENT_ALPS_VECTOR_FUNCTION(LIB_HEADER, FUNCTION_NAME)
 
#define ALPS_NUMERIC_IMPLEMENT_FUNCTION(FUNCTION_NAME)
 
#define ALPS_NUMERIC_OPERATOR_EQ(OP_NAME, OPERATOR)
 

Functions

template<typename T >
std::vector< T > alps::numeric::sq (std::vector< T > vec)
 
template<typename T >
std::vector< T > alps::numeric::cb (std::vector< T > vec)
 
template<typename T >
std::vector< T > alps::numeric::cbrt (std::vector< T > vec)
 
template<typename T >
std::vector< T > alps::numeric::asinh (std::vector< T > vec)
 
template<typename T >
std::vector< T > alps::numeric::acosh (std::vector< T > vec)
 
template<typename T >
std::vector< T > alps::numeric::atanh (std::vector< T > vec)
 
template<typename T >
std::vector< T > alps::numeric::operator- (std::vector< T > lhs)
 Unary negation of a vector. More...
 
template<typename T , typename U >
std::vector< T > alps::numeric::operator+ (std::vector< T > const &lhs, std::vector< U > const &rhs)
 Sum of two vectors. Note: Treats a default-initialized vector (size 0) as 0-vector. More...
 
template<typename T , typename U >
std::vector< T > alps::numeric::operator- (std::vector< T > const &lhs, std::vector< U > const &rhs)
 Difference of two vectors. Note: Treats a default-initialized vector (size 0) as 0-vector. More...
 
template<typename T , typename U >
std::vector< T > alps::numeric::operator* (std::vector< T > const &lhs, std::vector< U > const &rhs)
 By-element product of two vectors. Note: Treats a default-initialized vector (size 0) as 0-vector. More...
 
template<typename T , typename U >
std::vector< T > alps::numeric::operator/ (std::vector< T > const &lhs, std::vector< U > const &rhs)
 By-element quotient of two vectors. Note: Treats a default-initialized vector (size 0) as 0-vector. More...
 
template<typename T >
std::vector< T > alps::numeric::operator+ (T const &scalar, std::vector< T > rhs)
 Sum of a scalar and a vector. More...
 
template<typename T >
std::vector< T > alps::numeric::operator+ (std::vector< T > lhs, T const &scalar)
 Sum of a vector and a scalar. More...
 
template<typename T >
std::vector< T > alps::numeric::operator- (T const &scalar, std::vector< T > const &rhs)
 Difference of a scalar and a vector. More...
 
template<typename T >
std::vector< T > alps::numeric::operator- (std::vector< T > const &lhs, T const &scalar)
 Difference of a vector and a scalar. More...
 
template<typename T >
std::vector< T > alps::numeric::operator* (std::vector< T > const &lhs, T const &scalar)
 Returns a vector scaled by a scalar. More...
 
template<typename T >
std::vector< T > alps::numeric::operator* (T const &scalar, std::vector< T > const &rhs)
 Returns a vector scaled by a scalar. More...
 
template<typename T >
std::vector< T > alps::numeric::operator/ (std::vector< T > const &lhs, T const &scalar)
 Returns a vector divided scaled by a scalar. More...
 
template<typename T >
std::vector< T > alps::numeric::operator/ (T const &scalar, std::vector< T > rhs)
 Returns a vector with elements inverted and scaled by a scalar. More...
 
template<typename T >
std::vector< T > alps::numeric::sin (std::vector< T > arg)
 
template<typename T >
std::vector< T > alps::numeric::cos (std::vector< T > arg)
 
template<typename T >
std::vector< T > alps::numeric::tan (std::vector< T > arg)
 
template<typename T >
std::vector< T > alps::numeric::sinh (std::vector< T > arg)
 
template<typename T >
std::vector< T > alps::numeric::cosh (std::vector< T > arg)
 
template<typename T >
std::vector< T > alps::numeric::tanh (std::vector< T > arg)
 
template<typename T >
std::vector< T > alps::numeric::asin (std::vector< T > arg)
 
template<typename T >
std::vector< T > alps::numeric::acos (std::vector< T > arg)
 
template<typename T >
std::vector< T > alps::numeric::atan (std::vector< T > arg)
 
template<typename T >
std::vector< T > alps::numeric::abs (std::vector< T > arg)
 
template<typename T >
std::vector< T > alps::numeric::sqrt (std::vector< T > arg)
 
template<typename T >
std::vector< T > alps::numeric::exp (std::vector< T > arg)
 
template<typename T >
std::vector< T > alps::numeric::log (std::vector< T > arg)
 
template<typename T , typename U >
std::vector< T > alps::numeric::pow (std::vector< T > vec, U index)
 
template<typename T >
std::vector< T > & alps::numeric::operator+= (std::vector< T > &lhs, std::vector< T > const &rhs)
 
template<typename T >
std::vector< T > & alps::numeric::operator-= (std::vector< T > &lhs, std::vector< T > const &rhs)
 
template<typename T >
std::vector< T > & alps::numeric::operator*= (std::vector< T > &lhs, std::vector< T > const &rhs)
 
template<typename T >
std::vector< T > & alps::numeric::operator/= (std::vector< T > &lhs, std::vector< T > const &rhs)
 
template<typename T >
std::vector< T > & alps::numeric::merge (std::vector< T > &left, const std::vector< T > &right)
 Vector merge. More...
 

Macro Definition Documentation

#define ALPS_NUMERIC_IMPLEMENT_FUNCTION (   FUNCTION_NAME)
Value:
template<typename T> std::vector<T> FUNCTION_NAME (std::vector<T> arg) { \
using std:: FUNCTION_NAME ; \
std::transform(arg.begin(), arg.end(), arg.begin(), static_cast<T (*)(T)>(& FUNCTION_NAME )); \
return arg; \
}
mean_result< T > transform(no_prop, const transformer< T > &tf, const InResult &in)
Definition: transform.hpp:27

Definition at line 190 of file vector_functions.hpp.

#define ALPS_NUMERIC_OPERATOR_EQ (   OP_NAME,
  OPERATOR 
)
Value:
template<typename T> \
std::vector<T> & OP_NAME (std::vector<T> & lhs, std::vector<T> const & rhs) { \
if(lhs.size() != rhs.size()) { \
std::string lsz=std::to_string(lhs.size()); \
std::string rsz=std::to_string(rhs.size()); \
boost::throw_exception(std::runtime_error("std::vectors have different sizes:" \
" left="+lsz+ \
" right="+rsz + "\n" + \
} \
std::transform(lhs.begin(), lhs.end(), rhs.begin(), lhs.begin(), OPERATOR <T,T,T>() ); \
return lhs; \
}
mean_result< T > transform(no_prop, const transformer< T > &tf, const InResult &in)
Definition: transform.hpp:27
#define ALPS_STACKTRACE
Definition: stacktrace.hpp:37

Definition at line 323 of file vector_functions.hpp.

#define IMPLEMENT_ALPS_VECTOR_FUNCTION (   LIB_HEADER,
  FUNCTION_NAME 
)
Value:
namespace detail { \
template<typename T> struct FUNCTION_NAME ## _VECTOR_OP_HELPER { \
T operator() (T arg) { \
using LIB_HEADER :: FUNCTION_NAME; \
return FUNCTION_NAME (arg); \
} \
}; \
} \
template<typename T> std::vector<T> FUNCTION_NAME(std::vector<T> vec) { \
std::transform(vec.begin(), vec.end(), vec.begin(), detail:: FUNCTION_NAME ## _VECTOR_OP_HELPER<T>()); \
return vec; \
}
mean_result< T > transform(no_prop, const transformer< T > &tf, const InResult &in)
Definition: transform.hpp:27

Definition at line 36 of file vector_functions.hpp.