AmpGen 2.1
Loading...
Searching...
No Matches
Expression.h File Reference
#include <algorithm>
#include <complex>
#include <iostream>
#include <map>
#include <memory>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include <functional>
#include "AmpGen/MsgService.h"
#include "AmpGen/MetaUtils.h"
#include "AmpGen/Types.h"

Go to the source code of this file.

Classes

class  AmpGen::IExpression
 Virtual base class for other expression tree components. More...
 
class  AmpGen::Expression
 Wrapper class for shared_ptrs to virtual expressions for use in conjunction with operators to build expression trees. More...
 
class  AmpGen::Constant
 Class to contain a constant (which can contain a complex value) More...
 
class  AmpGen::Parameter
 Free parameter for expression. More...
 
class  AmpGen::ComplexParameter
 
class  AmpGen::LambdaExpression
 Parameter that the value of which is given by some arbitrary C++ function. More...
 
class  AmpGen::Ternary
 Evaluates the ternary operator. More...
 
struct  AmpGen::SubTree
 
struct  AmpGen::Function
 
class  AmpGen::ExpressionPack
 A group of expressions packed into a single expression. More...
 
class  AmpGen::IBinaryExpression
 Base class for binary expressions, i.e. More...
 
class  AmpGen::Sum
 Binary expression that returns \(l+r\). More...
 
class  AmpGen::Sub
 Binary expression that returns \(l-r\). More...
 
class  AmpGen::Product
 Binary expression that returns \(l\times r\). More...
 
class  AmpGen::Divide
 Binary expression that returns \(l / r\). More...
 
class  AmpGen::Pow
 Binary expression that returns \( l^{r} \). More...
 
class  AmpGen::Fmod
 Binary expression that returns the fractional part of \( l \mathrm{mod} r \). More...
 
class  AmpGen::LessThan
 Binary expression that returns \(l < r\). More...
 
class  AmpGen::GreaterThan
 Binary expression that returns \(l > r\). More...
 
class  AmpGen::LessThanEqualTo
 Binary expression that returns \(l < r\). More...
 
class  AmpGen::GreaterThanEqualTo
 Binary expression that returns \(l > r\). More...
 
class  AmpGen::And
 Binary expression that returns \(l \wedge r\). More...
 
class  AmpGen::Or
 Binary expression that returns \(l \wedge r\). More...
 
class  AmpGen::Equal
 
class  AmpGen::ATan2
 
class  AmpGen::IUnaryExpression
 Base class for unary expressions, i.e. More...
 
class  AmpGen::Log
 Unary expression that returns \(\log(x)\). More...
 
class  AmpGen::Exp
 Unary expression that returns \(e^x\). More...
 
class  AmpGen::Sqrt
 Unary expression that returns \(\sqrt{x}\). More...
 
class  AmpGen::Abs
 Unary expression that returns \(|z|\). More...
 
class  AmpGen::Norm
 Unary expression that returns \(|z|^2\). More...
 
class  AmpGen::Conj
 Unary expression that returns \(z^{*}\). More...
 
class  AmpGen::Real
 Unary expression that returns the real part of \(z\). More...
 
class  AmpGen::Imag
 Unary expression that returns the imaginary part of \(z\). More...
 
class  AmpGen::Sin
 Unary expression that returns \(\sin(z)\). More...
 
class  AmpGen::Cos
 Unary expression that returns \(\cos(z)\). More...
 
class  AmpGen::Tan
 Unary expression that returns \(\tan(z)\). More...
 
class  AmpGen::ASin
 Unary expression that returns \(\sin^{-1}(z)\). More...
 
class  AmpGen::ACos
 Unary expression that returns \(\cos^{-1}(z)\). More...
 
class  AmpGen::ATan
 Unary expression that returns \(\tan^{-1}(z)\). More...
 
class  AmpGen::ISqrt
 Unary expression that uses inverse sqrt (faster than dividing by sqrt) More...
 
class  AmpGen::LGamma
 Unary expression that returns \(\log\left|\Gamma(x)\right|\). More...
 

Namespaces

namespace  AmpGen
 
namespace  AmpGen::fcn
 

Macros

#define ADD_DEBUG(X, Y)
 Make a (named) debugging expression and add to a set of DebugSymbols.
 
#define DEFINE_CAST(X)
 Define a cast from an expression implementation to the shared_ptr wrapper.
 
#define DEFINE_BINARY_OPERATOR(X)
 
#define DEFINE_UNARY_OPERATOR(X, F)
 
#define DEFINE_UNARY_OPERATOR_NO_RESOLVER(X, F)
 
#define DECLARE_UNARY_OPERATOR(X)
 Macro to declare a unary operator, see IUnaryExpression.
 
#define DECLARE_BINARY_OPERATOR(X)
 Macro to declare a binary operator, see IBinaryExpression.
 

Typedefs

typedef std::pair< std::string, ExpressionAmpGen::DebugSymbol
 
typedef std::vector< DebugSymbolAmpGen::DebugSymbols
 

Functions

Expression AmpGen::operator< (const Expression &A, const Expression &B)
 
Expression AmpGen::operator> (const Expression &A, const Expression &B)
 
Expression AmpGen::operator<= (const Expression &A, const Expression &B)
 
Expression AmpGen::operator>= (const Expression &A, const Expression &B)
 
Expression AmpGen::operator+ (const Expression &A, const Expression &B)
 
Expression AmpGen::operator- (const Expression &A, const Expression &B)
 
Expression AmpGen::operator* (const Expression &A, const Expression &B)
 
Expression AmpGen::operator/ (const Expression &A, const Expression &B)
 
template<class T, typename std::enable_if_t< hasConstructor< Constant, T >() >>
Expression AmpGen::operator+ (const Expression &A, const T &B)
 
template<class T, typename std::enable_if_t< hasConstructor< Constant, T >() >>
Expression AmpGen::operator- (const Expression &A, const T &B)
 
template<class T, typename std::enable_if_t< hasConstructor< Constant, T >() >>
Expression AmpGen::operator* (const Expression &A, const T &B)
 
template<class T, typename std::enable_if_t< hasConstructor< Constant, T >() >>
Expression AmpGen::operator/ (const Expression &A, const T &B)
 
template<class T, typename std::enable_if_t< hasConstructor< Constant, T >() >>
Expression AmpGen::operator+ (const T &A, const Expression &B)
 
template<class T, typename std::enable_if_t< hasConstructor< Constant, T >() >>
Expression AmpGen::operator- (const T &A, const Expression &B)
 
template<class T, typename std::enable_if_t< hasConstructor< Constant, T >() >>
Expression AmpGen::operator* (const T &A, const Expression &B)
 
template<class T, typename std::enable_if_t< hasConstructor< Constant, T >() >>
Expression AmpGen::operator/ (const T &A, const Expression &B)
 
Expression AmpGen::operator&& (const Expression &A, const Expression &B)
 
Expression AmpGen::operator|| (const Expression &A, const Expression &B)
 
Expression AmpGen::operator== (const Expression &A, const Expression &B)
 
Expression AmpGen::operator== (const Expression &A, const double &B)
 
Expression AmpGen::operator== (const double &A, const Expression &B)
 
std::ostream & AmpGen::operator<< (std::ostream &os, const Expression &expression)
 
Expression AmpGen::fcn::sqrt (const Expression &expression)
 
Expression AmpGen::fcn::safe_sqrt (const Expression &expression)
 
Expression AmpGen::fcn::complex_sqrt (const Expression &expression)
 
Expression AmpGen::fcn::isqrt (const Expression &expression)
 
Expression AmpGen::fcn::cos (const Expression &expression)
 
Expression AmpGen::fcn::sin (const Expression &expression)
 
Expression AmpGen::fcn::tan (const Expression &expression)
 
Expression AmpGen::fcn::abs (const Expression &expression)
 
Expression AmpGen::fcn::acos (const Expression &expression)
 
Expression AmpGen::fcn::asin (const Expression &expression)
 
Expression AmpGen::fcn::atan (const Expression &expression)
 
Expression AmpGen::fcn::pow (const Expression &expression, const Expression &co)
 
Expression AmpGen::fcn::fpow (const Expression &expression, const int &n)
 
Expression AmpGen::fcn::norm (const Expression &expression)
 
Expression AmpGen::fcn::conj (const Expression &expression)
 
Expression AmpGen::fcn::exp (const Expression &expression)
 
Expression AmpGen::fcn::log (const Expression &expression)
 
Expression AmpGen::fcn::atan2 (const Expression &y, const Expression &x)
 
template<class T>
bool AmpGen::is (const Expression &expression)
 
template<class T>
AmpGen::cast (const Expression &expression)
 
Expression AmpGen::make_cse (const Expression &A, bool simplify=false)
 

Macro Definition Documentation

◆ DEFINE_BINARY_OPERATOR

#define DEFINE_BINARY_OPERATOR ( X)
Value:
X::X( const AmpGen::Expression& l, const AmpGen::Expression& r ) : IBinaryExpression(l,r ) {} \
X::X( const AmpGen::Expression& expr) : IBinaryExpression(expr) {} \
X::operator Expression() const { return Expression( std::make_shared<X>(*this) ) ; }
Wrapper class for shared_ptrs to virtual expressions for use in conjunction with operators to build e...
Definition Expression.h:135

Definition at line 50 of file Expression.h.

◆ DEFINE_UNARY_OPERATOR

#define DEFINE_UNARY_OPERATOR ( X,
F )
Value:
X::X( const AmpGen::Expression& expression) : IUnaryExpression(expression) {} \
X::operator Expression() const { return Expression( std::make_shared<X>(*this) ) ; } \
complex_t X::operator()() const { return F( m_expression() ); } \
std::string X::to_string(const ASTResolver* resolver) const { return std::string(#F)+"("+ m_expression.to_string(resolver)+")";}
std::complex< real_t > complex_t
Definition Types.h:7

Definition at line 55 of file Expression.h.

◆ DEFINE_UNARY_OPERATOR_NO_RESOLVER

#define DEFINE_UNARY_OPERATOR_NO_RESOLVER ( X,
F )
Value:
X::X( const AmpGen::Expression& expression) : IUnaryExpression(expression) {} \
X::operator Expression() const { return Expression( std::make_shared<X>(*this) ) ; } \
complex_t X::operator()() const { return F( m_expression() ); }

Definition at line 61 of file Expression.h.