Tatooine
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
tatooine::polynomial< Real, Degree > Struct Template Reference

#include <polynomial.h>

Inheritance diagram for tatooine::polynomial< Real, Degree >:
[legend]
Collaboration diagram for tatooine::polynomial< Real, Degree >:
[legend]

Public Types

using real_type = Real
 

Public Member Functions

constexpr polynomial ()
 
constexpr polynomial (polynomial const &other)=default
 
constexpr polynomial (polynomial &&other) noexcept=default
 
constexpr auto operator= (polynomial const &other) -> polynomial &=default
 
constexpr auto operator= (polynomial &&other) noexcept -> polynomial &=default
 
constexpr polynomial (std::array< Real, Degree+1 > const &coeffs)
 
template<typename OtherReal , std::size_t OtherDegree>
requires (OtherDegree <= Degree)
constexpr polynomial (polynomial< OtherReal, OtherDegree > const &other)
 
constexpr polynomial (std::array< Real, Degree+1 > &&coeffs)
 
template<arithmetic... Coeffs>
requires ( sizeof...(coeffs) == Degree + 1)
constexpr polynomial (arithmetic auto const ... coeffs)
 
template<arithmetic OtherReal>
constexpr polynomial (tensor< OtherReal, Degree+1 > const &coeffs)
 
template<arithmetic OtherReal>
constexpr polynomial (std::array< OtherReal, Degree+1 > const &coeffs)
 
constexpr auto evaluate (arithmetic auto const x) const
 evaluates c0 * x^0 + c1 * x^1 + ... + c{N-1} * x^{N-1} More...
 
constexpr auto operator() (arithmetic auto const x) const
 evaluates c0 * x^0 + c1 * x^1 + ... + c{N-1} * x^{N-1} More...
 
auto c (std::size_t i) const -> auto const &
 
auto c (std::size_t i) -> auto &
 
auto coefficient (std::size_t i) const -> auto const &
 
auto coefficient (std::size_t i) -> auto const &
 
auto coefficients () const -> auto const &
 
auto coefficients () -> auto const &
 
constexpr auto set_coefficients (std::array< Real, Degree+1 > const &coeffs) -> void
 
constexpr auto set_coefficients (std::array< Real, Degree+1 > &&coeffs) -> void
 
template<arithmetic OtherReal>
constexpr auto set_coefficients (std::array< OtherReal, Degree+1 > const &coeffs) -> void
 
constexpr auto set_coefficients (arithmetic auto const ... coeffs) -> void requires(sizeof...(coeffs)==Degree+1)
 
constexpr auto diff () const
 
auto print (std::ostream &out, std::string const &x) const -> std::ostream &
 

Static Public Member Functions

static constexpr std::size_t degree ()
 

Private Member Functions

template<std::size_t... Is>
constexpr auto diff (std::index_sequence< Is... >) const
 

Private Attributes

std::array< Real, Degree+1 > m_coefficients
 

Member Typedef Documentation

◆ real_type

template<typename Real , std::size_t Degree>
using tatooine::polynomial< Real, Degree >::real_type = Real

Constructor & Destructor Documentation

◆ polynomial() [1/9]

template<typename Real , std::size_t Degree>
constexpr tatooine::polynomial< Real, Degree >::polynomial ( )
inlineconstexpr

◆ polynomial() [2/9]

template<typename Real , std::size_t Degree>
constexpr tatooine::polynomial< Real, Degree >::polynomial ( polynomial< Real, Degree > const &  other)
constexprdefault

◆ polynomial() [3/9]

template<typename Real , std::size_t Degree>
constexpr tatooine::polynomial< Real, Degree >::polynomial ( polynomial< Real, Degree > &&  other)
constexprdefaultnoexcept

◆ polynomial() [4/9]

template<typename Real , std::size_t Degree>
constexpr tatooine::polynomial< Real, Degree >::polynomial ( std::array< Real, Degree+1 > const &  coeffs)
inlineconstexpr

◆ polynomial() [5/9]

template<typename Real , std::size_t Degree>
template<typename OtherReal , std::size_t OtherDegree>
requires (OtherDegree <= Degree)
constexpr tatooine::polynomial< Real, Degree >::polynomial ( polynomial< OtherReal, OtherDegree > const &  other)
inlineconstexpr

◆ polynomial() [6/9]

template<typename Real , std::size_t Degree>
constexpr tatooine::polynomial< Real, Degree >::polynomial ( std::array< Real, Degree+1 > &&  coeffs)
inlineconstexpr

◆ polynomial() [7/9]

template<typename Real , std::size_t Degree>
template<arithmetic... Coeffs>
requires ( sizeof...(coeffs) == Degree + 1)
constexpr tatooine::polynomial< Real, Degree >::polynomial ( arithmetic auto const ...  coeffs)
inlineconstexpr

◆ polynomial() [8/9]

template<typename Real , std::size_t Degree>
template<arithmetic OtherReal>
constexpr tatooine::polynomial< Real, Degree >::polynomial ( tensor< OtherReal, Degree+1 > const &  coeffs)
inlineconstexpr

◆ polynomial() [9/9]

template<typename Real , std::size_t Degree>
template<arithmetic OtherReal>
constexpr tatooine::polynomial< Real, Degree >::polynomial ( std::array< OtherReal, Degree+1 > const &  coeffs)
inlineconstexpr

Member Function Documentation

◆ c() [1/2]

template<typename Real , std::size_t Degree>
auto tatooine::polynomial< Real, Degree >::c ( std::size_t  i) -> auto&
inline

◆ c() [2/2]

template<typename Real , std::size_t Degree>
auto tatooine::polynomial< Real, Degree >::c ( std::size_t  i) const -> auto const&
inline

◆ coefficient() [1/2]

template<typename Real , std::size_t Degree>
auto tatooine::polynomial< Real, Degree >::coefficient ( std::size_t  i) -> auto const&
inline

◆ coefficient() [2/2]

template<typename Real , std::size_t Degree>
auto tatooine::polynomial< Real, Degree >::coefficient ( std::size_t  i) const -> auto const&
inline

◆ coefficients() [1/2]

template<typename Real , std::size_t Degree>
auto tatooine::polynomial< Real, Degree >::coefficients ( ) -> auto const&
inline

◆ coefficients() [2/2]

template<typename Real , std::size_t Degree>
auto tatooine::polynomial< Real, Degree >::coefficients ( ) const -> auto const&
inline

◆ degree()

template<typename Real , std::size_t Degree>
static constexpr std::size_t tatooine::polynomial< Real, Degree >::degree ( )
inlinestaticconstexpr

◆ diff() [1/2]

template<typename Real , std::size_t Degree>
constexpr auto tatooine::polynomial< Real, Degree >::diff ( ) const
inlineconstexpr

◆ diff() [2/2]

template<typename Real , std::size_t Degree>
template<std::size_t... Is>
constexpr auto tatooine::polynomial< Real, Degree >::diff ( std::index_sequence< Is... >  ) const
inlineconstexprprivate

◆ evaluate()

template<typename Real , std::size_t Degree>
constexpr auto tatooine::polynomial< Real, Degree >::evaluate ( arithmetic auto const  x) const
inlineconstexpr

evaluates c0 * x^0 + c1 * x^1 + ... + c{N-1} * x^{N-1}

◆ operator()()

template<typename Real , std::size_t Degree>
constexpr auto tatooine::polynomial< Real, Degree >::operator() ( arithmetic auto const  x) const
inlineconstexpr

evaluates c0 * x^0 + c1 * x^1 + ... + c{N-1} * x^{N-1}

◆ operator=() [1/2]

template<typename Real , std::size_t Degree>
constexpr auto tatooine::polynomial< Real, Degree >::operator= ( polynomial< Real, Degree > &&  other) -> polynomial &=default
constexprdefaultnoexcept

◆ operator=() [2/2]

template<typename Real , std::size_t Degree>
constexpr auto tatooine::polynomial< Real, Degree >::operator= ( polynomial< Real, Degree > const &  other) -> polynomial &=default
constexprdefault

◆ print()

template<typename Real , std::size_t Degree>
auto tatooine::polynomial< Real, Degree >::print ( std::ostream &  out,
std::string const &  x 
) const -> std::ostream&
inline

◆ set_coefficients() [1/4]

template<typename Real , std::size_t Degree>
constexpr auto tatooine::polynomial< Real, Degree >::set_coefficients ( arithmetic auto const ...  coeffs) -> void requires(sizeof...(coeffs) == Degree + 1)
inlineconstexpr

◆ set_coefficients() [2/4]

template<typename Real , std::size_t Degree>
template<arithmetic OtherReal>
constexpr auto tatooine::polynomial< Real, Degree >::set_coefficients ( std::array< OtherReal, Degree+1 > const &  coeffs) -> void
inlineconstexpr

◆ set_coefficients() [3/4]

template<typename Real , std::size_t Degree>
constexpr auto tatooine::polynomial< Real, Degree >::set_coefficients ( std::array< Real, Degree+1 > &&  coeffs) -> void
inlineconstexpr

◆ set_coefficients() [4/4]

template<typename Real , std::size_t Degree>
constexpr auto tatooine::polynomial< Real, Degree >::set_coefficients ( std::array< Real, Degree+1 > const &  coeffs) -> void
inlineconstexpr

Member Data Documentation

◆ m_coefficients

template<typename Real , std::size_t Degree>
std::array<Real, Degree + 1> tatooine::polynomial< Real, Degree >::m_coefficients
private

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