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.
polynomial_utilities.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Jordi Cotela
11 //
12 
13 #pragma once
14 
15 // System includes
16 #include <array>
17 #include <vector>
18 
19 // External includes
20 
21 // Project includes
23 
25 {
26  using PolynomialType = std::vector<double>;
27  using IntervalType = std::array<double, 2>;
28 
30  std::size_t KRATOS_API(KRATOS_CORE) Degree(const PolynomialType& rPolynomial);
31 
33  double KRATOS_API(KRATOS_CORE) Evaluate(const PolynomialType& rPolynomial, double x);
34 
36  PolynomialType KRATOS_API(KRATOS_CORE) Differentiate(const PolynomialType& rPolynomial);
37 
39  PolynomialType KRATOS_API(KRATOS_CORE) Multiply(const PolynomialType& rA, const PolynomialType& rB);
40 
42  void KRATOS_API(KRATOS_CORE) Divide(
43  PolynomialType& rQuotient,
44  PolynomialType& rRemainder,
45  const PolynomialType& rA,
46  const PolynomialType& rB
47  );
48 
56  void KRATOS_API(KRATOS_CORE) IsolateRoots(
57  std::vector<IntervalType>& rRootIntervals,
58  const PolynomialType& rPolynomial,
59  const IntervalType& rRange
60  );
61 
71  double KRATOS_API(KRATOS_CORE) FindRoot(
72  const PolynomialType& rPolynomial,
73  const IntervalType& rRange
74  );
75 
76 }
#define KRATOS_API(...)
Definition: kratos_export_api.h:40
Definition: polynomial_utilities.cpp:23
std::vector< double > PolynomialType
Definition: polynomial_utilities.h:26
void Divide(PolynomialType &rQuotient, PolynomialType &rRemainder, const PolynomialType &rA, const PolynomialType &rB)
Definition: polynomial_utilities.cpp:118
std::size_t Degree(const PolynomialType &rPolynomial)
Definition: polynomial_utilities.cpp:72
double Evaluate(const PolynomialType &rPolynomial, double x)
Definition: polynomial_utilities.cpp:77
void IsolateRoots(std::vector< IntervalType > &rRootIntervals, const PolynomialType &rPolynomial, const IntervalType &rRange)
Define disjoint subintervals of rRange, each containing a single root of rPolynomial.
Definition: polynomial_utilities.cpp:153
double FindRoot(const PolynomialType &rPolynomial, const IntervalType &rRange)
Find a root of rPolynomial within the interval defined by rRange.
Definition: polynomial_utilities.cpp:212
PolynomialType Multiply(const PolynomialType &rA, const PolynomialType &rB)
Definition: polynomial_utilities.cpp:102
std::array< double, 2 > IntervalType
Definition: polynomial_utilities.h:27
PolynomialType Differentiate(const PolynomialType &rPolynomial)
Definition: polynomial_utilities.cpp:88
x
Definition: sensitivityMatrix.py:49