piranha  0.10
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
piranha::real_trigonometric_kronecker_monomial< T > Class Template Reference

Real trigonometric Kronecker monomial class. More...

#include <piranha/real_trigonometric_kronecker_monomial.hpp>

Public Types

typedef T value_type
 Alias for T.
 
typedef ka::size_type size_type
 Size type. More...
 
typedef static_vector< value_type, max_sizev_type
 Vector type used for temporary packing/unpacking.
 

Public Member Functions

 real_trigonometric_kronecker_monomial ()
 Default constructor. More...
 
 real_trigonometric_kronecker_monomial (const real_trigonometric_kronecker_monomial &)=default
 Defaulted copy constructor.
 
 real_trigonometric_kronecker_monomial (real_trigonometric_kronecker_monomial &&)=default
 Defaulted move constructor.
 
template<typename U , init_list_enabler< U > = 0>
 real_trigonometric_kronecker_monomial (std::initializer_list< U > list, bool flavour=true)
 Constructor from initalizer list. More...
 
template<typename Iterator , it_ctor_enabler< Iterator > = 0>
 real_trigonometric_kronecker_monomial (const Iterator &start, const Iterator &end, bool flavour=true)
 Constructor from range. More...
 
 real_trigonometric_kronecker_monomial (const symbol_fset &)
 Constructor from set of symbols. More...
 
 real_trigonometric_kronecker_monomial (const value_type &n, bool f)
 Constructor from value_type and flavour. More...
 
 real_trigonometric_kronecker_monomial (const real_trigonometric_kronecker_monomial &other, const symbol_fset &)
 Converting constructor. More...
 
 ~real_trigonometric_kronecker_monomial ()
 Trivial destructor.
 
real_trigonometric_kronecker_monomialoperator= (const real_trigonometric_kronecker_monomial &other)=default
 Copy assignment operator. More...
 
real_trigonometric_kronecker_monomialoperator= (real_trigonometric_kronecker_monomial &&other)=default
 Move assignment operator. More...
 
void set_int (const value_type &n)
 Set the internal integer instance. More...
 
value_type get_int () const
 Get internal instance. More...
 
bool get_flavour () const
 Get flavour. More...
 
void set_flavour (bool f)
 Set flavour. More...
 
bool canonicalise (const symbol_fset &args)
 Canonicalise. More...
 
bool is_compatible (const symbol_fset &args) const noexcept
 Compatibility check. More...
 
bool is_zero (const symbol_fset &) const noexcept
 Zero check. More...
 
real_trigonometric_kronecker_monomial merge_symbols (const symbol_idx_fmap< symbol_fset > &ins_map, const symbol_fset &args) const
 Merge symbols. More...
 
bool is_unitary (const symbol_fset &) const
 Check if monomial is unitary. More...
 
degree_type t_degree (const symbol_fset &args) const
 Trigonometric degree. More...
 
degree_type t_ldegree (const symbol_fset &args) const
 Low trigonometric degree (equivalent to the trigonometric degree). More...
 
degree_type t_degree (const symbol_idx_fset &p, const symbol_fset &args) const
 Partial trigonometric degree. More...
 
degree_type t_ldegree (const symbol_idx_fset &p, const symbol_fset &args) const
 Partial low trigonometric degree (equivalent to the partial trigonometric degree). More...
 
order_type t_order (const symbol_fset &args) const
 Trigonometric order. More...
 
order_type t_lorder (const symbol_fset &args) const
 Low trigonometric order (equivalent to the trigonometric order). More...
 
order_type t_order (const symbol_idx_fset &p, const symbol_fset &args) const
 Partial trigonometric order. More...
 
order_type t_lorder (const symbol_idx_fset &p, const symbol_fset &args) const
 Partial low trigonometric order (equivalent to the partial trigonometric order). More...
 
std::size_t hash () const
 Hash value. More...
 
bool operator== (const real_trigonometric_kronecker_monomial &other) const
 Equality operator. More...
 
bool operator!= (const real_trigonometric_kronecker_monomial &other) const
 Inequality operator. More...
 
v_type unpack (const symbol_fset &args) const
 Unpack internal integer instance. More...
 
void print (std::ostream &os, const symbol_fset &args) const
 Print. More...
 
void print_tex (std::ostream &os, const symbol_fset &args) const
 Print in TeX mode. More...
 
std::pair< T, real_trigonometric_kronecker_monomialpartial (const symbol_idx &p, const symbol_fset &args) const
 Partial derivative. More...
 
std::pair< T, real_trigonometric_kronecker_monomialintegrate (const std::string &s, const symbol_fset &args) const
 Integration. More...
 
template<typename U >
eval_type< U > evaluate (const std::vector< U > &values, const symbol_fset &args) const
 Evaluation. More...
 
template<typename U >
std::vector< std::pair< subs_type< U >, real_trigonometric_kronecker_monomial > > subs (const symbol_idx_fmap< U > &smap, const symbol_fset &args) const
 Substitution. More...
 
template<typename U >
std::vector< std::pair< t_subs_type< U >, real_trigonometric_kronecker_monomial > > t_subs (const symbol_idx &idx, const U &c, const U &s, const symbol_fset &args) const
 Trigonometric substitution. More...
 
void trim_identify (std::vector< char > &trim_mask, const symbol_fset &args) const
 Identify symbols that can be trimmed. More...
 
real_trigonometric_kronecker_monomial trim (const std::vector< char > &trim_mask, const symbol_fset &args) const
 Trim. More...
 
bool operator< (const real_trigonometric_kronecker_monomial &other) const
 Comparison operator. More...
 
template<typename Stream , msgpack_pack_enabler< Stream > = 0>
void msgpack_pack (msgpack::packer< Stream > &packer, msgpack_format f, const symbol_fset &s) const
 Serialize in msgpack format. More...
 
template<typename U = real_trigonometric_kronecker_monomial, msgpack_convert_enabler< U > = 0>
void msgpack_convert (const msgpack::object &o, msgpack_format f, const symbol_fset &s)
 Deserialize from msgpack object. More...
 

Static Public Member Functions

template<typename Cf , multiply_enabler< Cf > = 0>
static void multiply (std::array< term< Cf, real_trigonometric_kronecker_monomial >, multiply_arity > &res, const term< Cf, real_trigonometric_kronecker_monomial > &t1, const term< Cf, real_trigonometric_kronecker_monomial > &t2, const symbol_fset &args)
 Multiply terms with a trigonometric monomial. More...
 

Static Public Attributes

static const std::size_t multiply_arity = 2u
 Arity of the multiply() method.
 
static const size_type max_size = 255u
 Maximum monomial size.
 

Detailed Description

template<typename T = std::make_signed<std::size_t>::type>
class piranha::real_trigonometric_kronecker_monomial< T >

Real trigonometric Kronecker monomial class.

This class represents a multivariate real trigonometric monomial, i.e., functions of the form

\[ \begin{array}{c} \sin \\ \cos \end{array} \left(n_0x_0 + n_1x_1 + \ldots + n_mx_m\right), \]

where the integers \( n_i \) are called multipliers. The values of the multipliers are packed in a signed integer using Kronecker substitution, using the facilities provided by piranha::kronecker_array. The boolean flavour of the monomial indicates whether it represents a cosine (true) or sine (false).

Similarly to an ordinary monomial, this class provides methods to query the trigonometric (partial) (low) degree, defined as if the multipliers were exponents of a regular monomial (e.g., the total trigonometric degree is the sum of the multipliers). Closely related is the concept of trigonometric order, calculated by adding the absolute values of the multipliers.

This class satisfies the piranha::is_key, piranha::key_has_t_degree, piranha::key_has_t_ldegree, piranha::key_has_t_order, piranha::key_has_t_lorder and piranha::key_is_differentiable type traits.

Type requirements

T must be suitable for use in piranha::kronecker_array. The default type for T is the signed counterpart of std::size_t.

Exception safety guarantee

Unless otherwise specified, this class provides the strong exception safety guarantee for all operations.

Move semantics

The move semantics of this class are equivalent to the move semantics of C++ signed integral types.

Definition at line 119 of file real_trigonometric_kronecker_monomial.hpp.

Member Typedef Documentation

◆ size_type

template<typename T = std::make_signed<std::size_t>::type>
typedef ka::size_type piranha::real_trigonometric_kronecker_monomial< T >::size_type

Size type.

Used to represent the number of variables in the monomial. Equivalent to the size type of piranha::kronecker_array.

Definition at line 136 of file real_trigonometric_kronecker_monomial.hpp.

Constructor & Destructor Documentation

◆ real_trigonometric_kronecker_monomial() [1/6]

template<typename T = std::make_signed<std::size_t>::type>
piranha::real_trigonometric_kronecker_monomial< T >::real_trigonometric_kronecker_monomial ( )
inline

Default constructor.

After construction all multipliers in the monomial will be zero, and the flavour will be set to true.

Definition at line 150 of file real_trigonometric_kronecker_monomial.hpp.

◆ real_trigonometric_kronecker_monomial() [2/6]

template<typename T = std::make_signed<std::size_t>::type>
template<typename U , init_list_enabler< U > = 0>
piranha::real_trigonometric_kronecker_monomial< T >::real_trigonometric_kronecker_monomial ( std::initializer_list< U >  list,
bool  flavour = true 
)
inlineexplicit

Constructor from initalizer list.

Note
This constructor is enabled if U is safely convertible to T.

The values in the initializer list are intended to represent the multipliers of the monomial: they will be safely converted to type T (if T and U are not the same type), encoded using piranha::kronecker_array::encode() and the result assigned to the internal integer instance. The flavour will be set to flavour.

Parameters
listan initializer list representing the multipliers.
flavourthe flavour that will be assigned to the monomial.
Exceptions
unspecifiedany exception thrown by:

Definition at line 181 of file real_trigonometric_kronecker_monomial.hpp.

◆ real_trigonometric_kronecker_monomial() [3/6]

template<typename T = std::make_signed<std::size_t>::type>
template<typename Iterator , it_ctor_enabler< Iterator > = 0>
piranha::real_trigonometric_kronecker_monomial< T >::real_trigonometric_kronecker_monomial ( const Iterator &  start,
const Iterator &  end,
bool  flavour = true 
)
inlineexplicit

Constructor from range.

Note
This constructor is enabled if Iterator is an input iterator whose value_type is safely convertible to T.

Will build internally a vector of values from the input iterators, encode it and assign the result to the internal integer instance. The value type of the iterator is converted to T using piranha::safe_cast(). The flavour will be set to flavour.

Parameters
startbeginning of the range.
endend of the range.
flavourthe flavour that will be assigned to the monomial.
Exceptions
unspecifiedany exception thrown by:

Definition at line 215 of file real_trigonometric_kronecker_monomial.hpp.

◆ real_trigonometric_kronecker_monomial() [4/6]

template<typename T = std::make_signed<std::size_t>::type>
piranha::real_trigonometric_kronecker_monomial< T >::real_trigonometric_kronecker_monomial ( const symbol_fset )
inlineexplicit

Constructor from set of symbols.

After construction all multipliers will be zero and the flavour will be set to true.

Definition at line 228 of file real_trigonometric_kronecker_monomial.hpp.

◆ real_trigonometric_kronecker_monomial() [5/6]

template<typename T = std::make_signed<std::size_t>::type>
piranha::real_trigonometric_kronecker_monomial< T >::real_trigonometric_kronecker_monomial ( const value_type n,
bool  f 
)
inlineexplicit

Constructor from value_type and flavour.

This constructor will initialise the internal integer instance to n and the flavour to f.

Parameters
ninitializer for the internal integer instance.
fdesired flavour.

Definition at line 237 of file real_trigonometric_kronecker_monomial.hpp.

◆ real_trigonometric_kronecker_monomial() [6/6]

template<typename T = std::make_signed<std::size_t>::type>
piranha::real_trigonometric_kronecker_monomial< T >::real_trigonometric_kronecker_monomial ( const real_trigonometric_kronecker_monomial< T > &  other,
const symbol_fset  
)
inlineexplicit

Converting constructor.

This constructor is for use when converting from one term type to another in piranha::series. It will set the internal integer instance and flavour to the same value of other.

Parameters
otherthe construction argument.

Definition at line 245 of file real_trigonometric_kronecker_monomial.hpp.

Member Function Documentation

◆ canonicalise()

template<typename T = std::make_signed<std::size_t>::type>
bool piranha::real_trigonometric_kronecker_monomial< T >::canonicalise ( const symbol_fset args)
inline

Canonicalise.

A monomial is considered to be in canonical form when the first nonzero multiplier is positive. If this is not in canonical form, the method will canonicalise this by switching the signs of all multipliers and return true. Otherwise, this will not be modified and false will be returned.

Parameters
argsthe reference piranha::symbol_fset.
Returns
true if the monomial was canonicalised, false otherwise.
Exceptions
unspecifiedany exception thrown by:

Definition at line 340 of file real_trigonometric_kronecker_monomial.hpp.

◆ evaluate()

template<typename T = std::make_signed<std::size_t>::type>
template<typename U >
eval_type<U> piranha::real_trigonometric_kronecker_monomial< T >::evaluate ( const std::vector< U > &  values,
const symbol_fset args 
) const
inline

Evaluation.

Note
This template method is activated only if U supports the mathematical operations needed to compute the return type.

The return value will be built by applying piranha::math::cos() or piranha::math:sin() to the linear combination of the values in values with the multipliers.

Parameters
valuesthe values will be used for the evaluation.
argsthe reference piranha::symbol_fset.
Returns
the result of evaluating this with the values provided in values.
Exceptions
std::invalid_argumentif the sizes of values and args differ.
unspecifiedany exception thrown by unpack() or by the computation of the return type.

Definition at line 966 of file real_trigonometric_kronecker_monomial.hpp.

◆ get_flavour()

template<typename T = std::make_signed<std::size_t>::type>
bool piranha::real_trigonometric_kronecker_monomial< T >::get_flavour ( ) const
inline

Get flavour.

Returns
flavour of the monomial.

Definition at line 294 of file real_trigonometric_kronecker_monomial.hpp.

◆ get_int()

template<typename T = std::make_signed<std::size_t>::type>
value_type piranha::real_trigonometric_kronecker_monomial< T >::get_int ( ) const
inline

Get internal instance.

Returns
value of the internal integer instance.

Definition at line 286 of file real_trigonometric_kronecker_monomial.hpp.

◆ hash()

template<typename T = std::make_signed<std::size_t>::type>
std::size_t piranha::real_trigonometric_kronecker_monomial< T >::hash ( ) const
inline

Hash value.

Returns
the internal integer instance, cast to std::size_t.

Definition at line 720 of file real_trigonometric_kronecker_monomial.hpp.

◆ integrate()

template<typename T = std::make_signed<std::size_t>::type>
std::pair<T, real_trigonometric_kronecker_monomial> piranha::real_trigonometric_kronecker_monomial< T >::integrate ( const std::string &  s,
const symbol_fset args 
) const
inline

Integration.

This method will return the antiderivative of this with respect to the symbol s. The result is a pair consisting of the multiplier associated to s and a copy of the monomial. The sign of the multiplier and the flavour of the resulting monomial are set according to the standard integration formulas for elementary trigonometric functions. If s is not in args or if the multiplier associated to it is zero, the returned pair will be (0,real_trigonometric_kronecker_monomial{args}).

Parameters
sthe symbol with respect to which the integration will be calculated.
argsthe reference piranha::symbol_fset.
Returns
the result of the integration.
Exceptions
unspecifiedany exception thrown by unpack().

Definition at line 900 of file real_trigonometric_kronecker_monomial.hpp.

◆ is_compatible()

template<typename T = std::make_signed<std::size_t>::type>
bool piranha::real_trigonometric_kronecker_monomial< T >::is_compatible ( const symbol_fset args) const
inlinenoexcept

Compatibility check.

A monomial is considered incompatible if any of these conditions holds:

Otherwise, the monomial is considered to be compatible for insertion.

Parameters
argsthe reference piranha::symbol_fset.
Returns
compatibility flag for the monomial.

Definition at line 365 of file real_trigonometric_kronecker_monomial.hpp.

◆ is_unitary()

template<typename T = std::make_signed<std::size_t>::type>
bool piranha::real_trigonometric_kronecker_monomial< T >::is_unitary ( const symbol_fset ) const
inline

Check if monomial is unitary.

Returns
true if all the multipliers are zero and the flavour is true, false otherwise.

Definition at line 444 of file real_trigonometric_kronecker_monomial.hpp.

◆ is_zero()

template<typename T = std::make_signed<std::size_t>::type>
bool piranha::real_trigonometric_kronecker_monomial< T >::is_zero ( const symbol_fset ) const
inlinenoexcept

Zero check.

A trigonometric monomial is zero if all multipliers are zero and the flavour is false.

Returns
ignorability flag.

Definition at line 403 of file real_trigonometric_kronecker_monomial.hpp.

◆ merge_symbols()

template<typename T = std::make_signed<std::size_t>::type>
real_trigonometric_kronecker_monomial piranha::real_trigonometric_kronecker_monomial< T >::merge_symbols ( const symbol_idx_fmap< symbol_fset > &  ins_map,
const symbol_fset args 
) const
inline

Merge symbols.

This method will return a copy of this in which the value 0 has been inserted at the positions specified by ins_map. Specifically, before each index appearing in ins_map a number of zeroes equal to the size of the mapped piranha::symbol_fset will be inserted.

For instance, given a piranha::real_trigonometric_kronecker_monomial containing the values [1,2,3,4], a symbol set args containing ["c","e","g","h"] and an insertion map ins_map containing the pairs [(0,["a","b"]),(1,["d"]),(2,["f"]),(4,["i"])], the output of this method will be [0,0,1,0,2,0,3,4,0]. That is, the symbols appearing in ins_map are merged into this with a value of zero at the specified positions. The original flavour of this will be preserved in the return value.

Parameters
ins_mapthe insertion map.
argsthe reference symbol set for this.
Returns
a piranha::real_trigonometric_kronecker_monomial resulting from inserting into this zeroes at the positions specified by ins_map.
Exceptions
std::invalid_argumentin the following cases:
  • the size of ins_map is zero,
  • the last index in ins_map is greater than the size of args.
unspecifiedany exception thrown by:

Definition at line 434 of file real_trigonometric_kronecker_monomial.hpp.

◆ msgpack_convert()

template<typename T = std::make_signed<std::size_t>::type>
template<typename U = real_trigonometric_kronecker_monomial, msgpack_convert_enabler< U > = 0>
void piranha::real_trigonometric_kronecker_monomial< T >::msgpack_convert ( const msgpack::object &  o,
msgpack_format  f,
const symbol_fset s 
)
inline

Deserialize from msgpack object.

Note
This method is activated only if the T, bool and piranha::real_trigonometric_kronecker_monomial::v_type satisfy piranha::has_msgpack_convert.

This method will deserialize o into this. In binary mode, no check is performed on the content of o, and calling this method will result in undefined behaviour if o does not contain a monomial serialized via msgpack_pack(). This method provides the basic exception safety guarantee.

Parameters
omsgpack object that will be deserialized.
fserialization format.
sthe reference piranha::symbol_fset.
Exceptions
std::invalid_argumentif the size of the deserialized array differs from the size of s.
unspecifiedany exception thrown by:

Definition at line 1372 of file real_trigonometric_kronecker_monomial.hpp.

◆ msgpack_pack()

template<typename T = std::make_signed<std::size_t>::type>
template<typename Stream , msgpack_pack_enabler< Stream > = 0>
void piranha::real_trigonometric_kronecker_monomial< T >::msgpack_pack ( msgpack::packer< Stream > &  packer,
msgpack_format  f,
const symbol_fset s 
) const
inline

Serialize in msgpack format.

Note
This method is activated only if Stream satisfies piranha::is_msgpack_stream and T, bool and piranha::real_trigonometric_kronecker_monomial::v_type satisfy piranha::has_msgpack_pack.

This method will pack this into packer.

Parameters
packerthe target packer.
fthe serialization format.
sthe reference piranha::symbol_fset.
Exceptions
unspecifiedany exception thrown by:

Definition at line 1339 of file real_trigonometric_kronecker_monomial.hpp.

◆ multiply()

template<typename T = std::make_signed<std::size_t>::type>
template<typename Cf , multiply_enabler< Cf > = 0>
static void piranha::real_trigonometric_kronecker_monomial< T >::multiply ( std::array< term< Cf, real_trigonometric_kronecker_monomial< T > >, multiply_arity > &  res,
const term< Cf, real_trigonometric_kronecker_monomial< T > > &  t1,
const term< Cf, real_trigonometric_kronecker_monomial< T > > &  t2,
const symbol_fset args 
)
inlinestatic

Multiply terms with a trigonometric monomial.

Note
This method is enabled only if the following conditions hold:

This method will compute the result of the multiplication of the two terms t1 and t2 with trigonometric key. The result is stored in the two terms of res and it is computed using basic trigonometric formulae. Note however that this method will not perform the division by two implied by Werner's formulae. Also, in case Cf is an instance of piranha::mp_rational, only the numerators of the coefficients will be multiplied.

Parameters
resresult of the multiplication.
t1first argument.
t2second argument.
argsthe reference piranha::symbol_fset.
Exceptions
std::overflow_errorif the computation of the result overflows type value_type.
unspecifiedany exception thrown by:

Definition at line 661 of file real_trigonometric_kronecker_monomial.hpp.

◆ operator!=()

template<typename T = std::make_signed<std::size_t>::type>
bool piranha::real_trigonometric_kronecker_monomial< T >::operator!= ( const real_trigonometric_kronecker_monomial< T > &  other) const
inline

Inequality operator.

Parameters
otherthe comparison argument.
Returns
the opposite of operator==().

Definition at line 741 of file real_trigonometric_kronecker_monomial.hpp.

◆ operator<()

template<typename T = std::make_signed<std::size_t>::type>
bool piranha::real_trigonometric_kronecker_monomial< T >::operator< ( const real_trigonometric_kronecker_monomial< T > &  other) const
inline

Comparison operator.

The values of the internal integral instances are used for comparison. If the values are the same, the flavours of the monomials are compared to break the tie.

Parameters
othercomparison argument.
Returns
true if this is less than other, false otherwise.

Definition at line 1300 of file real_trigonometric_kronecker_monomial.hpp.

◆ operator=() [1/2]

template<typename T = std::make_signed<std::size_t>::type>
real_trigonometric_kronecker_monomial& piranha::real_trigonometric_kronecker_monomial< T >::operator= ( const real_trigonometric_kronecker_monomial< T > &  other)
default

Copy assignment operator.

Parameters
otherthe assignment argument.
Returns
a reference to this.

◆ operator=() [2/2]

template<typename T = std::make_signed<std::size_t>::type>
real_trigonometric_kronecker_monomial& piranha::real_trigonometric_kronecker_monomial< T >::operator= ( real_trigonometric_kronecker_monomial< T > &&  other)
default

Move assignment operator.

Parameters
otherthe assignment argument.
Returns
a reference to this.

◆ operator==()

template<typename T = std::make_signed<std::size_t>::type>
bool piranha::real_trigonometric_kronecker_monomial< T >::operator== ( const real_trigonometric_kronecker_monomial< T > &  other) const
inline

Equality operator.

Parameters
otherthe comparison argument.
Returns
true if the internal integral instance and the flavour of this are the same of other, false otherwise.

Definition at line 731 of file real_trigonometric_kronecker_monomial.hpp.

◆ partial()

template<typename T = std::make_signed<std::size_t>::type>
std::pair<T, real_trigonometric_kronecker_monomial> piranha::real_trigonometric_kronecker_monomial< T >::partial ( const symbol_idx p,
const symbol_fset args 
) const
inline

Partial derivative.

This method will return the partial derivative of this with respect to the symbol at the position indicated by p. The result is a pair consisting of the multiplier at the position p and a copy of the monomial. The sign of the multiplier and the flavour of the resulting monomial are set according to the standard differentiation formulas for elementary trigonometric functions. If p is not smaller than the size of args or if its corresponding multiplier is zero, the returned pair will be (0,real_trigonometric_kronecker_monomial{args}).

Parameters
pthe position of the symbol with respect to which the differentiation will be calculated.
argsthe reference piranha::symbol_fset.
Returns
the result of the differentiation.
Exceptions
unspecifiedany exception thrown by unpack().

Definition at line 868 of file real_trigonometric_kronecker_monomial.hpp.

◆ print()

template<typename T = std::make_signed<std::size_t>::type>
void piranha::real_trigonometric_kronecker_monomial< T >::print ( std::ostream &  os,
const symbol_fset args 
) const
inline

Print.

Thie method will print to stream a human-readable representation of the monomial.

Parameters
ostarget stream.
argsthe reference piranha::symbol_fset.
Exceptions
unspecifiedany exception thrown by unpack() or by streaming instances of value_type.

Definition at line 771 of file real_trigonometric_kronecker_monomial.hpp.

◆ print_tex()

template<typename T = std::make_signed<std::size_t>::type>
void piranha::real_trigonometric_kronecker_monomial< T >::print_tex ( std::ostream &  os,
const symbol_fset args 
) const
inline

Print in TeX mode.

This method will print to stream a TeX representation of the monomial.

Parameters
ostarget stream.
argsthe reference piranha::symbol_fset.
Exceptions
unspecifiedany exception thrown by unpack() or by streaming instances of value_type.

Definition at line 816 of file real_trigonometric_kronecker_monomial.hpp.

◆ set_flavour()

template<typename T = std::make_signed<std::size_t>::type>
void piranha::real_trigonometric_kronecker_monomial< T >::set_flavour ( bool  f)
inline

Set flavour.

Parameters
fvalue to which the flavour will be set.

Definition at line 302 of file real_trigonometric_kronecker_monomial.hpp.

◆ set_int()

template<typename T = std::make_signed<std::size_t>::type>
void piranha::real_trigonometric_kronecker_monomial< T >::set_int ( const value_type n)
inline

Set the internal integer instance.

Parameters
nvalue to which the internal integer instance will be set.

Definition at line 278 of file real_trigonometric_kronecker_monomial.hpp.

◆ subs()

template<typename T = std::make_signed<std::size_t>::type>
template<typename U >
std::vector<std::pair<subs_type<U>, real_trigonometric_kronecker_monomial> > piranha::real_trigonometric_kronecker_monomial< T >::subs ( const symbol_idx_fmap< U > &  smap,
const symbol_fset args 
) const
inline

Substitution.

Note
This template method is activated only if U supports the mathematical operations needed to compute the return type.

This method will substitute the symbols at the positions specified in the keys of smap with the mapped values. The return value is a vector of two pairs computed according to the standard angle sum identities. That is, given a monomial of the form

\[ \begin{array}{c} \sin \\ \cos \end{array} \left(na + mb + c\right) \]

in which the symbols \( a \) and \( b \) are to be substituted with \( x \) and \( y \), the result of the substitution will be one of

\[ \left\{\left[\sin \left(nx+my\right),\cos c \right],\left[\cos \left(nx+my\right),\sin c \right]\right\} \]

or

\[ \left\{\left[\cos \left(nx+my\right),\cos c \right],\left[-\sin \left(nx+my\right),\sin c \right]\right\} \]

where \( \cos c \) and \( \sin c \) are returned as monomials, and \( \cos \left(nx+my\right) \) and \( \sin \left(nx+my\right) \) are computed via piranha::math::cos() and piranha::math::sin(). If s is not in args, \( \cos \left(nx+my\right) \) will be initialised to 1 and \( \sin \left(nx+my\right) \) to 0. If, after the substitution, the first nonzero multiplier in \( c \) is negative, \( c \) will be negated and the other signs changed accordingly.

Parameters
smapthe map relating the positions of the symbols to be substituted to the values they will be substituted with.
argsthe reference piranha::symbol_fset.
Returns
the result of the substitution.
Exceptions
std::invalid_argumentif the last element of the substitution map is not smaller than the size of args.
unspecifiedany exception thrown by unpack(), the computation of the return value or memory errors in standard containers.

Definition at line 1050 of file real_trigonometric_kronecker_monomial.hpp.

◆ t_degree() [1/2]

template<typename T = std::make_signed<std::size_t>::type>
degree_type piranha::real_trigonometric_kronecker_monomial< T >::t_degree ( const symbol_fset args) const
inline

Trigonometric degree.

The type returned by this method is the type resulting from the addition of two instances of T.

Parameters
argsthe reference symbol set for this.
Returns
the trigonometric degree of the monomial.
Exceptions
std::overflow_errorif the computation of the degree overflows.
unspecifiedany exception thrown by unpack().

Definition at line 466 of file real_trigonometric_kronecker_monomial.hpp.

◆ t_degree() [2/2]

template<typename T = std::make_signed<std::size_t>::type>
degree_type piranha::real_trigonometric_kronecker_monomial< T >::t_degree ( const symbol_idx_fset p,
const symbol_fset args 
) const
inline

Partial trigonometric degree.

Partial trigonometric degree of the monomial: only the symbols at the positions specified by p are considered. The type returned by this method is the type resulting from the addition of two instances of T.

Parameters
pthe positions of the symbols to be considered in the calculation of the degree.
argsthe reference piranha::symbol_fset.
Returns
the summation of the multipliers of the monomial at the positions specified by p.
Exceptions
std::invalid_argumentif the last element of p, if existing, is not less than the size of args.
std::overflow_errorif the computation of the degree overflows.
unspecifiedany exception thrown by unpack().

Definition at line 505 of file real_trigonometric_kronecker_monomial.hpp.

◆ t_ldegree() [1/2]

template<typename T = std::make_signed<std::size_t>::type>
degree_type piranha::real_trigonometric_kronecker_monomial< T >::t_ldegree ( const symbol_fset args) const
inline

Low trigonometric degree (equivalent to the trigonometric degree).

Parameters
argsthe reference symbol set for this.
Returns
the output of t_degree(const symbol_fset &) const.
Exceptions
unspecifiedany exception thrown by t_degree(const symbol_fset &) const.

Definition at line 485 of file real_trigonometric_kronecker_monomial.hpp.

◆ t_ldegree() [2/2]

template<typename T = std::make_signed<std::size_t>::type>
degree_type piranha::real_trigonometric_kronecker_monomial< T >::t_ldegree ( const symbol_idx_fset p,
const symbol_fset args 
) const
inline

Partial low trigonometric degree (equivalent to the partial trigonometric degree).

Parameters
pthe positions of the symbols to be considered in the calculation of the degree.
argsthe reference piranha::symbol_fset.
Returns
the output of t_degree(const symbol_idx_fset &, const symbol_fset &) const.
Exceptions
unspecifiedany exception thrown by t_degree(const symbol_idx_fset &, const symbol_fset &) const.

Definition at line 531 of file real_trigonometric_kronecker_monomial.hpp.

◆ t_lorder() [1/2]

template<typename T = std::make_signed<std::size_t>::type>
order_type piranha::real_trigonometric_kronecker_monomial< T >::t_lorder ( const symbol_fset args) const
inline

Low trigonometric order (equivalent to the trigonometric order).

Parameters
argsthe reference piranha::symbol_fset.
Returns
the output of t_order(const symbol_fset &) const.
Exceptions
unspecifiedany exception thrown by t_order(const symbol_fset &) const.

Definition at line 573 of file real_trigonometric_kronecker_monomial.hpp.

◆ t_lorder() [2/2]

template<typename T = std::make_signed<std::size_t>::type>
order_type piranha::real_trigonometric_kronecker_monomial< T >::t_lorder ( const symbol_idx_fset p,
const symbol_fset args 
) const
inline

Partial low trigonometric order (equivalent to the partial trigonometric order).

Parameters
ppositions of the symbols to be considered.
argsthe reference piranha::symbol_fset.
Returns
the output of t_order(const symbol_idx_fset &, const symbol_fset &) const.
Exceptions
unspecifiedany exception thrown by t_order(const symbol_idx_fset &, const symbol_fset &) const.

Definition at line 620 of file real_trigonometric_kronecker_monomial.hpp.

◆ t_order() [1/2]

template<typename T = std::make_signed<std::size_t>::type>
order_type piranha::real_trigonometric_kronecker_monomial< T >::t_order ( const symbol_fset args) const
inline

Trigonometric order.

The type returned by this method is the type resulting from the addition of the absolute values of two instances of T.

Parameters
argsthe reference piranha::symbol_fset.
Returns
the trigonometric order of the monomial.
Exceptions
std::overflow_errorif the computation of the order overflows.
unspecifiedany exception thrown by unpack().

Definition at line 553 of file real_trigonometric_kronecker_monomial.hpp.

◆ t_order() [2/2]

template<typename T = std::make_signed<std::size_t>::type>
order_type piranha::real_trigonometric_kronecker_monomial< T >::t_order ( const symbol_idx_fset p,
const symbol_fset args 
) const
inline

Partial trigonometric order.

Partial trigonometric order of the monomial: only the symbols at the positions specified by p are considered. The type returned by this method is the type resulting from the addition of the absolute values of two instances of T.

Parameters
pthe positions of the symbols to be considered in the calculation of the order.
argsthe reference piranha::symbol_fset.
Returns
the partial trigonometric order of the monomial.
Exceptions
std::invalid_argumentif the last element of p, if existing, is not less than the size of args.
std::overflow_errorif the computation of the degree overflows.
unspecifiedany exception thrown by unpack().

Definition at line 593 of file real_trigonometric_kronecker_monomial.hpp.

◆ t_subs()

template<typename T = std::make_signed<std::size_t>::type>
template<typename U >
std::vector<std::pair<t_subs_type<U>, real_trigonometric_kronecker_monomial> > piranha::real_trigonometric_kronecker_monomial< T >::t_subs ( const symbol_idx idx,
const U &  c,
const U &  s,
const symbol_fset args 
) const
inline

Trigonometric substitution.

Note
This method is enabled only if U supports the operations needed to compute the result.

This method will substitute the cosine and sine of the symbol at the position idx with, respectively, c and s. The substitution is performed using standard trigonometric formulae, and it will result in a list of two (substitution result, new monomial) pairs. If idx is not smaller than the size of this, the result of the substitution will be the original monomial unchanged.

Parameters
idxthe index of the symbol whose cosine and sine will be substituted.
cthe quantity that will replace the cosine of the symbol at the position idx.
sthe quantity that will replace the sine of the symbol at the position idx.
argsthe reference piranha::symbol_fset.
Returns
the result of the substitution.
Exceptions
unspecifiedany exception thrown by:

Definition at line 1175 of file real_trigonometric_kronecker_monomial.hpp.

◆ trim()

template<typename T = std::make_signed<std::size_t>::type>
real_trigonometric_kronecker_monomial piranha::real_trigonometric_kronecker_monomial< T >::trim ( const std::vector< char > &  trim_mask,
const symbol_fset args 
) const
inline

Trim.

This method is used in piranha::series::trim(). The input mask trim_mask is a vector of boolean flags signalling (with nonzero values) elements of this to be removed. The method will return a copy of this in which the specified elements have been removed.

For instance, if this contains the values [0,5,3,0,4] and trim_mask contains the values [false,false,false,true,false], then the output of this method will be the array of values [0,5,3,4] (that is, the fourth element has been removed as indicated by a true value in trim_mask's fourth element).

Parameters
trim_maska mask indicating which element will be removed.
argsthe reference piranha::symbol_fset.
Returns
a trimmed copy of this.
Exceptions
std::invalid_argumentif the size of trim_mask differs from the size of args.
unspecifiedany exception thrown by unpack() or piranha::static_vector::push_back().

Definition at line 1287 of file real_trigonometric_kronecker_monomial.hpp.

◆ trim_identify()

template<typename T = std::make_signed<std::size_t>::type>
void piranha::real_trigonometric_kronecker_monomial< T >::trim_identify ( std::vector< char > &  trim_mask,
const symbol_fset args 
) const
inline

Identify symbols that can be trimmed.

This method is used in piranha::series::trim(). The input parameter trim_mask is a vector of boolean flags (i.e., a mask) which signals which elements in args are candidates for trimming (i.e., a zero value means that the symbol at the corresponding position in args is not a candidate for trimming, while a nonzero value means that the symbol is a candidate for trimming). This method will set to zero those values in trim_mask for which the corresponding element in this is nonzero.

For instance, if this contains the values [0,5,3,0,4] and trim_mask originally contains the values [1,1,0,1,0], after a call to this method trim_mask will contain [1,0,0,1,0] (that is, the second element was set from 1 to 0 as the corresponding element in this has a value of 5 and thus must not be trimmed).

Parameters
trim_maska mask signalling candidate elements for trimming.
argsthe reference piranha::symbol_fset.
Exceptions
std::invalid_argumentif the size of trim_mask differs from the size of args.
unspecifiedany exception thrown by unpack().

Definition at line 1263 of file real_trigonometric_kronecker_monomial.hpp.

◆ unpack()

template<typename T = std::make_signed<std::size_t>::type>
v_type piranha::real_trigonometric_kronecker_monomial< T >::unpack ( const symbol_fset args) const
inline

Unpack internal integer instance.

This method will decode the internal integral instance into a piranha::static_vector of size equal to the size of args.

Parameters
argsthe reference piranha::symbol_fset.
Returns
a piranha::static_vector containing the result of decoding the internal integral instance via piranha::kronecker_array.
Exceptions
std::invalid_argumentif the size of args is larger than the maximum size of piranha::static_vector.
unspecifiedany exception thrown by piranha::kronecker_array::decode().

Definition at line 758 of file real_trigonometric_kronecker_monomial.hpp.


The documentation for this class was generated from the following file: