piranha  0.10
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Attributes | Friends | List of all members
piranha::series< Cf, Key, Derived > Class Template Reference

Series class. More...

#include <piranha/series.hpp>

Inheritance diagram for piranha::series< Cf, Key, Derived >:
Inheritance graph
[legend]
Collaboration diagram for piranha::series< Cf, Key, Derived >:
Collaboration graph
[legend]

Public Types

using term_type = term< Cf, Key >
 Alias for term type.
 
using size_type = typename container_type::size_type
 Size type. More...
 
using const_iterator = const_iterator_impl
 Const iterator. More...
 

Public Member Functions

 series ()=default
 Defaulted default constructor.
 
 series (const series &)=default
 Defaulted copy constructor. More...
 
 series (series &&)=default
 Defaulted move constructor.
 
template<typename T , typename U = series, generic_ctor_enabler< T, U > = 0>
 series (const T &x)
 Generic constructor. More...
 
 ~series ()
 Trivial destructor.
 
seriesoperator= (const series &other)
 Copy-assignment operator. More...
 
seriesoperator= (series &&other)=default
 Move assignment operator. More...
 
template<typename T , typename U = series, generic_ctor_enabler< T, U > = 0>
seriesoperator= (const T &x)
 Generic assignment operator. More...
 
size_type size () const
 Series size. More...
 
bool empty () const
 Empty test. More...
 
bool is_single_coefficient () const
 Test for single-coefficient series. More...
 
template<bool Sign, typename T , insert_enabler< T > = 0>
void insert (T &&term)
 Insert term. More...
 
template<typename T , insert_enabler< T > = 0>
void insert (T &&term)
 Insert generic term with Sign = true. More...
 
Derived operator+ () const
 Identity operator. More...
 
Derived operator- () const
 Negation operator. More...
 
void negate ()
 Negate series in-place. More...
 
template<typename T , typename U = Derived>
pow_ret_type< T, U > pow (const T &x) const
 Exponentiation. More...
 
template<typename Series = Derived>
partial_type< Series > partial (const std::string &name) const
 Partial derivative. More...
 
const_iterator begin () const
 Begin iterator. More...
 
const_iterator end () const
 End iterator. More...
 
Derived filter (std::function< bool(const std::pair< typename term_type::cf_type, Derived > &)> func) const
 Term filtering. More...
 
Derived transform (std::function< std::pair< typename term_type::cf_type, Derived >(const std::pair< typename term_type::cf_type, Derived > &)> func) const
 Term transformation. More...
 
Derived trim () const
 Trim. More...
 
void print_tex (std::ostream &os) const
 Print in TeX mode. More...
 
std::size_t hash () const
 Hash value. More...
 
template<typename T = Derived, is_identical_enabler< T > = 0>
bool is_identical (const Derived &other) const
 Check for identical series. More...
 
const symbol_fsetget_symbol_set () const
 Symbol set getter. More...
 
void set_symbol_set (const symbol_fset &args)
 Symbol set setter. More...
 
Table-querying methods

Methods to query the properties of the internal container used to store the terms.

sparsity_info_type table_sparsity () const
 Table sparsity. More...
 
double table_load_factor () const
 Table load factor. More...
 
size_type table_bucket_count () const
 Table bucket count. More...
 
Low-level interface

Low-level methods.

container_type_container ()
 Get a mutable reference to the container of terms. More...
 
const container_type_container () const
 Get a const reference to the container of terms. More...
 

Static Public Member Functions

template<typename T = Derived, is_identical_enabler< T > = 0>
static void clear_pow_cache ()
 Clear the internal cache of natural powers. More...
 
template<typename F , typename Series = Derived, custom_partial_enabler< F, Series > = 0>
static void register_custom_derivative (const std::string &name, F func)
 Register custom partial derivative. More...
 
template<typename Series = Derived, typename Partial = partial_type<Series>>
static void unregister_custom_derivative (const std::string &name)
 Unregister custom partial derivative. More...
 
template<typename Series = Derived, typename Partial = partial_type<Series>>
static void unregister_all_custom_derivatives ()
 Unregister all custom partial derivatives. More...
 

Protected Types

using container_type = hash_set< term_type >
 Container type for terms.
 

Protected Attributes

symbol_fset m_symbol_set
 Symbol set.
 
container_type m_container
 Terms container.
 

Friends

std::ostream & operator<< (std::ostream &os, const series &s)
 Overloaded stream operator for piranha::series. More...
 

Detailed Description

template<typename Cf, typename Key, typename Derived>
class piranha::series< Cf, Key, Derived >

Series class.

This class contains the arithmetic and comparison operator overloads for piranha::series instances via the parent class piranha::series_operators.

Type requirements

Exception safety guarantee

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

Move semantics

Moved-from series are left in a state equivalent to an empty series.

Definition at line 45 of file series_fwd.hpp.

Member Typedef Documentation

◆ const_iterator

template<typename Cf, typename Key, typename Derived>
using piranha::series< Cf, Key, Derived >::const_iterator = const_iterator_impl

Const iterator.

Iterator type that can be used to iterate over the terms of the series. The object returned upon dereferentiation is an std::pair in which the first element is a copy of the coefficient of the term, the second element a single-term instance of Derived constructed from the term's key and a unitary coefficient.

This iterator is an input iterator which additionally offers the multi-pass guarantee.

See also
piranha::series::begin() and piranha::series::end().

Definition at line 1994 of file series.hpp.

◆ size_type

template<typename Cf, typename Key, typename Derived>
using piranha::series< Cf, Key, Derived >::size_type = typename container_type::size_type

Size type.

Used to represent the number of terms in the series. Equivalent to piranha::hash_set::size_type.

Definition at line 1981 of file series.hpp.

Constructor & Destructor Documentation

◆ series() [1/2]

template<typename Cf, typename Key, typename Derived>
piranha::series< Cf, Key, Derived >::series ( const series< Cf, Key, Derived > &  )
default

Defaulted copy constructor.

Exceptions
unspecifiedany exception thrown by the copy constructor of piranha::hash_set.

◆ series() [2/2]

template<typename Cf, typename Key, typename Derived>
template<typename T , typename U = series, generic_ctor_enabler< T, U > = 0>
piranha::series< Cf, Key, Derived >::series ( const T &  x)
inlineexplicit

Generic constructor.

Note
This constructor is enabled only if T does not derive from the calling piranha::series instance and the algorithm outlined below is supported by the involved types.

The generic construction algorithm works as follows:

  • if T is a series with the same series recursion index as this, then the symbol set of x is copied into this and all terms from x are inserted into this. The terms of x are converted to term_type via the binary constructor of piranha::term, and the keys of x are converted to the key type of term_type via a converting constructor, if available (see piranha::key_is_convertible);
  • else, if the recursion index of T is less than the recursion index of this:
    • x is used to construct a new term as follows:
      • x is used to construct a coefficient via piranha::convert_to;
      • an empty arguments set will be used to construct a key;
      • coefficient and key are used to construct the new term instance;
    • the new term is inserted into this;
  • otherwise, the constructor is disabled.
Parameters
xobject to construct from.
Exceptions
unspecifiedany exception thrown by:

Definition at line 2033 of file series.hpp.

Member Function Documentation

◆ _container() [1/2]

template<typename Cf, typename Key, typename Derived>
container_type& piranha::series< Cf, Key, Derived >::_container ( )
inline

Get a mutable reference to the container of terms.

Returns
a reference to the internal container of terms.

Definition at line 2788 of file series.hpp.

◆ _container() [2/2]

template<typename Cf, typename Key, typename Derived>
const container_type& piranha::series< Cf, Key, Derived >::_container ( ) const
inline

Get a const reference to the container of terms.

Returns
a const reference to the internal container of terms.

Definition at line 2796 of file series.hpp.

◆ begin()

template<typename Cf, typename Key, typename Derived>
const_iterator piranha::series< Cf, Key, Derived >::begin ( ) const
inline

Begin iterator.

Return an iterator to the first term of the series. The returned iterator will provide, when dereferenced, an std::pair in which the first element is a copy of the coefficient of the term, whereas the second element is a single-term instance of Derived built from the term's key and a unitary coefficient.

Note that terms are stored unordered in the series, hence it is not defined which particular term will be returned by calling this method. The only guarantee is that the iterator can be used to transverse all the series' terms until piranha::series::end() is eventually reached.

Calling any non-const method on the series will invalidate the iterators obtained via piranha::series::begin() and piranha::series::end().

Returns
an iterator to the first term of the series.
Exceptions
unspecifiedany exception thrown by:

Definition at line 2504 of file series.hpp.

◆ clear_pow_cache()

template<typename Cf, typename Key, typename Derived>
template<typename T = Derived, is_identical_enabler< T > = 0>
static void piranha::series< Cf, Key, Derived >::clear_pow_cache ( )
inlinestatic

Clear the internal cache of natural powers.

This method can be used to clear the cache of natural powers of series maintained by piranha::series::pow().

Exceptions
unspecifiedany exception thrown by threading primitives.

Definition at line 2371 of file series.hpp.

◆ empty()

template<typename Cf, typename Key, typename Derived>
bool piranha::series< Cf, Key, Derived >::empty ( ) const
inline

Empty test.

Returns
true if size() is nonzero, false otherwise.

Definition at line 2103 of file series.hpp.

◆ end()

template<typename Cf, typename Key, typename Derived>
const_iterator piranha::series< Cf, Key, Derived >::end ( ) const
inline

End iterator.

Return an iterator one past the last term of the series. See the documentation of piranha::series::begin() on how the returned iterator can be used.

Returns
an iterator to the end of the series.
Exceptions
unspecifiedany exception thrown by:

Definition at line 2523 of file series.hpp.

◆ filter()

template<typename Cf, typename Key, typename Derived>
Derived piranha::series< Cf, Key, Derived >::filter ( std::function< bool(const std::pair< typename term_type::cf_type, Derived > &)>  func) const
inline

Term filtering.

This method will apply the functor func to each term in the series, and produce a return series containing all terms in this for which func returns true. Terms are passed to func in the format resulting from dereferencing the iterators obtained via piranha::series::begin().

Parameters
funcfiltering functor.
Returns
filtered series.
Exceptions
unspecifiedany exception thrown by:

Definition at line 2547 of file series.hpp.

◆ get_symbol_set()

template<typename Cf, typename Key, typename Derived>
const symbol_fset& piranha::series< Cf, Key, Derived >::get_symbol_set ( ) const
inline

Symbol set getter.

Returns
const reference to the piranha::symbol_fset associated to the series.

Definition at line 2762 of file series.hpp.

◆ hash()

template<typename Cf, typename Key, typename Derived>
std::size_t piranha::series< Cf, Key, Derived >::hash ( ) const
inline

Hash value.

The hash value for a series is zero if the series is empty, otherwise it is computed by adding the hash values of all terms. This ensures that two identical series in which the terms are stored in different order still produce the same hash value.

Note, however, that the arguments of the series are not considered in the hash value and that, in general, two series that compare equal according to operator==() will not have the same hash value (as the equality operator merges the arguments of two series before actually performing the comparison). Instead of operator==(), is_identical() should be used for storing series as keys in associative containers.

Returns
a hash value for the series.
Exceptions
unspecifiedany exception thrown by computing the hash of a term.

Definition at line 2730 of file series.hpp.

◆ insert() [1/2]

template<typename Cf, typename Key, typename Derived>
template<bool Sign, typename T , insert_enabler< T > = 0>
void piranha::series< Cf, Key, Derived >::insert ( T &&  term)
inline

Insert term.

Note
This method is enabled only if the decay type of T is piranha::series::term_type.

This method will insert term into the series using internally piranha::hash_set::insert.

The insertion algorithm proceeds as follows:

  • if the term is not compatible for insertion, an std::invalid_argument exception is thrown;
  • if the term is ignorable, the method will return without performing any insertion;
  • if the term is already in the series, then:
    • its coefficient is added (if Sign is true) or subtracted (if Sign is false) to the existing term's coefficient;
    • if, after the addition/subtraction the existing term is ignorable, it will be erased;
  • else:
    • the term is inserted into the term container and, if Sign is false, its coefficient is negated.

After any modification to an existing term in the series (e.g., via insertion with negative Sign or via in-place addition or subtraction of existing coefficients), the term will be checked again for compatibility and ignorability, and, in case the term has become incompatible or ignorable, it will be erased from the series.

The exception safety guarantee upon insertion is that the series will be left in an undefined but valid state. Such a guarantee relies on the fact that the addition/subtraction and negation methods of the coefficient type will leave the coefficient in a valid (possibly undefined) state in face of exceptions.

Parameters
termterm to be inserted.
Exceptions
unspecifiedany exception thrown by:
std::invalid_argumentif term is incompatible.

Definition at line 2161 of file series.hpp.

◆ insert() [2/2]

template<typename Cf, typename Key, typename Derived>
template<typename T , insert_enabler< T > = 0>
void piranha::series< Cf, Key, Derived >::insert ( T &&  term)
inline

Insert generic term with Sign = true.

Note
This method is enabled only if the decay type of T is piranha::series::term_type.

Convenience wrapper for the generic insert() method, with Sign set to true.

Parameters
termterm to be inserted.
Exceptions
unspecifiedany exception thrown by generic insert().

Definition at line 2177 of file series.hpp.

◆ is_identical()

template<typename Cf, typename Key, typename Derived>
template<typename T = Derived, is_identical_enabler< T > = 0>
bool piranha::series< Cf, Key, Derived >::is_identical ( const Derived &  other) const
inline

Check for identical series.

Note
This method is enabled only if Derived is equality-comparable.

This method will return true if the symbol sets of this and other are the same, and other == *this.

Parameters
otherargument for the comparison.
Returns
true if this and other are identical, false otherwise.
Exceptions
unspecifiedany exception thrown by the comparison operator of Derived.

Definition at line 2754 of file series.hpp.

◆ is_single_coefficient()

template<typename Cf, typename Key, typename Derived>
bool piranha::series< Cf, Key, Derived >::is_single_coefficient ( ) const
inline

Test for single-coefficient series.

A series is considered to be single-coefficient when it is symbolically equivalent to a coefficient. That is, the series is either empty (in which case it is considered to be equivalent to a coefficient constructed from zero) or consisting of a single term with unitary key (in which case the series is considered equivalent to its only coefficient).

Returns
true in case of single-coefficient series, false otherwise.
Exceptions
unspecifiedany exception thrown by the is_unitary() method of the key type.

Definition at line 2118 of file series.hpp.

◆ negate()

template<typename Cf, typename Key, typename Derived>
void piranha::series< Cf, Key, Derived >::negate ( )
inline

Negate series in-place.

This method will call math::negate() on the coefficients of all terms. In case of exceptions, the basic exception safety guarantee is provided.

If any term becomes ignorable or incompatible after negation, it will be erased from the series.

Exceptions
unspecifiedany exception thrown by math::negate() on the coefficient type.

Definition at line 2214 of file series.hpp.

◆ operator+()

template<typename Cf, typename Key, typename Derived>
Derived piranha::series< Cf, Key, Derived >::operator+ ( ) const
inline

Identity operator.

Returns
copy of this, cast to Derived.
Exceptions
unspecifiedany exception thrown by the copy constructor.

Definition at line 2187 of file series.hpp.

◆ operator-()

template<typename Cf, typename Key, typename Derived>
Derived piranha::series< Cf, Key, Derived >::operator- ( ) const
inline

Negation operator.

Returns
a copy of this on which negate() has been called.
Exceptions
unspecifiedany exception thrown by:
  • negate(),
  • the copy constructor of Derived.

Definition at line 2199 of file series.hpp.

◆ operator=() [1/3]

template<typename Cf, typename Key, typename Derived>
series& piranha::series< Cf, Key, Derived >::operator= ( const series< Cf, Key, Derived > &  other)
inline

Copy-assignment operator.

Parameters
otherassignment argument.
Returns
reference to this.
Exceptions
unspecifiedany exception thrown by the copy constructor.

Definition at line 2055 of file series.hpp.

◆ operator=() [2/3]

template<typename Cf, typename Key, typename Derived>
series& piranha::series< Cf, Key, Derived >::operator= ( series< Cf, Key, Derived > &&  other)
default

Move assignment operator.

Parameters
otherthe assignment argument.
Returns
a reference to this.

◆ operator=() [3/3]

template<typename Cf, typename Key, typename Derived>
template<typename T , typename U = series, generic_ctor_enabler< T, U > = 0>
series& piranha::series< Cf, Key, Derived >::operator= ( const T &  x)
inline

Generic assignment operator.

Note
This operator is enabled only if the corresponding generic constructor from x is enabled.

Generic assignment is equivalent to assignment to a piranha::series constructed via the generic constructor.

Parameters
xassignment argument.
Returns
reference to this.
Exceptions
unspecifiedany exception thrown by the generic constructor.

Definition at line 2085 of file series.hpp.

◆ partial()

template<typename Cf, typename Key, typename Derived>
template<typename Series = Derived>
partial_type<Series> piranha::series< Cf, Key, Derived >::partial ( const std::string &  name) const
inline

Partial derivative.

Note
This method is enabled only if the coefficient and key are differentiable (i.e., they satisfy the piranha::is_differentiable and piranha::key_is_differentiable type traits), and if the arithmetic operations needed to compute the partial derivative are supported by all the involved types.

This method will return the partial derivative of this with respect to the variable called name. The method will construct the return value from the output of the differentiation methods of coefficient and key, and via arithmetic and/or term insertion operations.

Note that, contrary to the specialisation of piranha::math::partial() for series types, this method will not take into account custom derivatives registered via piranha::series::register_custom_derivative().

Parameters
namename of the argument with respect to which the derivative will be calculated.
Returns
partial derivative of this with respect to the symbol name.
Exceptions
unspecifiedany exception thrown by:
  • the differentiation methods of coefficient and key,
  • term construction and insertion,
  • arithmetic operations on the involved types,
  • construction of the return type.

Definition at line 2405 of file series.hpp.

◆ pow()

template<typename Cf, typename Key, typename Derived>
template<typename T , typename U = Derived>
pow_ret_type<T, U> piranha::series< Cf, Key, Derived >::pow ( const T &  x) const
inline

Exponentiation.

Note
This method is enabled only if the algorithm outlined here is supported by the involved types.

Return this raised to the x-th power. The type of the result is either the calling series type, or the calling series type rebound to the type resulting from the exponentiation of the coefficient of the calling type to the power of x. The exponentiation algorithm proceeds as follows:

  • if the series is single-coefficient, the result is a single-coefficient series in which the coefficient is the original coefficient (or zero, if the calling series is empty) raised to the power of x;
  • if x is zero (as established by piranha::math::is_zero()), a series with a single term with unitary key and coefficient constructed from the integer numeral "1" is returned (i.e., any series raised to the power of zero is 1 - including empty series);
  • if x represents a non-negative integral value, the return value is constructed via repeated multiplications;
  • otherwise, an exception will be raised.

An internal thread-safe cache of natural powers of series is maintained in order to improve performance during, e.g., substitution operations. This cache can be cleared with clear_pow_cache().

Parameters
xexponent.
Returns
this raised to the power of x.
Exceptions
std::invalid_argumentif exponentiation is computed via repeated series multiplications and x does not represent a non-negative integer.
unspecifiedany exception thrown by:

Definition at line 2304 of file series.hpp.

◆ print_tex()

template<typename Cf, typename Key, typename Derived>
void piranha::series< Cf, Key, Derived >::print_tex ( std::ostream &  os) const
inline

Print in TeX mode.

Print series to stream os in TeX mode. The representation is constructed in the same way as explained in piranha::series::operator<<(), but using piranha::print_tex_coefficient() and the key's TeX printing method instead of the plain printing functions.

Parameters
ostarget stream.
Exceptions
unspecifiedany exception thrown by:
See also
operator<<().

Definition at line 2654 of file series.hpp.

◆ register_custom_derivative()

template<typename Cf, typename Key, typename Derived>
template<typename F , typename Series = Derived, custom_partial_enabler< F, Series > = 0>
static void piranha::series< Cf, Key, Derived >::register_custom_derivative ( const std::string &  name,
func 
)
inlinestatic

Register custom partial derivative.

Note
This method is enabled only if piranha::series::partial() is enabled for Derived, and if F is a type that can be used to construct std::function<partial_type(const Derived &), where partial_type is the type resulting from the partial derivative of Derived.

Register a copy of a callable func associated to the symbol name for use by piranha::math::partial(). func will be used to compute the partial derivative of instances of type Derived with respect to name in place of the default partial differentiation algorithm.

It is safe to call this method from multiple threads.

Parameters
namesymbol for which the custom partial derivative function will be registered.
funccustom partial derivative function.
Exceptions
unspecifiedany exception thrown by:
  • failure(s) in threading primitives,
  • lookup and insertion operations on std::unordered_map,
  • construction and move-assignment of std::function.

Definition at line 2432 of file series.hpp.

◆ set_symbol_set()

template<typename Cf, typename Key, typename Derived>
void piranha::series< Cf, Key, Derived >::set_symbol_set ( const symbol_fset args)
inline

Symbol set setter.

Parameters
argspiranha::symbol_fset that will be associated to the series.
Exceptions
std::invalid_argumentif the series is not empty.
unspecifiedany exception thrown by the copy assignment operator of piranha::symbol_fset.

Definition at line 2773 of file series.hpp.

◆ size()

template<typename Cf, typename Key, typename Derived>
size_type piranha::series< Cf, Key, Derived >::size ( ) const
inline

Series size.

Returns
the number of terms in the series.

Definition at line 2095 of file series.hpp.

◆ table_bucket_count()

template<typename Cf, typename Key, typename Derived>
size_type piranha::series< Cf, Key, Derived >::table_bucket_count ( ) const
inline

Table bucket count.

Returns
the bucket count of the internal container.

Definition at line 2263 of file series.hpp.

◆ table_load_factor()

template<typename Cf, typename Key, typename Derived>
double piranha::series< Cf, Key, Derived >::table_load_factor ( ) const
inline

Table load factor.

Will call piranha::hash_set::load_factor() on the internal terms container and return the result.

Returns
the load factor of the internal container.

Definition at line 2255 of file series.hpp.

◆ table_sparsity()

template<typename Cf, typename Key, typename Derived>
sparsity_info_type piranha::series< Cf, Key, Derived >::table_sparsity ( ) const
inline

Table sparsity.

Will call piranha::hash_set::evaluate_sparsity() on the internal terms container and return the result.

Returns
the output of piranha::hash_set::evaluate_sparsity().
Exceptions
unspecifiedany exception thrown by piranha::hash_set::evaluate_sparsity().

Definition at line 2244 of file series.hpp.

◆ transform()

template<typename Cf, typename Key, typename Derived>
Derived piranha::series< Cf, Key, Derived >::transform ( std::function< std::pair< typename term_type::cf_type, Derived >(const std::pair< typename term_type::cf_type, Derived > &)>  func) const
inline

Term transformation.

This method will apply the functor func to each term in the series, and will use the return value of the functor to construct a new series. Terms are passed to func in the same format resulting from dereferencing the iterators obtained via piranha::series::begin(), and func is expected to produce a return value of the same type.

The return series is first initialised as an empty series. For each input term t, the return value of func is used to construct a new temporary series from the multiplication of t.first and t.second. Each temporary series is then added to the return value series.

This method requires the coefficient type to be multipliable by Derived.

Parameters
functransforming functor.
Returns
transformed series.
Exceptions
unspecifiedany exception thrown by:
  • the call operator of func,
  • insert(),
  • the assignment operator of piranha::symbol_fset,
  • term, coefficient, key construction,
  • series multiplication and addition.

Definition at line 2585 of file series.hpp.

◆ trim()

template<typename Cf, typename Key, typename Derived>
Derived piranha::series< Cf, Key, Derived >::trim ( ) const
inline

Trim.

This method will return a series mathematically equivalent to this in which discardable arguments have been removed from the internal set of symbols. Which symbols are removed depends on the trimming method trim_identify() of the key type (e.g., in a polynomial a symbol can be discarded if its exponent is zero in all monomials).

If the coefficient type is an instance of piranha::series, trim() will be called recursively on the coefficients while building the return value.

Returns
trimmed version of this.
Exceptions
unspecifiedany exception thrown by:

Definition at line 2619 of file series.hpp.

◆ unregister_all_custom_derivatives()

template<typename Cf, typename Key, typename Derived>
template<typename Series = Derived, typename Partial = partial_type<Series>>
static void piranha::series< Cf, Key, Derived >::unregister_all_custom_derivatives ( )
inlinestatic

Unregister all custom partial derivatives.

Note
This method is enabled only if piranha::series::partial() is enabled for Derived.

Will unregister all custom derivatives currently registered via register_custom_derivative(). It is safe to call this method from multiple threads.

Exceptions
unspecifiedany exception thrown by failure(s) in threading primitives.

Definition at line 2478 of file series.hpp.

◆ unregister_custom_derivative()

template<typename Cf, typename Key, typename Derived>
template<typename Series = Derived, typename Partial = partial_type<Series>>
static void piranha::series< Cf, Key, Derived >::unregister_custom_derivative ( const std::string &  name)
inlinestatic

Unregister custom partial derivative.

Note
This method is enabled only if piranha::series::partial() is enabled for Derived.

Unregister the custom partial derivative function associated to the symbol name. If no custom partial derivative was previously registered using register_custom_derivative(), calling this function will be a no-op.

It is safe to call this method from multiple threads.

Parameters
namesymbol for which the custom partial derivative function will be unregistered.
Exceptions
unspecifiedany exception thrown by:
  • failure(s) in threading primitives,
  • lookup and erase operations on std::unordered_map.

Definition at line 2459 of file series.hpp.

Friends And Related Function Documentation

◆ operator<<

template<typename Cf, typename Key, typename Derived>
std::ostream& operator<< ( std::ostream &  os,
const series< Cf, Key, Derived > &  s 
)
friend

Overloaded stream operator for piranha::series.

Will direct to stream a human-readable representation of the series.

The human-readable representation of the series is built as follows:

  • the coefficient and key of each term are printed adjacent to each other separated by the character "*", the former via the piranha::print_coefficient() function, the latter via its print() method;
  • terms are separated by a "+" sign.

The following additional transformations take place on the printed output:

  • if the printed output of a coefficient is the string "1" and the printed output of its key is not empty, the coefficient and the "*" sign are not printed;
  • if the printed output of a coefficient is the string "-1" and the printed output of its key is not empty, the printed output of the coefficient is transformed into "-" and the sign "*" is not printed;
  • if the key output is empty, the sign "*" is not printed;
  • the sequence of characters "+-" is transformed into "-";
  • at most piranha::settings::get_max_term_output() terms are printed, and terms in excess are represented with ellipsis "..." at the end of the output; if piranha::settings::get_max_term_output() is zero, all the terms will be printed.

Note that the print order of the terms will be undefined.

Parameters
ostarget stream.
spiranha::series argument.
Returns
reference to os.
Exceptions
unspecifiedany exception thrown by:

Definition at line 2699 of file series.hpp.


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