Sturm  0.0.0
Computing Sturm sequences in C++
Loading...
Searching...
No Matches
Sturm::Sequence< Real > Class Template Reference

Sturm sequence class. More...

#include <Sequence.hh>

Public Types

using Vector
using Interval

Public Member Functions

 Sequence ()
 Class constructor for the Sturm sequence.
 Sequence (const Poly< Real > &p)
 Class constructor for the Sturm sequence given a polynomial.
Real a () const
 Get the lower bound of the interval containing the roots.
Real b () const
 Get the upper bound of the interval containing the roots.
void build (const Poly< Real > &p)
 Given the polynomial \( p(x) \) build its Sturm sequence.
Integer length () const
 Get the length of the stored Sturm sequence.
const Poly< Real > & get (Integer i) const
 Get the \( i \)-th polynomial of the stored Sturm sequence.
Integer sign_variations (Real x, bool &on_root) const
Integer separate_roots (Real a_in, Real b_in)
 Compute the subintervals containing a single root.
Integer separate_roots ()
 Compute all the subintervals containing a single root in \( [a, b] \).
Integer roots_number () const
 Get the number of roots found.
const Intervalinterval (Integer i) const
template<typename SolveFunction>
Vector refine_roots (SolveFunction &&solve_function, bool verbose=false)
 Compute the roots in the intervals after the separation.

Private Attributes

std::vector< Poly< Real > > m_sequence
std::vector< Intervalm_intervals
Real m_a {0.0}
Real m_b {0.0}

Detailed Description

template<typename Real>
class Sturm::Sequence< Real >

This class implements the Sturm sequence for a given polynomial \( p(x) \). Such sequence is a sequence of polynomials \( p_0(x), p_1(x), \ldots, p_n(x) \) and allows to compute the number roots in a given interval \([a, b] \).

Template Parameters
RealScalar number type.

Member Typedef Documentation

◆ Interval

template<typename Real>
using Sturm::Sequence< Real >::Interval
Initial value:
struct Interval {
Real a;
Real b;
Integer va;
Integer vb;
bool a_on_root;
bool b_on_root;
}
struct Interval { Real a; Real b; Integer va; Integer vb; bool a_on_root; bool b_on_root; } Interval
Definition Sequence.hh:35
Real b() const
Get the upper bound of the interval containing the roots.
Definition Sequence.hh:79
Real a() const
Get the lower bound of the interval containing the roots.
Definition Sequence.hh:71
STURM_DEFAULT_INTEGER_TYPE Integer
The Integer type as used for the API.
Definition Sturm.hh:79

Interval structure.

◆ Vector

template<typename Real>
using Sturm::Sequence< Real >::Vector
Initial value:
Eigen::Vector<Real, Eigen::Dynamic>

Vector of real numbers.

Constructor & Destructor Documentation

◆ Sequence() [1/2]

template<typename Real>
Sturm::Sequence< Real >::Sequence ( )
inline

◆ Sequence() [2/2]

template<typename Real>
Sturm::Sequence< Real >::Sequence ( const Poly< Real > & p)
inline

Class constructor for the Sturm sequence given the polynomial \( p(x) \).

Parameters
[in]pPolynomial.

Member Function Documentation

◆ a()

template<typename Real>
Real Sturm::Sequence< Real >::a ( ) const
inline
Returns
The lower bound of the interval containing the roots.

◆ b()

template<typename Real>
Real Sturm::Sequence< Real >::b ( ) const
inline
Returns
The upper bound of the interval containing the roots.

◆ build()

template<typename Real>
void Sturm::Sequence< Real >::build ( const Poly< Real > & p)
inline

◆ get()

template<typename Real>
const Poly< Real > & Sturm::Sequence< Real >::get ( Integer i) const
inline
Returns
The \( i \)-th polynomial of the stored Sturm sequence.

◆ interval()

template<typename Real>
const Interval & Sturm::Sequence< Real >::interval ( Integer i) const
inline

Get the \( i \)-th interval containing a single root.

Returns
The \( i \)-th interval containing a single root.

◆ length()

template<typename Real>
Integer Sturm::Sequence< Real >::length ( ) const
inline
Returns
Length of the stored Sturm sequence.

◆ refine_roots()

template<typename Real>
template<typename SolveFunction>
Vector Sturm::Sequence< Real >::refine_roots ( SolveFunction && solve_function,
bool verbose = false )
inline
Parameters
[in]solve_functionLambda function for the root solver.
[in]verboseTrue if the function should print warnings.
Returns
A vector with the computed roots.
Template Parameters
SolverLambda function for the root solver with the signature bool(Real a, Real b, std::function<Real(Real)> f, Real & x).

◆ roots_number()

template<typename Real>
Integer Sturm::Sequence< Real >::roots_number ( ) const
inline
Returns
The number of roots found.

◆ separate_roots() [1/2]

template<typename Real>
Integer Sturm::Sequence< Real >::separate_roots ( )
inline

Compute an interval \( [a, b] \) that contains all the real roots and compute the subintervals containing a single root.

Returns
The numbers of intervals (roots) found.

◆ separate_roots() [2/2]

template<typename Real>
Integer Sturm::Sequence< Real >::separate_roots ( Real a_in,
Real b_in )
inline

Given an interval \( [a, b] \) compute the subintervals containing a single root.

Returns
The numbers of intervals (roots) found.

◆ sign_variations()

template<typename Real>
Integer Sturm::Sequence< Real >::sign_variations ( Real x,
bool & on_root ) const
inline

Compute the sign variations of the stored Sturm sequence at \( x \).

Returns
The number of sign variations.

Member Data Documentation

◆ m_a

template<typename Real>
Real Sturm::Sequence< Real >::m_a {0.0}
private

Lower bound of the interval containing the roots.

◆ m_b

template<typename Real>
Real Sturm::Sequence< Real >::m_b {0.0}
private

Upper bound of the interval containing the roots.

◆ m_intervals

template<typename Real>
std::vector<Interval> Sturm::Sequence< Real >::m_intervals
private

Computed intervals.

◆ m_sequence

template<typename Real>
std::vector<Poly<Real> > Sturm::Sequence< Real >::m_sequence
private

Sturm sequence.


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