piranha  0.10
piranha::power_series< Series, Derived > Class Template Reference

Power series toolbox. More...

#include <piranha/power_series.hpp>

Inherits Series, and power_series_tag.

## Public Member Functions

power_series ()=default
Defaulted default constructor.

power_series (const power_series &)=default
Defaulted copy constructor.

power_series (power_series &&)=default
Defaulted move constructor.

power_seriesoperator= (const power_series &other)=default
Copy assignment operator. More...

power_seriesoperator= (power_series &&other)=default
Move assignment operator. More...

~power_series ()
Trivial destructor.

template<typename T = power_series>
degree_type< T > degree () const
Total degree. More...

template<typename T = power_series>
ldegree_type< T > ldegree () const
Total low degree. More...

template<typename T = power_series>
pdegree_type< T > degree (const symbol_fset &names) const
Partial degree. More...

template<typename T = power_series>
pldegree_type< T > ldegree (const symbol_fset &names) const
Partial low degree. More...

template<typename T , truncate_degree_enabler< T > = 0>
Derived truncate_degree (const T &max_degree) const
Total degree truncation. More...

template<typename T , truncate_pdegree_enabler< T > = 0>
Derived truncate_degree (const T &max_degree, const symbol_fset &names) const
Partial degree truncation. More...

## Detailed Description

### template<typename Series, typename Derived> class piranha::power_series< Series, Derived >

Power series toolbox.

This toolbox is intended to extend the Series type with properties of formal power series.

Specifically, the toolbox will conditionally augment a Series type by adding methods to query the total and partial (low) degree * of a Series object. Such augmentation takes place if the series' coefficient and/or key types expose methods to query their degree properties (as established by the piranha::has_degree, piranha::key_has_degree and similar type traits), and if the necessary arithmetic operations are supported by the involved types. As an additional requirement, the types returned when querying the degree must be constructible from int, less-than comparable and they must satisfy piranha::is_container_element. If the computation of the degree of a single term involves only C++ integral types, then the computation will be checked for overflow.

This toolbox provides also support for truncation based on the total or partial degree. In addition to the requirements of the degree-querying methods, the truncation methods also require the supplied degree limit to be comparable to the type returned by the degree-querying methods. The truncation methods will recursively truncate the coefficients of the series via the piranha::math::truncate_degree() function.

If the requirements outlined above are not satisfied, the degree-querying and the truncation methods will be disabled.

This class satisfies the piranha::is_series type trait.

## Type requirements

• Series must satisfy the piranha::is_series type trait,
• Derived must derive from power_series of Series and Derived.

## Exception safety guarantee

This class provides the same guarantee as Series. The auto-truncation methods offer the basic exception safety guarantee.

## Move semantics

Move semantics is equivalent to the move semantics of Series.

Definition at line 314 of file power_series.hpp.

## ◆ degree() [1/2]

template<typename Series, typename Derived>
template<typename T = power_series>
 degree_type piranha::power_series< Series, Derived >::degree ( ) const
inline

Total degree.

Note
This method is available only if the requisites outlined in piranha::power_series are satisfied.

The degree of the series is the maximum degree of its terms. If the series is empty, zero will be returned.

Returns
the total degree of the series.
Exceptions
 std::overflow_error if the computation results in an overflow. unspecified any exception thrown by: the construction of return type, the calculation of the degree of each term, the assignment and less-than operators for the return type.

Definition at line 390 of file power_series.hpp.

## ◆ degree() [2/2]

template<typename Series, typename Derived>
template<typename T = power_series>
 pdegree_type piranha::power_series< Series, Derived >::degree ( const symbol_fset & names ) const
inline

Partial degree.

Note
This method is available only if the requisites outlined in piranha::power_series are satisfied.

The partial degree of the series is the maximum partial degree of its terms. If the series is empty, zero will be returned.

Parameters
 names names of the variables to be considered in the computation of the degree.
Returns
the partial degree of the series.
Exceptions
 std::overflow_error if the computation results in an overflow. unspecified any exception thrown by: the construction of return type, the calculation of the degree of each term, the assignment and less-than operators for the return type.

Definition at line 444 of file power_series.hpp.

## ◆ ldegree() [1/2]

template<typename Series, typename Derived>
template<typename T = power_series>
 ldegree_type piranha::power_series< Series, Derived >::ldegree ( ) const
inline

Total low degree.

Note
This method is available only if the requisites outlined in piranha::power_series are satisfied.

The low degree of the series is the minimum low degree of its terms. If the series is empty, zero will be returned.

Returns
the total low degree of the series.
Exceptions
 std::overflow_error if the computation results in an overflow. unspecified any exception thrown by: the construction of return type, the calculation of the low degree of each term, the assignment and less-than operators for the return type.

Definition at line 416 of file power_series.hpp.

## ◆ ldegree() [2/2]

template<typename Series, typename Derived>
template<typename T = power_series>
 pldegree_type piranha::power_series< Series, Derived >::ldegree ( const symbol_fset & names ) const
inline

Partial low degree.

Note
This method is available only if the requisites outlined in piranha::power_series are satisfied.

The partial low degree of the series is the minimum partial low degree of its terms. If the series is empty, zero will be returned.

Parameters
 names names of the variables to be considered in the computation of the low degree.
Returns
the partial low degree of the series.
Exceptions
 std::overflow_error if the computation results in an overflow. unspecified any exception thrown by: the construction of return type, the calculation of the low degree of each term, the assignment and less-than operators for the return type.

Definition at line 475 of file power_series.hpp.

## ◆ operator=() [1/2]

template<typename Series, typename Derived>
 power_series& piranha::power_series< Series, Derived >::operator= ( const power_series< Series, Derived > & other )
default

Copy assignment operator.

Parameters
 other the assignment argument.
Returns
a reference to this.
Exceptions
 unspecified any exception thrown by the assignment operator of the base class.

## ◆ operator=() [2/2]

template<typename Series, typename Derived>
 power_series& piranha::power_series< Series, Derived >::operator= ( power_series< Series, Derived > && other )
default

Move assignment operator.

Parameters
 other the assignment argument.
Returns
a reference to this.

## ◆ truncate_degree() [1/2]

template<typename Series, typename Derived>
template<typename T , truncate_degree_enabler< T > = 0>
 Derived piranha::power_series< Series, Derived >::truncate_degree ( const T & max_degree ) const
inline

Total degree truncation.

Note
This method is available only if the requisites outlined in piranha::power_series are satisfied.

This method can be used to eliminate the parts of a series whose degree is greater than max_degree. This includes the elimination of whole terms, but also the recursive truncation of coefficients via the piranha::math::truncate_degree() function, if supported by the coefficient. It must be noted that, in general, this method is not guaranteed to eliminate all the parts whose degree is greater than max_degree (in particular, in the current implementation there is no truncation implemented for keys - a key is kept as-is or completely eliminated).

Parameters
 max_degree maximum allowed total degree.
Returns
the truncated counterpart of this.
Exceptions
 unspecified any exception thrown by: piranha::math::truncate_degree(), if used, the constructor of the term type, the computation and comparison of degree types, piranha::series::insert().

Definition at line 510 of file power_series.hpp.

## ◆ truncate_degree() [2/2]

template<typename Series, typename Derived>
template<typename T , truncate_pdegree_enabler< T > = 0>
 Derived piranha::power_series< Series, Derived >::truncate_degree ( const T & max_degree, const symbol_fset & names ) const
inline

Partial degree truncation.

Note
This method is available only if the requisites outlined in piranha::power_series are satisfied.

This method is equivalent to the other overload, the only difference being that the partial degree is considered in the computation.

Parameters
 max_degree maximum allowed partial degree. names names of the variables to be considered in the computation of the partial degree.
Returns
the truncated counterpart of this.
Exceptions
 unspecified any exception thrown by: piranha::math::truncate_degree(), if used, the constructor of the term type, the computation and comparison of degree types, piranha::series::insert().

Definition at line 543 of file power_series.hpp.

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