Main MRPT website > C++ reference for MRPT 1.5.7
poly_roots.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 
10 #pragma once
11 
12 #include <cstdlib>
13 #include <mrpt/utils/mrpt_macros.h>
14 #include <mrpt/base/link_pragmas.h>
15 
16 namespace mrpt
17 {
18  namespace math
19  {
20  /** @addtogroup polynomial_roots Find polynomial roots (`#include <mrpt/math/poly_roots.h>`)
21  * \ingroup mrpt_base_grp
22  * @{ */
23 
24  /** Solves cubic equation `x^3 + a*x^2 + b*x + c = 0`. Returns the number of real roots `N`<=3.
25  * The roots are returned in the first entries of `x`, i.e. `x[0]` if N=1, `x[0]` and `x[1]` if N=2, etc.
26  * \param x array of size 3
27  * \note Based on `poly34.h`, by Khashin S.I. http://math.ivanovo.ac.ru/dalgebra/Khashin/index.html - khash2 (at) gmail.com */
28  int BASE_IMPEXP solve_poly3(double *x,double a,double b,double c) MRPT_NO_THROWS;
29 
30  /** Solves quartic equation `x^4 + a*x^3 + b*x^2 + c*x + d = 0` by Dekart-Euler method.
31  * Returns the number of real roots `N`<=4:
32  * - return 4: 4 real roots x[0], x[1], x[2], x[3], possible multiple roots
33  * - return 2: 2 real roots x[0], x[1] and complex x[2]+-i*x[3],
34  * - return 0: two pair of complex roots: x[0]+-i*x[1], x[2]+-i*x[3],
35  *
36  * The roots are returned in the first entries of `x`, i.e. `x[0]` if N=1, `x[0]` and `x[1]` if N=2, etc.
37  * \param x array of size 4
38  * \note Based on `poly34.h`, by Khashin S.I. http://math.ivanovo.ac.ru/dalgebra/Khashin/index.html - khash2 (at) gmail.com */
39  int BASE_IMPEXP solve_poly4(double *x,double a,double b,double c,double d) MRPT_NO_THROWS;
40 
41  /** Solves equation `x^5 + a*x^4 + b*x^3 + c*x^2 + d*x + e = 0`.
42  * Returns the number of real roots `N`<=5.
43  * The roots are returned in the first entries of `x`, i.e. `x[0]` if N=1, `x[0]` and `x[1]` if N=2, etc.
44  * \param x array of size 5
45  * \note Based on `poly34.h`, by Khashin S.I. http://math.ivanovo.ac.ru/dalgebra/Khashin/index.html - khash2 (at) gmail.com */
46  int BASE_IMPEXP solve_poly5(double *x,double a,double b,double c,double d,double e) MRPT_NO_THROWS;
47 
48  int BASE_IMPEXP solve_poly4Bi(double *x, double b, double d) MRPT_NO_THROWS; //!< Solve equation x^4 + b*x^2 + d = 0
49  int BASE_IMPEXP solve_poly4De(double *x, double b, double c, double d) MRPT_NO_THROWS; //!< Solve equation x^4 + b*x^2 + c*x + d = 0
50 
51  /** Solves equation `a*x^2 + b*x + c = 0`.
52  * Returns the number of real roots: either 0 or 2; or 1 if a=0 (in this case the root is in r1).
53  * r1, r2 are the roots. (r1<=r2)
54  * \note Based on `poly34.h`, by Khashin S.I. http://math.ivanovo.ac.ru/dalgebra/Khashin/index.html - khash2 (at) gmail.com */
55  int BASE_IMPEXP solve_poly2( double a, double b, double c, double &r1, double &r2) MRPT_NO_THROWS;
56 
57  /** @} */
58 
59  } // End of MATH namespace
60 
61 } // End of namespace
62 
int BASE_IMPEXP solve_poly3(double *x, double a, double b, double c) MRPT_NO_THROWS
Solves cubic equation x^3 + a*x^2 + b*x + c = 0.
Definition: poly_roots.cpp:29
int BASE_IMPEXP solve_poly4(double *x, double a, double b, double c, double d) MRPT_NO_THROWS
Solves quartic equation x^4 + a*x^3 + b*x^2 + c*x + d = 0 by Dekart-Euler method. ...
Definition: poly_roots.cpp:215
#define MRPT_NO_THROWS
C++11 noexcept: Used after member declarations.
const GLubyte * c
Definition: glext.h:5590
GLubyte GLubyte b
Definition: glext.h:5575
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
int BASE_IMPEXP solve_poly4De(double *x, double b, double c, double d) MRPT_NO_THROWS
Solve equation x^4 + b*x^2 + c*x + d = 0.
int BASE_IMPEXP solve_poly4Bi(double *x, double b, double d) MRPT_NO_THROWS
Solve equation x^4 + b*x^2 + d = 0.
int BASE_IMPEXP solve_poly2(double a, double b, double c, double &r1, double &r2) MRPT_NO_THROWS
Solves equation a*x^2 + b*x + c = 0.
Definition: poly_roots.cpp:302
GLenum GLint x
Definition: glext.h:3516
GLubyte GLubyte GLubyte a
Definition: glext.h:5575
int BASE_IMPEXP solve_poly5(double *x, double a, double b, double c, double d, double e) MRPT_NO_THROWS
Solves equation x^5 + a*x^4 + b*x^3 + c*x^2 + d*x + e = 0.
Definition: poly_roots.cpp:293



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019