CoolProp 6.8.1dev
An open-source fluid property and humid air property database
Public Member Functions | List of all members
CoolProp::superancillary::ChebyshevExpansion< ArrayType > Class Template Reference

Detailed Description

template<typename ArrayType>
class CoolProp::superancillary::ChebyshevExpansion< ArrayType >

A Chebyshev expansion of the form

\[ y = \sum_i c_iT_i(x) \]

where c are the coefficients and \(T_i\) are the Chebyshev basis functions of the first kind

More advanced tools are possible in the ChebTools package in C++, but the essentials are available here

Definition at line 243 of file superancillary.h.

#include <superancillary.h>

Public Member Functions

 ChebyshevExpansion ()
 
 ChebyshevExpansion (double xmin, double xmax, const ArrayType &coeff)
 Constructor with bounds and coefficients. More...
 
 ChebyshevExpansion (const ChebyshevExpansion &ex)=default
 Copy constructor. More...
 
ChebyshevExpansionoperator= (ChebyshevExpansion &&ex)=default
 
ChebyshevExpansionoperator= (const ChebyshevExpansion &ex)=default
 
const auto xmin () const
 Get the minimum value of the independent variable. More...
 
const auto xmax () const
 Get the maximum value of the independent variable. More...
 
const auto & coeff () const
 Get a const view on the expansion coefficients. More...
 
template<typename T >
auto eval (const T &x) const
 
template<typename T >
auto eval_many (const T &x, T &y) const
 A vectorized variant (for use with Python interface) More...
 
template<typename T >
auto eval_manyC (const T x[], T y[], std::size_t N) const
 A vectorized variant in which arrays are C-style, assumed to be of the same length. More...
 
template<typename T >
auto eval_Eigen (const T &x, T &y) const
 A vectorized variant (for use with Python interface) More...
 
Eigen::ArrayXd get_nodes_realworld () const
 Chebyshev-Lobatto nodes \(\cos(\pi j/N), j = 0,..., N \) mapped to the range [xmin, xmax]. More...
 
auto solve_for_x_count (double y, double a, double b, unsigned int bits, std::size_t max_iter, double boundsytol) const
 
auto solve_for_x (double y, double a, double b, unsigned int bits, std::size_t max_iter, double boundsytol) const
 
template<typename T >
auto solve_for_x_many (const T &y, double a, double b, unsigned int bits, std::size_t max_iter, double boundsytol, T &x, T &counts) const
 A vectorized variant (for use with Python interface) More...
 
template<typename T >
auto solve_for_x_manyC (const T y[], std::size_t N, double a, double b, unsigned int bits, std::size_t max_iter, double boundsytol, T x[], T counts[]) const
 A vectorized variant in which arrays are C-style, assumed to be of the same length. More...
 
ArrayType do_derivs (std::size_t Nderiv) const
 

Constructor & Destructor Documentation

◆ ChebyshevExpansion() [1/3]

template<typename ArrayType >
CoolProp::superancillary::ChebyshevExpansion< ArrayType >::ChebyshevExpansion ( )
inline

Definition at line 249 of file superancillary.h.

◆ ChebyshevExpansion() [2/3]

template<typename ArrayType >
CoolProp::superancillary::ChebyshevExpansion< ArrayType >::ChebyshevExpansion ( double  xmin,
double  xmax,
const ArrayType &  coeff 
)
inline

Constructor with bounds and coefficients.

Definition at line 252 of file superancillary.h.

◆ ChebyshevExpansion() [3/3]

template<typename ArrayType >
CoolProp::superancillary::ChebyshevExpansion< ArrayType >::ChebyshevExpansion ( const ChebyshevExpansion< ArrayType > &  ex)
default

Copy constructor.

Member Function Documentation

◆ coeff()

template<typename ArrayType >
const auto & CoolProp::superancillary::ChebyshevExpansion< ArrayType >::coeff ( ) const
inline

Get a const view on the expansion coefficients.

Definition at line 266 of file superancillary.h.

◆ do_derivs()

template<typename ArrayType >
ArrayType CoolProp::superancillary::ChebyshevExpansion< ArrayType >::do_derivs ( std::size_t  Nderiv) const
inline

< Degree of the expansion

< Degree of the derivative expansion

Definition at line 361 of file superancillary.h.

◆ eval()

template<typename ArrayType >
template<typename T >
auto CoolProp::superancillary::ChebyshevExpansion< ArrayType >::eval ( const T &  x) const
inline

Evaluate the expansion with Clenshaw's method

Parameters
xThe value of the independent variable

Definition at line 272 of file superancillary.h.

◆ eval_Eigen()

template<typename ArrayType >
template<typename T >
auto CoolProp::superancillary::ChebyshevExpansion< ArrayType >::eval_Eigen ( const T &  x,
T &  y 
) const
inline

A vectorized variant (for use with Python interface)

Definition at line 302 of file superancillary.h.

◆ eval_many()

template<typename ArrayType >
template<typename T >
auto CoolProp::superancillary::ChebyshevExpansion< ArrayType >::eval_many ( const T &  x,
T &  y 
) const
inline

A vectorized variant (for use with Python interface)

Definition at line 289 of file superancillary.h.

◆ eval_manyC()

template<typename ArrayType >
template<typename T >
auto CoolProp::superancillary::ChebyshevExpansion< ArrayType >::eval_manyC ( const T  x[],
y[],
std::size_t  N 
) const
inline

A vectorized variant in which arrays are C-style, assumed to be of the same length.

Definition at line 296 of file superancillary.h.

◆ get_nodes_realworld()

template<typename ArrayType >
Eigen::ArrayXd CoolProp::superancillary::ChebyshevExpansion< ArrayType >::get_nodes_realworld ( ) const
inline

Chebyshev-Lobatto nodes \(\cos(\pi j/N), j = 0,..., N \) mapped to the range [xmin, xmax].

Definition at line 308 of file superancillary.h.

◆ operator=() [1/2]

template<typename ArrayType >
ChebyshevExpansion & CoolProp::superancillary::ChebyshevExpansion< ArrayType >::operator= ( ChebyshevExpansion< ArrayType > &&  ex)
default

◆ operator=() [2/2]

template<typename ArrayType >
ChebyshevExpansion & CoolProp::superancillary::ChebyshevExpansion< ArrayType >::operator= ( const ChebyshevExpansion< ArrayType > &  ex)
default

◆ solve_for_x()

template<typename ArrayType >
auto CoolProp::superancillary::ChebyshevExpansion< ArrayType >::solve_for_x ( double  y,
double  a,
double  b,
unsigned int  bits,
std::size_t  max_iter,
double  boundsytol 
) const
inline

Return the value of x only for given value of y

See also
solve_for_x_count

Definition at line 342 of file superancillary.h.

◆ solve_for_x_count()

template<typename ArrayType >
auto CoolProp::superancillary::ChebyshevExpansion< ArrayType >::solve_for_x_count ( double  y,
double  a,
double  b,
unsigned int  bits,
std::size_t  max_iter,
double  boundsytol 
) const
inline

Solve for independent variable given a bracketing interval [a,b] with the use of the TOMS 748 algorithm from boost which is an improvement over Brent's method (in all cases, asymptotically, acccording to the boost docs)

Parameters
ytarget value to be matched
aleft bound for interval
bright bound for interval
bitsnumber of bits to be matched in TOMS748 solver
max_itermaximum nimber of function calls
boundsytoltolerance that is considered to be the right solution
Returns
Tuple of value of x and the number of function evaluations required

Definition at line 327 of file superancillary.h.

◆ solve_for_x_many()

template<typename ArrayType >
template<typename T >
auto CoolProp::superancillary::ChebyshevExpansion< ArrayType >::solve_for_x_many ( const T &  y,
double  a,
double  b,
unsigned int  bits,
std::size_t  max_iter,
double  boundsytol,
T &  x,
T &  counts 
) const
inline

A vectorized variant (for use with Python interface)

Definition at line 348 of file superancillary.h.

◆ solve_for_x_manyC()

template<typename ArrayType >
template<typename T >
auto CoolProp::superancillary::ChebyshevExpansion< ArrayType >::solve_for_x_manyC ( const T  y[],
std::size_t  N,
double  a,
double  b,
unsigned int  bits,
std::size_t  max_iter,
double  boundsytol,
x[],
counts[] 
) const
inline

A vectorized variant in which arrays are C-style, assumed to be of the same length.

Definition at line 355 of file superancillary.h.

◆ xmax()

template<typename ArrayType >
const auto CoolProp::superancillary::ChebyshevExpansion< ArrayType >::xmax ( ) const
inline

Get the maximum value of the independent variable.

Definition at line 263 of file superancillary.h.

◆ xmin()

template<typename ArrayType >
const auto CoolProp::superancillary::ChebyshevExpansion< ArrayType >::xmin ( ) const
inline

Get the minimum value of the independent variable.

Definition at line 260 of file superancillary.h.


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