piranha  0.10
Classes | Functions | Variables
piranha::math Namespace Reference

Math namespace. More...

Classes

struct  abs_impl
 Default functor for the implementation of piranha::math::abs(). More...
 
struct  abs_impl< mp_integer< SSize > >
 Specialisation of the implementation of piranha::math::abs() for piranha::mp_integer. More...
 
struct  abs_impl< mp_rational< SSize > >
 Specialisation of the implementation of piranha::math::abs() for piranha::mp_rational. More...
 
struct  abs_impl< T, detail::abs_arith_enabler< T > >
 Specialisation of the piranha::math::abs() functor for signed and unsigned integer types, and floating-point types. More...
 
struct  abs_impl< T, typename std::enable_if< std::is_same< T, real >::value >::type >
 Specialisation of the piranha::math::abs() functor for piranha::real. More...
 
struct  add3_impl
 Default functor for the implementation of piranha::math::add3(). More...
 
struct  add3_impl< mp_integer< SSize > >
 Specialisation of the implementation of piranha::math::add3() for piranha::mp_integer. More...
 
struct  add3_impl< T, typename std::enable_if< std::is_integral< T >::value >::type >
 Specialisation of the piranha::math::add3() functor for integral types. More...
 
struct  binomial_impl
 Default functor for the implementation of piranha::math::binomial(). More...
 
struct  binomial_impl< T, U, binomial_fp_arith_enabler< T, U > >
 Specialisation of the implementation of piranha::math::binomial() for floating-point and arithmetic arguments. More...
 
struct  binomial_impl< T, U, detail::real_binomial_enabler< T, U > >
 Specialisation of the piranha::math::binomial() functor for piranha::real. More...
 
struct  binomial_impl< T, U, integer_binomial_enabler< T, U > >
 Specialisation of the implementation of piranha::math::binomial() for piranha::mp_integer. More...
 
struct  binomial_impl< T, U, math_rational_binomial_enabler< T, U > >
 Specialisation of the implementation of piranha::math::binomial() for piranha::mp_rational. More...
 
struct  cos_impl
 Default functor for the implementation of piranha::math::cos(). More...
 
struct  cos_impl< mp_integer< SSize > >
 Specialisation of the implementation of piranha::math::cos() for piranha::mp_integer. More...
 
struct  cos_impl< mp_rational< SSize > >
 Specialisation of the implementation of piranha::math::cos() for piranha::mp_rational. More...
 
struct  cos_impl< Series, detail::series_cos_enabler< Series > >
 Specialisation of the piranha::math::cos() functor for piranha::series. More...
 
struct  cos_impl< T, typename std::enable_if< std::is_floating_point< T >::value >::type >
 Specialisation of the piranha::math::cos() functor for floating-point types. More...
 
struct  cos_impl< T, typename std::enable_if< std::is_integral< T >::value >::type >
 Specialisation of the piranha::math::cos() functor for integral types. More...
 
struct  cos_impl< T, typename std::enable_if< std::is_same< T, real >::value >::type >
 Specialisation of the piranha::math::cos() functor for piranha::real. More...
 
struct  degree_impl
 Default functor for the implementation of piranha::math::degree(). More...
 
struct  degree_impl< Series, ps_degree_enabler< Series > >
 Specialisation of the piranha::math::degree() functor for instances of piranha::power_series. More...
 
struct  div3_impl
 Default functor for the implementation of piranha::math::div3(). More...
 
struct  div3_impl< mp_integer< SSize > >
 Specialisation of the implementation of piranha::math::div3() for piranha::mp_integer. More...
 
struct  div3_impl< T, typename std::enable_if< std::is_integral< T >::value >::type >
 Specialisation of the piranha::math::div3() functor for integral types. More...
 
class  evaluate_impl
 Default functor for the implementation of piranha::math::evaluate(). More...
 
class  evaluate_impl< Series, T, math_series_evaluate_enabler< Series, T > >
 Specialisation of the implementation of piranha::math::evaluate() for series types. More...
 
struct  gcd3_impl
 Default functor for the implementation of piranha::math::gcd3(). More...
 
struct  gcd3_impl< mp_integer< SSize > >
 Specialisation of the implementation of piranha::math::gcd3() for piranha::mp_integer. More...
 
struct  gcd3_impl< T, typename std::enable_if< std::is_integral< T >::value >::type >
 Specialisation of the piranha::math::gcd3() functor for integral types. More...
 
struct  gcd_impl
 Default functor for the implementation of piranha::math::gcd(). More...
 
struct  gcd_impl< T, U, math_mp_integer_gcd_enabler< T, U > >
 Specialisation of the implementation of piranha::math::gcd() for piranha::mp_integer. More...
 
struct  gcd_impl< T, U, typename std::enable_if< std::is_integral< T >::value &&std::is_integral< U >::value >::type >
 Implementation of piranha::math::gcd() for integral types. More...
 
struct  integrate_impl
 Default functor for the implementation of piranha::math::integrate(). More...
 
struct  integrate_impl< Series, detail::series_integrate_enabler< Series > >
 Specialisation of the piranha::math::integrate() functor for series types. More...
 
struct  invert_impl
 Default functor for the implementation of piranha::math::invert(). More...
 
struct  invert_impl< Series, detail::series_invert_enabler< Series > >
 Specialisation of the piranha::math::invert() functor for piranha::series. More...
 
struct  ipow_subs_impl
 Default functor for the implementation of piranha::math::ipow_subs(). More...
 
struct  ipow_subs_impl< Series, T, ipow_subs_impl_ipow_subs_series_enabler< Series, T > >
 Specialisation of the piranha::math::ipow_subs_impl functor for instances of piranha::ipow_substitutable_series. More...
 
struct  is_unitary_impl
 Default functor for the implementation of piranha::math::is_unitary(). More...
 
struct  is_unitary_impl< mp_integer< SSize > >
 Specialisation of the implementation of piranha::math::is_unitary() for piranha::mp_integer. More...
 
struct  is_unitary_impl< mp_rational< SSize > >
 Specialisation of the implementation of piranha::math::is_unitary() for piranha::mp_rational. More...
 
struct  is_zero_impl
 Default functor for the implementation of piranha::math::is_zero(). More...
 
struct  is_zero_impl< mp_integer< SSize > >
 Specialisation of the implementation of piranha::math::is_zero() for piranha::mp_integer. More...
 
struct  is_zero_impl< mp_rational< SSize > >
 Specialisation of the implementation of piranha::math::is_zero() for piranha::mp_rational. More...
 
struct  is_zero_impl< Series, typename std::enable_if< is_series< Series >::value >::type >
 Specialisation of the piranha::math::is_zero() functor for piranha::series. More...
 
struct  is_zero_impl< T, detail::math_is_zero_std_complex_enabler< T > >
 Specialisation of the piranha::math::is_zero() functor for C++ complex floating-point types. More...
 
struct  is_zero_impl< T, typename std::enable_if< std::is_same< T, real >::value >::type >
 Specialisation of the piranha::math::is_zero() functor for piranha::real. More...
 
class  lambdified
 Functor interface for piranha::math::evaluate(). More...
 
struct  ldegree_impl
 Default functor for the implementation of piranha::math::ldegree(). More...
 
struct  ldegree_impl< Series, ps_degree_enabler< Series > >
 Specialisation of the piranha::math::ldegree() functor for instances of piranha::power_series. More...
 
struct  mul3_impl
 Default functor for the implementation of piranha::math::mul3(). More...
 
struct  mul3_impl< mp_integer< SSize > >
 Specialisation of the implementation of piranha::math::mul3() for piranha::mp_integer. More...
 
struct  mul3_impl< T, typename std::enable_if< std::is_integral< T >::value >::type >
 Specialisation of the piranha::math::mul3() functor for integral types. More...
 
struct  multiply_accumulate_impl
 Default functor for the implementation of piranha::math::multiply_accumulate(). More...
 
struct  multiply_accumulate_impl< mp_integer< SSize > >
 Specialisation of the implementation of piranha::math::multiply_accumulate() for piranha::mp_integer. More...
 
struct  multiply_accumulate_impl< real >
 Specialisation of the implementation of piranha::math::multiply_accumulate() for piranha::real. More...
 
struct  negate_impl
 Default functor for the implementation of piranha::math::negate(). More...
 
struct  negate_impl< mp_integer< SSize > >
 Specialisation of the implementation of piranha::math::negate() for piranha::mp_integer. More...
 
struct  negate_impl< mp_rational< SSize > >
 Specialisation of the implementation of piranha::math::negate() for piranha::mp_rational. More...
 
struct  negate_impl< T, typename std::enable_if< is_series< T >::value >::type >
 Specialisation of the piranha::math::negate() functor for piranha::series. More...
 
struct  negate_impl< T, typename std::enable_if< std::is_same< T, real >::value >::type >
 Specialisation of the piranha::math::negate() functor for piranha::real. More...
 
struct  partial_impl
 Default functor for the implementation of piranha::math::partial(). More...
 
struct  partial_impl< mp_integer< SSize > >
 Specialisation of the implementation of piranha::math::partial() for piranha::mp_integer. More...
 
struct  partial_impl< mp_rational< SSize > >
 Specialisation of the implementation of piranha::math::partial() for piranha::mp_rational. More...
 
struct  partial_impl< Series, detail::series_partial_enabler< Series > >
 Specialisation of the piranha::math::partial() functor for series types. More...
 
struct  partial_impl< T, typename std::enable_if< std::is_arithmetic< T >::value >::type >
 Specialisation of the piranha::math::partial() functor for arithmetic types. More...
 
struct  partial_impl< T, typename std::enable_if< std::is_same< T, real >::value >::type >
 Specialisation of the piranha::math::partial() functor for piranha::real. More...
 
struct  pow_impl
 Default functor for the implementation of piranha::math::pow(). More...
 
struct  pow_impl< Series, T, pow_series_enabler< Series, T > >
 Specialisation of the piranha::math::pow() functor for piranha::series. More...
 
struct  pow_impl< T, U, detail::real_pow_enabler< T, U > >
 Specialisation of the piranha::math::pow() functor for piranha::real. More...
 
struct  pow_impl< T, U, integer_pow_enabler< T, U > >
 Specialisation of the implementation of piranha::math::pow() for piranha::mp_integer and integral types. More...
 
struct  pow_impl< T, U, math_rational_pow_enabler< T, U > >
 Specialisation of the implementation of piranha::math::pow() for piranha::mp_rational. More...
 
struct  pow_impl< T, U, pow_fp_arith_enabler< T, U > >
 Specialisation of the implementation of piranha::math::pow() for arithmetic and floating-point types. More...
 
struct  sin_impl
 Default functor for the implementation of piranha::math::sin(). More...
 
struct  sin_impl< mp_integer< SSize > >
 Specialisation of the implementation of piranha::math::sin() for piranha::mp_integer. More...
 
struct  sin_impl< mp_rational< SSize > >
 Specialisation of the implementation of piranha::math::sin() for piranha::mp_rational. More...
 
struct  sin_impl< Series, detail::series_sin_enabler< Series > >
 Specialisation of the piranha::math::sin() functor for piranha::series. More...
 
struct  sin_impl< T, typename std::enable_if< std::is_floating_point< T >::value >::type >
 Specialisation of the piranha::math::sin() functor for floating-point types. More...
 
struct  sin_impl< T, typename std::enable_if< std::is_integral< T >::value >::type >
 Specialisation of the piranha::math::sin() functor for integral types. More...
 
struct  sin_impl< T, typename std::enable_if< std::is_same< T, real >::value >::type >
 Specialisation of the piranha::math::sin() functor for piranha::real. More...
 
struct  sub3_impl
 Default functor for the implementation of piranha::math::sub3(). More...
 
struct  sub3_impl< mp_integer< SSize > >
 Specialisation of the implementation of piranha::math::sub3() for piranha::mp_integer. More...
 
struct  sub3_impl< T, typename std::enable_if< std::is_integral< T >::value >::type >
 Specialisation of the piranha::math::sub3() functor for integral types. More...
 
struct  subs_impl
 Default functor for the implementation of piranha::math::subs(). More...
 
struct  subs_impl< Series, T, detail::subs_impl_subs_series_enabler< Series, T > >
 Specialisation of the piranha::math::subs_impl functor for instances of piranha::substitutable_series. More...
 
struct  t_degree_impl
 Default functor for the implementation of piranha::math::t_degree(). More...
 
struct  t_degree_impl< Series, typename std::enable_if< std::is_base_of< detail::trigonometric_series_tag, Series >::value >::type >
 Specialisation of the piranha::math::t_degree() functor for instances of piranha::trigonometric_series. More...
 
struct  t_ldegree_impl
 Default functor for the implementation of piranha::math::t_ldegree(). More...
 
struct  t_ldegree_impl< Series, typename std::enable_if< std::is_base_of< detail::trigonometric_series_tag, Series >::value >::type >
 Specialisation of the piranha::math::t_ldegree() functor for instances of piranha::trigonometric_series. More...
 
struct  t_lorder_impl
 Default functor for the implementation of piranha::math::t_lorder(). More...
 
struct  t_lorder_impl< Series, typename std::enable_if< std::is_base_of< detail::trigonometric_series_tag, Series >::value >::type >
 Specialisation of the piranha::math::t_lorder() functor for instances of piranha::trigonometric_series. More...
 
struct  t_order_impl
 Default functor for the implementation of piranha::math::t_order(). More...
 
struct  t_order_impl< Series, typename std::enable_if< std::is_base_of< detail::trigonometric_series_tag, Series >::value >::type >
 Specialisation of the piranha::math::t_order() functor for instances of piranha::trigonometric_series. More...
 
struct  t_subs_impl
 Default functor for the implementation of piranha::math::t_subs(). More...
 
struct  t_subs_impl< Series, U, V, detail::t_subs_impl_t_subs_series_enabler< Series, U, V > >
 Specialisation of the piranha::math::t_subs() functor for instances of piranha::t_substitutable_series. More...
 
struct  truncate_degree_impl
 Implementation of the piranha::math::truncate_degree() functor. More...
 
struct  truncate_degree_impl< Series, T, ps_degree_enabler< Series > >
 Specialisation of the piranha::math::truncate_degree() functor for instances of piranha::power_series. More...
 

Functions

template<typename T , typename U >
math_binomial_type< T, U > binomial (const T &x, const U &y)
 Generalised binomial coefficient. More...
 
template<typename T >
auto invert (const T &x) -> decltype(invert_impl< T >()(x))
 Compute the inverse. More...
 
template<typename U , typename T >
detail::math_lambdify_type< T, U > lambdify (T &&x, const std::vector< std::string > &names, detail::math_lambdify_extra_map_type< T, U > extra_map={})
 Create a functor interface for piranha::math::evaluate(). More...
 
template<typename T , detail::math_is_zero_enabler< T > = 0>
bool is_zero (const T &x)
 Zero test. More...
 
template<typename T , detail::math_is_unitary_enabler< T > = 0>
bool is_unitary (const T &x)
 Unitary test. More...
 
template<typename T , detail::math_negate_enabler< T > = 0>
void negate (T &x)
 In-place negation. More...
 
template<typename T , math_multiply_accumulate_enabler< T > = 0>
void multiply_accumulate (T &x, const T &y, const T &z)
 Multiply-accumulate. More...
 
template<typename T >
detail::math_cos_type< T > cos (const T &x)
 Cosine. More...
 
template<typename T >
detail::math_sin_type< T > sin (const T &x)
 Sine. More...
 
template<typename T >
detail::math_partial_type< T > partial (const T &x, const std::string &str)
 Partial derivative. More...
 
template<typename T >
detail::math_integrate_type< T > integrate (const T &x, const std::string &str)
 Integration. More...
 
template<typename U , typename T >
math_evaluate_t< T, U > evaluate (const T &x, const symbol_fmap< U > &dict)
 Evaluation. More...
 
template<typename U , typename T >
detail::math_subs_type< T, U > subs (const T &x, const symbol_fmap< U > &dict)
 Substitution. More...
 
template<typename T , typename U , typename V >
detail::math_t_subs_type< T, U, V > t_subs (const T &x, const std::string &name, const U &c, const V &s)
 Trigonometric substitution. More...
 
template<typename T >
auto abs (const T &x) -> decltype(abs_impl< T >()(x))
 Absolute value. More...
 
template<typename T >
detail::pbracket_type< T > pbracket (const T &f, const T &g, const std::vector< std::string > &p_list, const std::vector< std::string > &q_list)
 Poisson bracket. More...
 
template<typename T , detail::is_canonical_enabler< T > = 0>
bool transformation_is_canonical (const std::vector< T > &new_p, const std::vector< T > &new_q, const std::vector< std::string > &p_list, const std::vector< std::string > &q_list)
 Check if a transformation is canonical. More...
 
template<typename T , detail::is_canonical_enabler< T > = 0>
bool transformation_is_canonical (std::initializer_list< T > new_p, std::initializer_list< T > new_q, const std::vector< std::string > &p_list, const std::vector< std::string > &q_list)
 Check if a transformation is canonical (alternative overload). More...
 
template<typename T >
auto degree (const T &x) -> decltype(degree_impl< T >()(x))
 Total degree. More...
 
template<typename T >
auto degree (const T &x, const symbol_fset &s) -> decltype(degree_impl< T >()(x, s))
 Partial degree. More...
 
template<typename T >
auto ldegree (const T &x) -> decltype(ldegree_impl< T >()(x))
 Total low degree. More...
 
template<typename T >
auto ldegree (const T &x, const symbol_fset &s) -> decltype(ldegree_impl< T >()(x, s))
 Partial low degree. More...
 
template<typename T >
auto t_degree (const T &x) -> decltype(t_degree_impl< T >
 Total trigonometric degree. More...
 
template<typename T >
auto t_degree (const T &x, const symbol_fset &names) -> decltype(t_degree_impl< T >
 Partial trigonometric degree. More...
 
template<typename T >
auto t_ldegree (const T &x) -> decltype(t_ldegree_impl< T >
 Total trigonometric low degree. More...
 
template<typename T >
auto t_ldegree (const T &x, const symbol_fset &names) -> decltype(t_ldegree_impl< T >
 Partial trigonometric low degree. More...
 
template<typename T >
auto t_order (const T &x) -> decltype(t_order_impl< T >
 Total trigonometric order. More...
 
template<typename T >
auto t_order (const T &x, const symbol_fset &names) -> decltype(t_order_impl< T >
 Partial trigonometric order. More...
 
template<typename T >
auto t_lorder (const T &x) -> decltype(t_lorder_impl< T >
 Total trigonometric low order. More...
 
template<typename T >
auto t_lorder (const T &x, const symbol_fset &names) -> decltype(t_lorder_impl< T >
 Partial trigonometric low order. More...
 
template<typename T , typename U , detail::truncate_degree_enabler< T, U > = 0>
truncate_degree (const T &x, const U &max_degree)
 Truncation based on the total degree. More...
 
template<typename T , typename U , detail::truncate_pdegree_enabler< T, U > = 0>
truncate_degree (const T &x, const U &max_degree, const symbol_fset &names)
 Truncation based on the partial degree. More...
 
template<typename T >
auto add3 (T &a, const T &b, const T &c) -> decltype(add3_impl< T >()(a, b, c))
 Ternary addition. More...
 
template<typename T >
auto sub3 (T &a, const T &b, const T &c) -> decltype(sub3_impl< T >()(a, b, c))
 Ternary subtraction. More...
 
template<typename T >
auto mul3 (T &a, const T &b, const T &c) -> decltype(mul3_impl< T >()(a, b, c))
 Ternary multiplication. More...
 
template<typename T >
auto div3 (T &a, const T &b, const T &c) -> decltype(div3_impl< T >()(a, b, c))
 Ternary division. More...
 
template<typename T , typename U >
auto gcd (const T &a, const U &b) -> decltype(gcd_impl< T, U >()(a, b))
 GCD. More...
 
template<typename T >
auto gcd3 (T &out, const T &a, const T &b) -> decltype(gcd3_impl< T >()(out, a, b))
 Ternary GCD. More...
 
template<std::size_t SSize>
mp_integer< SSize > factorial (const mp_integer< SSize > &n)
 Factorial. More...
 
template<typename T , typename U >
math_ipow_subs_t< T, U > ipow_subs (const T &x, const std::string &name, const integer &n, const U &y)
 Substitution of integral power. More...
 
template<typename T , typename U , typename Int >
math_ipow_subs_int_t< T, U, Int > ipow_subs (const T &x, const std::string &name, const Int &n, const U &y)
 Substitution of integral power (convenience overload). More...
 
template<typename T , typename U >
math_pow_t< T, U > pow (const T &x, const U &y)
 Exponentiation. More...
 

Variables

 x
 
 names
 

Detailed Description

Math namespace.

Namespace for general-purpose mathematical functions.

Function Documentation

◆ abs()

template<typename T >
auto piranha::math::abs ( const T &  x) -> decltype(abs_impl<T>()(x))
inline

Absolute value.

The actual implementation of this function is in the piranha::math::abs_impl functor.

Parameters
xquantity whose absolute value will be calculated.
Returns
absolute value of x.
Exceptions
unspecifiedany exception thrown by the call operator of piranha::math::abs_impl.

Definition at line 1018 of file math.hpp.

◆ add3()

template<typename T >
auto piranha::math::add3 ( T &  a,
const T &  b,
const T &  c 
) -> decltype(add3_impl<T>()(a, b, c))
inline

Ternary addition.

This function will set a to b + c. The actual implementation of this function is in the piranha::math::add3_impl functor's call operator.

Parameters
athe return value.
bthe first operand.
cthe second operand.
Returns
the value returned by the call operator of piranha::math::add3_impl.
Exceptions
unspecifiedany exception thrown by the call operator of the piranha::math::add3_impl functor.

Definition at line 2582 of file math.hpp.

◆ binomial()

template<typename T , typename U >
math_binomial_type<T, U> piranha::math::binomial ( const T &  x,
const U &  y 
)
inline

Generalised binomial coefficient.

Generic binomial coefficient.

Note
This function is enabled only if binomial_impl<T,U>{}(x,y) is a valid expression, returning a type which satisfies piranha::is_returnable.

Will return the generalised binomial coefficient:

\[ {x \choose y}. \]

The actual implementation of this function is in the piranha::math::binomial_impl functor. The body of this function is equivalent to:

return binomial_impl<T,U>{}(x,y);
Parameters
xtop number.
ybottom number.
Returns
x choose y.
Exceptions
unspecifiedany exception thrown by the call operator of piranha::math::binomial_impl.

Definition at line 215 of file binomial.hpp.

◆ cos()

template<typename T >
detail::math_cos_type<T> piranha::math::cos ( const T &  x)
inline

Cosine.

Note
This function is enabled only if the expression cos_impl<T>{}(x) is valid, returning a type which satisfies piranha::is_returnable.

Returns the cosine of x. The actual implementation of this function is in the piranha::math::cos_impl functor's call operator. The body of this function is equivalent to:

return cos_impl<T>{}(x);
Parameters
xcosine argument.
Returns
cosine of x.
Exceptions
unspecifiedany exception thrown by the call operator of the piranha::math::cos_impl functor.

Definition at line 530 of file math.hpp.

◆ degree() [1/2]

template<typename T >
auto piranha::math::degree ( const T &  x) -> decltype(degree_impl<T>()(x))
inline

Total degree.

Return the total degree (as in polynomial degree).

The actual implementation of this function is in the piranha::math::degree_impl functor.

Parameters
xobject whose degree will be computed.
Returns
total degree.
Exceptions
unspecifiedany exception thrown by the call operator of piranha::math::degree_impl.

Definition at line 1341 of file math.hpp.

◆ degree() [2/2]

template<typename T >
auto piranha::math::degree ( const T &  x,
const symbol_fset s 
) -> decltype(degree_impl<T>()(x, s))
inline

Partial degree.

This function returns the partial degree (i.e, the degree when only a subset of symbols is considered in the computation) of the input object x.

The actual implementation of this function is in the piranha::math::degree_impl functor.

Parameters
xthe object whose partial degree will be computed.
sthe set of symbols that will be considered in the computation of the partial degree.
Returns
the partial degree of x.
Exceptions
unspecifiedany exception thrown by the call operator of piranha::math::degree_impl.

Definition at line 1362 of file math.hpp.

◆ div3()

template<typename T >
auto piranha::math::div3 ( T &  a,
const T &  b,
const T &  c 
) -> decltype(div3_impl<T>()(a, b, c))
inline

Ternary division.

This function will set a to b / c. The actual implementation of this function is in the piranha::math::div3_impl functor's call operator.

Parameters
athe return value.
bthe first operand.
cthe second operand.
Returns
the value returned by the call operator of piranha::math::div3_impl.
Exceptions
unspecifiedany exception thrown by the call operator of the piranha::math::div3_impl functor.

Definition at line 2798 of file math.hpp.

◆ evaluate()

template<typename U , typename T >
math_evaluate_t<T, U> piranha::math::evaluate ( const T &  x,
const symbol_fmap< U > &  dict 
)
inline

Evaluation.

Note
This function is enabled only if evaluate_impl<T,U>{}(x, dict) is a valid expression, returning a type which satisfies piranha::is_returnable.

Evaluation is the simultaneous substitution of all symbolic arguments in an expression. The input dictionary dict specifies the value that will be susbstituted for each symbol. The actual implementation of this function is in the piranha::math::evaluate_impl functor. The body of this function is equivalent to:

return evaluate_impl<T,U>{}(x,dict);
Parameters
xthe quantity that will be evaluated.
dicta dictionary that will be used to perform the substitution.
Returns
x evaluated according to dict.
Exceptions
unspecifiedany exception thrown by the call operator of piranha::math::evaluate_impl.

Definition at line 831 of file math.hpp.

◆ factorial()

template<std::size_t SSize>
mp_integer<SSize> piranha::math::factorial ( const mp_integer< SSize > &  n)
inline

Factorial.

This function will use internally piranha::mp_integer::fac_ui().

Parameters
nfactorial argument.
Returns
the factorial of n.
Exceptions
std::domain_errorif n is negative.
unspecifiedany exception thrown by piranha::mp_integer::fac_ui() or by the conversion of n to unsigned long.

Definition at line 254 of file mp_integer.hpp.

◆ gcd()

template<typename T , typename U >
auto piranha::math::gcd ( const T &  a,
const U &  b 
) -> decltype(gcd_impl<T, U>()(a, b))
inline

GCD.

This function will return the GCD of a and b. The actual implementation of this function is in the piranha::math::gcd_impl functor's call operator.

Parameters
athe first operand.
bthe second operand.
Returns
the value returned by the call operator of piranha::math::gcd_impl.
Exceptions
unspecifiedany exception thrown by the call operator of the piranha::math::gcd_impl functor.

Definition at line 2878 of file math.hpp.

◆ gcd3()

template<typename T >
auto piranha::math::gcd3 ( T &  out,
const T &  a,
const T &  b 
) -> decltype(gcd3_impl<T>()(out, a, b))
inline

Ternary GCD.

This function will write the GCD of a and b into out. The actual implementation of this function is in the piranha::math::gcd3_impl functor's call operator.

Parameters
outthe output value.
athe first operand.
bthe second operand.
Returns
the value returned by the call operator of piranha::math::gcd3_impl.
Exceptions
unspecifiedany exception thrown by the call operator of the piranha::math::gcd3_impl functor.

Definition at line 2947 of file math.hpp.

◆ integrate()

template<typename T >
detail::math_integrate_type<T> piranha::math::integrate ( const T &  x,
const std::string &  str 
)
inline

Integration.

Note
This function is enabled only if the expression integrate_impl<T>{}(x,str) is valid, returning a type that satisfies piranha::is_returnable.

Return the antiderivative of x with respect to the symbolic quantity named str. The actual implementation of this function is in the piranha::math::integrate_impl functor. The body of this function is equivalent to:

return integrate_impl<T>{}(x,str);
Parameters
xargument for the integration.
strname of the symbolic quantity with respect to which the integration will be computed.
Returns
antiderivative of x with respect to str.
Exceptions
unspecifiedany exception thrown by the call operator of piranha::math::integrate_impl.

Definition at line 743 of file math.hpp.

◆ invert()

template<typename T >
auto piranha::math::invert ( const T &  x) -> decltype(invert_impl<T>()(x))
inline

Compute the inverse.

Return the multiplicative inverse of x. The actual implementation of this function is in the piranha::math::invert_impl functor's call operator.

Parameters
xargument.
Returns
the multiplicative inverse of x.
Exceptions
unspecifiedany exception thrown by the call operator of the piranha::math::invert_impl functor.

Definition at line 79 of file invert.hpp.

◆ ipow_subs() [1/2]

template<typename T , typename U >
math_ipow_subs_t<T, U> piranha::math::ipow_subs ( const T &  x,
const std::string &  name,
const integer n,
const U &  y 
)
inline

Substitution of integral power.

Note
This function is enabled only if the expression ipow_subs_impl<T, U>{}(x, name, n, y) is valid, returning a type which satisfies piranha::is_returnable.

Substitute, in x, name**n with y. The actual implementation of this function is in the piranha::math::ipow_subs_impl functor's call operator. The body of this function is equivalent to:

return ipow_subs_impl<T, U>{}(x, name, n, y);
Parameters
xquantity that will be subject to substitution.
namename of the symbolic variable that will be substituted.
npower of name that will be substituted.
yobject that will substitute the variable.
Returns
x after the substitution of name to the power of n with y.
Exceptions
unspecifiedany exception thrown by the call operator of piranha::math::subs_impl.

Definition at line 312 of file mp_integer.hpp.

◆ ipow_subs() [2/2]

template<typename T , typename U , typename Int >
math_ipow_subs_int_t<T, U, Int> piranha::math::ipow_subs ( const T &  x,
const std::string &  name,
const Int &  n,
const U &  y 
)
inline

Substitution of integral power (convenience overload).

Note
This function is enabled only if:

This function is a convenience wrapper that will call the other piranha::math::ipow_subs() overload, with n converted to a piranha::integer.

Parameters
xquantity that will be subject to substitution.
namename of the symbolic variable that will be substituted.
npower of name that will be substituted.
yobject that will substitute the variable.
Returns
x after the substitution of name to the power of n with y.
Exceptions
unspecifiedany exception thrown by the other overload of piranha::math::ipow_subs().

Definition at line 518 of file mp_integer.hpp.

◆ is_unitary()

template<typename T , detail::math_is_unitary_enabler< T > = 0>
bool piranha::math::is_unitary ( const T &  x)
inline

Unitary test.

Note
This function is enabled only if is_unitary_impl<T>{}(x) is a valid expression, returning a type which is implicitly convertible to bool.

Test if value is equal to 1. The actual implementation of this function is in the piranha::math::is_unitary_impl functor's call operator. The body of this function is equivalent to:

return is_unitary_impl<T>{}(x);
Parameters
xvalue to be tested.
Returns
true if value is equal to 1, false otherwise.
Exceptions
unspecifiedany exception thrown by the call operator of the piranha::math::is_unitary_impl functor, or by the conversion of the result to bool.

Definition at line 242 of file math.hpp.

◆ is_zero()

template<typename T , detail::math_is_zero_enabler< T > = 0>
bool piranha::math::is_zero ( const T &  x)
inline

Zero test.

Note
This function is enabled only if is_zero_impl<T>{}(x) is a well-formed expression returning a type implicitly convertible to bool.

Test if value is zero. The actual implementation of this function is in the piranha::math::is_zero_impl functor's call operator. The body of this function is equivalent to:

return is_zero_impl<T>{}(x);
Parameters
xvalue to be tested.
Returns
true if value is zero, false otherwise.
Exceptions
unspecifiedany exception thrown by the call operator of the piranha::math::is_zero_impl functor or by the conversion of the result to bool.

Definition at line 133 of file math.hpp.

◆ lambdify()

template<typename U , typename T >
detail::math_lambdify_type<T, U> piranha::math::lambdify ( T &&  x,
const std::vector< std::string > &  names,
detail::math_lambdify_extra_map_type< T, U >  extra_map = {} 
)
inline

Create a functor interface for piranha::math::evaluate().

Note
This function is enabled only if the decay types of T and U can be used as template parameters in piranha::math::lambdified.

This utility function will create an object of type piranha::math::lambdified that can be used to evaluate x with a function-like interface. The parameters of this function are passed to the constructor of the returned piranha::math::lambdified object. For example:

polynomial<integer,k_monomial> x{"x"}, y{"y"}, z{"z"};
auto l = lambdify<double>(x-2*y+3*z,{"z","y","x"});

The object l can then be used to evaluate x-2*y+3*z in the following way:

l({1.,2.,3.});

That is, x-2*y+3*z is evaluated with x=3., y=2. and z=1..

The optional parameter extra_map (of type piranha::math::lambdified::extra_map_type) is a map specifying how specific symbols should be evaluated. It is most useful when symbols have an implicit dependency on other symbols. For instance, suppose that the symbol \(z\) is implicitly dependent on the symbols \(x\) and \(y\) via \(z\left(x,y\right) = \sqrt{x+y}\). Then in order to evaluate \(x + y + z\) we can write:

polynomial<integer,k_monomial> x{"x"}, y{"y"}, z{"z"};
auto l = lambdify<double>(x+y+z,{"x","y"},{{"z",[](const std::vector<double> &v) {return std::sqrt(v[0]+v[1]);}}});
std::cout << l({1.,2.}) << '\n' // This will print 1.+2.+sqrt(1.+2.) = 4.7320508076...

See the constructor of piranha::math::lambdified for more details on the extra_map argument.

The decay types of T and U are used as template parameters for the piranha::math::lambdified return type.

Parameters
xobject that will be evaluated.
namesnames of the symbols that will be used for evaluation.
extra_mapmap of type piranha::math::lambdified::extra_map_type for custom symbol evaluation.
Returns
an instance of piranha::math::lambdified that can be used to evaluate x.
Exceptions
unspecifiedany exception thrown by the constructor of piranha::math::lambdified.

Definition at line 397 of file lambdify.hpp.

◆ ldegree() [1/2]

template<typename T >
auto piranha::math::ldegree ( const T &  x) -> decltype(ldegree_impl<T>()(x))
inline

Total low degree.

Return the total low degree (as in polynomial low degree).

The actual implementation of this function is in the piranha::math::ldegree_impl functor.

Parameters
xobject whose low degree will be computed.
Returns
total low degree.
Exceptions
unspecifiedany exception thrown by the call operator of piranha::math::ldegree_impl.

Definition at line 1393 of file math.hpp.

◆ ldegree() [2/2]

template<typename T >
auto piranha::math::ldegree ( const T &  x,
const symbol_fset s 
) -> decltype(ldegree_impl<T>()(x, s))
inline

Partial low degree.

This function returns the partial low degree (i.e, the low degree when only a subset of symbols is considered in the computation) of the input object x.

The actual implementation of this function is in the piranha::math::degree_impl functor.

Parameters
xthe object whose partial low degree will be computed.
sthe set of symbols that will be considered in the computation of the partial low degree.
Returns
the partial low degree of x.
Exceptions
unspecifiedany exception thrown by the call operator of piranha::math::degree_impl.

Definition at line 1414 of file math.hpp.

◆ mul3()

template<typename T >
auto piranha::math::mul3 ( T &  a,
const T &  b,
const T &  c 
) -> decltype(mul3_impl<T>()(a, b, c))
inline

Ternary multiplication.

This function will set a to b * c. The actual implementation of this function is in the piranha::math::mul3_impl functor's call operator.

Parameters
athe return value.
bthe first operand.
cthe second operand.
Returns
the value returned by the call operator of piranha::math::mul3_impl.
Exceptions
unspecifiedany exception thrown by the call operator of the piranha::math::mul3_impl functor.

Definition at line 2726 of file math.hpp.

◆ multiply_accumulate()

template<typename T , math_multiply_accumulate_enabler< T > = 0>
void piranha::math::multiply_accumulate ( T &  x,
const T &  y,
const T &  z 
)
inline

Multiply-accumulate.

Note
This function is enabled only if the expression multiply_accumulate_impl<T>{}(x, y, z) is valid.

This function will set x to x + y * z. The actual implementation of this function is in the piranha::math::multiply_accumulate_impl functor's call operator. The body of this function is equivalent to:

multiply_accumulate_impl<T>{}(x, y, z);
Parameters
xtarget value for accumulation.
yfirst argument.
zsecond argument.
Exceptions
unspecifiedany exception thrown by the call operator of piranha::math::multiply_accumulate_impl.

Definition at line 438 of file math.hpp.

◆ negate()

template<typename T , detail::math_negate_enabler< T > = 0>
void piranha::math::negate ( T &  x)
inline

In-place negation.

Note
This function is enabled only if T is not const and if the expression negate_impl<T>{}(x) is valid.

Negate value in-place. The actual implementation of this function is in the piranha::math::negate_impl functor's call operator. The body of this function is equivalent to:

negate_impl<T>{}(x);

The result of the call operator of piranha::math::negate_impl is ignored.

Parameters
xvalue to be negated.
Exceptions
unspecifiedany exception thrown by the call operator of piranha::math::negate_impl.

Definition at line 329 of file math.hpp.

◆ partial()

template<typename T >
detail::math_partial_type<T> piranha::math::partial ( const T &  x,
const std::string &  str 
)
inline

Partial derivative.

Note
This function is enabled only if the expression partial_impl<T>{}(x,str) is valid, returning a type that satisfies piranha::is_returnable.

Return the partial derivative of x with respect to the symbolic quantity named str. The actual implementation of this function is in the piranha::math::partial_impl functor. The body of this function is equivalent to:

return partial_impl<T>{}(x,str);
Parameters
xargument for the partial derivative.
strname of the symbolic quantity with respect to which the derivative will be computed.
Returns
partial derivative of x with respect to str.
Exceptions
unspecifiedany exception thrown by the call operator of piranha::math::partial_impl.

Definition at line 691 of file math.hpp.

◆ pbracket()

template<typename T >
detail::pbracket_type<T> piranha::math::pbracket ( const T &  f,
const T &  g,
const std::vector< std::string > &  p_list,
const std::vector< std::string > &  q_list 
)
inline

Poisson bracket.

Note
This template function is enabled only if T is differentiable and the arithmetic operations needed to compute the brackets are supported by the types involved in the computation.

The Poisson bracket of f and g with respect to the list of momenta p_list and coordinates q_list is defined as:

\[ \left\{f,g\right\} = \sum_{i=1}^{N} \left[ \frac{\partial f}{\partial q_{i}} \frac{\partial g}{\partial p_{i}} - \frac{\partial f}{\partial p_{i}} \frac{\partial g}{\partial q_{i}} \right], \]

where \( p_i \) and \( q_i \) are the elements of p_list and q_list.

Parameters
ffirst argument.
gsecond argument.
p_listlist of the names of momenta.
q_listlist of the names of coordinates.
Returns
the poisson bracket of f and g with respect to p_list and q_list.
Exceptions
std::invalid_argumentif the sizes of p_list and q_list differ or if p_list or q_list contain duplicate entries.
unspecifiedany exception thrown by piranha::math::partial() or by the invoked arithmetic operators, constructors and assignment operators.

Definition at line 1152 of file math.hpp.

◆ pow()

template<typename T , typename U >
math_pow_t<T, U> piranha::math::pow ( const T &  x,
const U &  y 
)
inline

Exponentiation.

Generic binary exponentiation.

Note
This function is enabled only if the expression pow_impl<T, U>{}(x, y) is valid, returning a type which satisfies piranha::is_returnable.

Return x to the power of y. The actual implementation of this function is in the piranha::math::pow_impl functor's call operator. The body of this function is equivalent to:

return pow_impl<T, U>{}(x, y);
Parameters
xbase.
yexponent.
Returns
x to the power of y.
Exceptions
unspecifiedany exception thrown by the call operator of the piranha::math::pow_impl functor.

Definition at line 126 of file pow.hpp.

◆ sin()

template<typename T >
detail::math_sin_type<T> piranha::math::sin ( const T &  x)
inline

Sine.

Note
This function is enabled only if the expression sin_impl<T>{}(x) is valid, returning a type which satisfies piranha::is_returnable.

Returns the sine of x. The actual implementation of this function is in the piranha::math::sin_impl functor's call operator. The body of this function is equivalent to:

return sin_impl<T>{}(x);
Parameters
xsine argument.
Returns
sine of x.
Exceptions
unspecifiedany exception thrown by the call operator of the piranha::math::sin_impl functor.

Definition at line 622 of file math.hpp.

◆ sub3()

template<typename T >
auto piranha::math::sub3 ( T &  a,
const T &  b,
const T &  c 
) -> decltype(sub3_impl<T>()(a, b, c))
inline

Ternary subtraction.

This function will set a to b - c. The actual implementation of this function is in the piranha::math::sub3_impl functor's call operator.

Parameters
athe return value.
bthe first operand.
cthe second operand.
Returns
the value returned by the call operator of piranha::math::sub3_impl.
Exceptions
unspecifiedany exception thrown by the call operator of the piranha::math::sub3_impl functor.

Definition at line 2654 of file math.hpp.

◆ subs()

template<typename U , typename T >
detail::math_subs_type<T, U> piranha::math::subs ( const T &  x,
const symbol_fmap< U > &  dict 
)
inline

Substitution.

Note
This function is enabled only if subs_impl<T,U>{}(x, dict) is a valid expression, returning a type which satisfies piranha::is_returnable.

Substitute symbolic variables with generic objects. The actual implementation of this function is in the piranha::math::subs_impl functor. The body of this function is equivalent to:

return subs_impl<T,U>{}(x, dict);
Parameters
xthe quantity that will be subject to substitution.
dicta dictionary mapping a set of symbols to the values that will be substituted for them.
Returns
x after the substitution of the symbols in dict with the mapped values.
Exceptions
unspecifiedany exception thrown by the call operator of piranha::math::subs_impl.

Definition at line 881 of file math.hpp.

◆ t_degree() [1/2]

template<typename T >
auto piranha::math::t_degree ( const T &  x) -> decltype(t_degree_impl<T>
inline

Total trigonometric degree.

A type exposing a trigonometric degree property, in analogy with the concept of polynomial degree, should be a linear combination of real or complex trigonometric functions. For instance, the Poisson series

\[ 2\cos\left(3x+y\right) + 3\cos\left(2x-y\right) \]

has a trigonometric degree of 3+1=4.

The actual implementation of this function is in the piranha::math::t_degree_impl functor.

Parameters
xthe object whose trigonometric degree will be computed.
Returns
the total trigonometric degree.
Exceptions
unspecifiedany exception thrown by the call operator of piranha::math::t_degree_impl.

Definition at line 1450 of file math.hpp.

◆ t_degree() [2/2]

template<typename T >
auto piranha::math::t_degree ( const T &  x,
const symbol_fset names 
) -> decltype(t_degree_impl<T>
inline

Partial trigonometric degree.

The partial trigonometric degree is the trigonometric degree when only certain variables are considered in the computation.

The actual implementation of this function is in the piranha::math::t_degree_impl functor.

Parameters
xthe object whose trigonometric degree will be computed.
namesthe names of the variables that will be considered in the computation of the degree.
Returns
the partial trigonometric degree.
Exceptions
unspecifiedany exception thrown by the call operator of piranha::math::t_degree_impl.

Definition at line 1470 of file math.hpp.

◆ t_ldegree() [1/2]

template<typename T >
auto piranha::math::t_ldegree ( const T &  x) -> decltype(t_ldegree_impl<T>
inline

Total trigonometric low degree.

A type exposing a trigonometric low degree property, in analogy with the concept of polynomial low degree, should be a linear combination of real or complex trigonometric functions. For instance, the Poisson series

\[ 2\cos\left(3x+y\right) + 3\cos\left(2x-y\right) \]

has a trigonometric low degree of 2-1=1.

The actual implementation of this function is in the piranha::math::t_ldegree_impl functor.

Parameters
xthee object whose trigonometric low degree will be computed.
Returns
total trigonometric low degree.
Exceptions
unspecifiedany exception thrown by the call operator of piranha::math::t_ldegree_impl.

Definition at line 1506 of file math.hpp.

◆ t_ldegree() [2/2]

template<typename T >
auto piranha::math::t_ldegree ( const T &  x,
const symbol_fset names 
) -> decltype(t_ldegree_impl<T>
inline

Partial trigonometric low degree.

The partial trigonometric low degree is the trigonometric low degree when only certain variables are considered in the computation.

The actual implementation of this function is in the piranha::math::t_ldegree_impl functor.

Parameters
xthe object whose trigonometric low degree will be computed.
namesthe names of the variables that will be considered in the computation of the degree.
Returns
the partial trigonometric low degree.
Exceptions
unspecifiedany exception thrown by the call operator of piranha::math::t_ldegree_impl.

Definition at line 1526 of file math.hpp.

◆ t_lorder() [1/2]

template<typename T >
auto piranha::math::t_lorder ( const T &  x) -> decltype(t_lorder_impl<T>
inline

Total trigonometric low order.

A type exposing a trigonometric low order property should be a linear combination of real or complex trigonometric functions. The low order is computed in a way similar to the trigonometric low degree, with the key difference that the absolute values of the trigonometric degrees of each variable are considered in the computation. For instance, the Poisson series

\[ 2\cos\left(3x+y\right) + 3\cos\left(2x-y\right) \]

has a trigonometric low order of abs(2)+abs(1)=3.

The actual implementation of this function is in the piranha::math::t_lorder_impl functor.

Parameters
xthe object whose trigonometric low order will be computed.
Returns
the total trigonometric low order.
Exceptions
unspecifiedany exception thrown by the call operator of piranha::math::t_lorder_impl.

Definition at line 1622 of file math.hpp.

◆ t_lorder() [2/2]

template<typename T >
auto piranha::math::t_lorder ( const T &  x,
const symbol_fset names 
) -> decltype(t_lorder_impl<T>
inline

Partial trigonometric low order.

The partial trigonometric low order is the trigonometric low order when only certain variables are considered in the computation.

The actual implementation of this function is in the piranha::math::t_lorder_impl functor.

Parameters
xthe object whose trigonometric low order will be computed.
namesthe names of the variables that will be considered in the computation of the order.
Returns
the partial trigonometric low order.
Exceptions
unspecifiedany exception thrown by the call operator of piranha::math::t_lorder_impl.

Definition at line 1642 of file math.hpp.

◆ t_order() [1/2]

template<typename T >
auto piranha::math::t_order ( const T &  x) -> decltype(t_order_impl<T>
inline

Total trigonometric order.

A type exposing a trigonometric order property should be a linear combination of real or complex trigonometric functions. The order is computed in a way similar to the trigonometric degree, with the key difference that the absolute values of the trigonometric degrees of each variable are considered in the computation. For instance, the Poisson series

\[ 2\cos\left(3x+y\right) + 3\cos\left(2x-y\right) \]

has a trigonometric order of abs(3)+abs(1)==4.

The actual implementation of this function is in the piranha::math::t_order_impl functor.

Parameters
xthe object whose trigonometric order will be computed.
Returns
the total trigonometric order.
Exceptions
unspecifiedany exception thrown by the call operator of piranha::math::t_order_impl.

Definition at line 1564 of file math.hpp.

◆ t_order() [2/2]

template<typename T >
auto piranha::math::t_order ( const T &  x,
const symbol_fset names 
) -> decltype(t_order_impl<T>
inline

Partial trigonometric order.

The partial trigonometric order is the trigonometric order when only certain variables are considered in the computation.

The actual implementation of this function is in the piranha::math::t_order_impl functor.

Parameters
xthe object whose trigonometric order will be computed.
namesthe names of the variables that will be considered in the computation of the order.
Returns
the partial trigonometric order.
Exceptions
unspecifiedany exception thrown by the call operator of piranha::math::t_order_impl.

Definition at line 1584 of file math.hpp.

◆ t_subs()

template<typename T , typename U , typename V >
detail::math_t_subs_type<T, U, V> piranha::math::t_subs ( const T &  x,
const std::string &  name,
const U &  c,
const V &  s 
)
inline

Trigonometric substitution.

Note
This function is enabled only if t_subs_impl<T,U,V>{}(x,name,c,s) is a valid expression, returning a type which satisfies piranha::is_returnable.

Substitute the cosine and sine of a symbolic variable with generic objects. The actual implementation of this function is in the piranha::math::t_subs_impl functor. The body of this function is equivalent to:

return t_subs_impl<T,U,V>{}(x,name,c,s);
Parameters
xquantity that will be subject to substitution.
namename of the symbolic variable that will be substituted.
cobject that will substitute the cosine of the variable.
sobject that will substitute the sine of the variable.
Returns
x after substitution of cosine and sine of name with c and s.
Exceptions
unspecifiedany exception thrown by the call operator of piranha::math::t_subs_impl.

Definition at line 936 of file math.hpp.

◆ transformation_is_canonical() [1/2]

template<typename T , detail::is_canonical_enabler< T > = 0>
bool piranha::math::transformation_is_canonical ( const std::vector< T > &  new_p,
const std::vector< T > &  new_q,
const std::vector< std::string > &  p_list,
const std::vector< std::string > &  q_list 
)
inline

Check if a transformation is canonical.

Note
This function is enabled only if all the following requirements are met:

This function will check if a transformation of Hamiltonian momenta and coordinates is canonical using the Poisson bracket test. The transformation is expressed as two separate collections of objects, new_p and new_q, representing the new momenta and coordinates as functions of the old momenta p_list and q_list.

Parameters
new_plist of objects representing the new momenta.
new_qlist of objects representing the new coordinates.
p_listlist of names of the old momenta.
q_listlist of names of the old coordinates.
Returns
true if the transformation is canonical, false otherwise.
Exceptions
std::invalid_argumentif the sizes of the four input arguments are not the same or if either p_list or q_list contain duplicate entries.
unspecifiedany exception thrown by:

Definition at line 1283 of file math.hpp.

◆ transformation_is_canonical() [2/2]

template<typename T , detail::is_canonical_enabler< T > = 0>
bool piranha::math::transformation_is_canonical ( std::initializer_list< T >  new_p,
std::initializer_list< T >  new_q,
const std::vector< std::string > &  p_list,
const std::vector< std::string > &  q_list 
)
inline

Check if a transformation is canonical (alternative overload).

Parameters
new_plist of objects representing the new momenta.
new_qlist of objects representing the new coordinates.
p_listlist of names of the old momenta.
q_listlist of names of the old coordinates.
Returns
the output of transformation_is_canonical(const std::vector<T> &, const std::vector<T> &, const std::vector<std::string> &, const std::vector<std::string> &).
Exceptions
unspecifiedany exception thrown by transformation_is_canonical(const std::vector<T> &, const std::vector<T> &, const std::vector<std::string> &, const std::vector<std::string> &).

Definition at line 1306 of file math.hpp.

◆ truncate_degree() [1/2]

template<typename T , typename U , detail::truncate_degree_enabler< T, U > = 0>
T piranha::math::truncate_degree ( const T &  x,
const U &  max_degree 
)
inline

Truncation based on the total degree.

This method is used to eliminate from the input argument x all the parts whose total degree is greater than max_degree.

The actual implementation of this function is in the piranha::math::truncate_degree_impl functor.

The body of this function is equivalent to:

return truncate_degree_impl<T,U>()(x,max_degree);

The call operator of piranha::math::truncate_degree_impl is required to return type T, otherwise this function will be disabled.

Parameters
xobject which will be subject to truncation.
max_degreemaximum allowed total degree in the output.
Returns
the truncated counterpart of x.
Exceptions
unspecifiedany exception thrown by the call operator of piranha::math::truncate_degree_impl.

Definition at line 1699 of file math.hpp.

◆ truncate_degree() [2/2]

template<typename T , typename U , detail::truncate_pdegree_enabler< T, U > = 0>
T piranha::math::truncate_degree ( const T &  x,
const U &  max_degree,
const symbol_fset names 
)
inline

Truncation based on the partial degree.

This method is used to eliminate from the input argument x all the parts whose partial degree is greater than max_degree.

The actual implementation of this function is in the piranha::math::truncate_degree_impl functor.

The body of this function is equivalent to:

return truncate_degree_impl<T,U>()(x,max_degree,names);

The call operator of piranha::math::truncate_degree_impl is required to return type T, otherwise this function will be disabled.

Parameters
xobject which will be subject to truncation.
max_degreemaximum allowed partial degree in the output.
namesnames of the variables that will be considered in the computation of the partial degree.
Returns
the truncated counterpart of x.
Exceptions
unspecifiedany exception thrown by the call operator of piranha::math::truncate_degree_impl.

Definition at line 1727 of file math.hpp.

Variable Documentation

◆ names

piranha::math::names
Initial value:
{
return t_degree_impl<T>{}(x, names)

Definition at line 1471 of file math.hpp.

◆ x

piranha::math::x
Initial value:
{
return t_degree_impl<T>{}(x)

Definition at line 1451 of file math.hpp.