KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
Typedefs | Functions
Kratos::PolynomialUtilities Namespace Reference

Typedefs

using PolynomialType = std::vector< double >
 
using IntervalType = std::array< double, 2 >
 

Functions

std::size_t Degree (const PolynomialType &rPolynomial)
 
double Evaluate (const PolynomialType &rPolynomial, double x)
 
PolynomialType Differentiate (const PolynomialType &rPolynomial)
 
PolynomialType Multiply (const PolynomialType &rA, const PolynomialType &rB)
 
void Divide (PolynomialType &rQuotient, PolynomialType &rRemainder, const PolynomialType &rA, const PolynomialType &rB)
 
void IsolateRoots (std::vector< IntervalType > &rRootIntervals, const PolynomialType &rPolynomial, const IntervalType &rRange)
 Define disjoint subintervals of rRange, each containing a single root of rPolynomial. More...
 
double FindRoot (const PolynomialType &rPolynomial, const IntervalType &rRange)
 Find a root of rPolynomial within the interval defined by rRange. More...
 

Typedef Documentation

◆ IntervalType

using Kratos::PolynomialUtilities::IntervalType = typedef std::array<double, 2>

◆ PolynomialType

Function Documentation

◆ Degree()

std::size_t Kratos::PolynomialUtilities::Degree ( const PolynomialType rPolynomial)

Degree of the polynomial

◆ Differentiate()

PolynomialType Kratos::PolynomialUtilities::Differentiate ( const PolynomialType rPolynomial)

Derivative of the polynomial

◆ Divide()

void Kratos::PolynomialUtilities::Divide ( PolynomialType rQuotient,
PolynomialType rRemainder,
const PolynomialType rA,
const PolynomialType rB 
)

Euclidian division of polynomials rA / rB = rQuotient*rB + rRemainder

◆ Evaluate()

double Kratos::PolynomialUtilities::Evaluate ( const PolynomialType rPolynomial,
double  x 
)

Evaluate the polynomial at the given x value

◆ FindRoot()

double Kratos::PolynomialUtilities::FindRoot ( const PolynomialType rPolynomial,
const IntervalType rRange 
)

Find a root of rPolynomial within the interval defined by rRange.

The implementation assumes that rRange contains exactly one root and that rRange[0]*rRange[1] < 0

Parameters
rPolynomialthe polynomial
rRangeinterval containing the root
Returns
The root.
See also
IsolateRoots to identify suitable ranges.

◆ IsolateRoots()

void Kratos::PolynomialUtilities::IsolateRoots ( std::vector< IntervalType > &  rRootIntervals,
const PolynomialType rPolynomial,
const IntervalType rRange 
)

Define disjoint subintervals of rRange, each containing a single root of rPolynomial.

The function uses the signs of the Sturm sequence in order to isolate the roots.

Parameters
rRootIntervalseach term defines a subinterval of rRange containing a single root.
rPolynomialthe polynomial for which we want to find the roots.
rRangethe interval in which the roots are to be found.

◆ Multiply()

PolynomialType Kratos::PolynomialUtilities::Multiply ( const PolynomialType rA,
const PolynomialType rB 
)

Product of two polynomials