VTK  9.4.20241118
vtkPolynomialSolversUnivariate.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-FileCopyrightText: Copyright 2011 Sandia Corporation
3// SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
31#ifndef vtkPolynomialSolversUnivariate_h
32#define vtkPolynomialSolversUnivariate_h
33
34#include "vtkCommonMathModule.h" // For export macro
35#include "vtkObject.h"
36
37VTK_ABI_NAMESPACE_BEGIN
38class VTKCOMMONMATH_EXPORT vtkPolynomialSolversUnivariate : public vtkObject
39{
40public:
43 void PrintSelf(ostream& os, vtkIndent indent) override;
44 static ostream& PrintPolynomial(ostream& os, double* P, int degP);
45
47
86 static int HabichtBisectionSolve(double* P, int d, double* a, double* upperBnds, double tol);
88 double* P, int d, double* a, double* upperBnds, double tol, int intervalType);
90 double* P, int d, double* a, double* upperBnds, double tol, int intervalType, bool divideGCD);
92
94
124 static int SturmBisectionSolve(double* P, int d, double* a, double* upperBnds, double tol);
126 double* P, int d, double* a, double* upperBnds, double tol, int intervalType);
128 double* P, int d, double* a, double* upperBnds, double tol, int intervalType, bool divideGCD);
130
138 static int FilterRoots(double* P, int d, double* upperBnds, int rootcount, double diameter);
139
151 static int LinBairstowSolve(double* c, int d, double* r, double& tolerance);
152
163 static int FerrariSolve(double* c, double* r, int* m, double tol);
164
180 static int TartagliaCardanSolve(double* c, double* r, int* m, double tol);
181
190 static double* SolveCubic(double c0, double c1, double c2, double c3);
191
200 static double* SolveQuadratic(double c0, double c1, double c2);
201
207 static double* SolveLinear(double c0, double c1);
208
222 static int SolveCubic(
223 double c0, double c1, double c2, double c3, double* r1, double* r2, double* r3, int* num_roots);
224
232 static int SolveQuadratic(
233 double c0, double c1, double c2, double* r1, double* r2, int* num_roots);
234
242 static int SolveQuadratic(double* c, double* r, int* m);
243
250 static int SolveLinear(double c0, double c1, double* r1, int* num_roots);
251
253
259 static void SetDivisionTolerance(double tol);
260 static double GetDivisionTolerance();
262
263protected:
266
267 static double DivisionTolerance;
268
269private:
271 void operator=(const vtkPolynomialSolversUnivariate&) = delete;
272};
273
274VTK_ABI_NAMESPACE_END
275#endif
RealT r2
Definition PyrC2Basis.h:20
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162
static double * SolveCubic(double c0, double c1, double c2, double c3)
Solves a cubic equation c0*t^3 + c1*t^2 + c2*t + c3 = 0 when c0, c1, c2, and c3 are REAL.
static int HabichtBisectionSolve(double *P, int d, double *a, double *upperBnds, double tol, int intervalType, bool divideGCD)
Finds all REAL roots (within tolerance tol) of the d -th degree polynomial.
static int FilterRoots(double *P, int d, double *upperBnds, int rootcount, double diameter)
This uses the derivative sequence to filter possible roots of a polynomial.
static int LinBairstowSolve(double *c, int d, double *r, double &tolerance)
Seeks all REAL roots of the d -th degree polynomial c[0] X^d + ... + c[d-1] X + c[d] = 0 equation Lin...
static int SolveCubic(double c0, double c1, double c2, double c3, double *r1, double *r2, double *r3, int *num_roots)
Solves a cubic equation when c0, c1, c2, And c3 Are REAL.
static int FerrariSolve(double *c, double *r, int *m, double tol)
Algebraically extracts REAL roots of the quartic polynomial with REAL coefficients X^4 + c[0] X^3 + c...
static int SturmBisectionSolve(double *P, int d, double *a, double *upperBnds, double tol, int intervalType)
Finds all REAL roots (within tolerance tol) of the d -th degree polynomial P[0] X^d + ....
~vtkPolynomialSolversUnivariate() override=default
static void SetDivisionTolerance(double tol)
Set/get the tolerance used when performing polynomial Euclidean division to find polynomial roots.
static double * SolveLinear(double c0, double c1)
Solves a linear equation c0*t + c1 = 0 when c0 and c1 are REAL.
static int SolveLinear(double c0, double c1, double *r1, int *num_roots)
Solves a linear equation c0*t + c1 = 0 when c0 and c1 are REAL.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static int SturmBisectionSolve(double *P, int d, double *a, double *upperBnds, double tol, int intervalType, bool divideGCD)
Finds all REAL roots (within tolerance tol) of the d -th degree polynomial P[0] X^d + ....
static int SolveQuadratic(double *c, double *r, int *m)
Algebraically extracts REAL roots of the quadratic polynomial with REAL coefficients c[0] X^2 + c[1] ...
static int TartagliaCardanSolve(double *c, double *r, int *m, double tol)
Algebraically extracts REAL roots of the cubic polynomial with REAL coefficients X^3 + c[0] X^2 + c[1...
static double GetDivisionTolerance()
Set/get the tolerance used when performing polynomial Euclidean division to find polynomial roots.
static ostream & PrintPolynomial(ostream &os, double *P, int degP)
static int HabichtBisectionSolve(double *P, int d, double *a, double *upperBnds, double tol)
Finds all REAL roots (within tolerance tol) of the d -th degree polynomial.
static int SturmBisectionSolve(double *P, int d, double *a, double *upperBnds, double tol)
Finds all REAL roots (within tolerance tol) of the d -th degree polynomial P[0] X^d + ....
static int HabichtBisectionSolve(double *P, int d, double *a, double *upperBnds, double tol, int intervalType)
Finds all REAL roots (within tolerance tol) of the d -th degree polynomial.
static double * SolveQuadratic(double c0, double c1, double c2)
Solves a quadratic equation c0*t^2 + c1*t + c2 = 0 when c0, c1, and c2 are REAL.
static int SolveQuadratic(double c0, double c1, double c2, double *r1, double *r2, int *num_roots)
Solves a quadratic equation c0*t^2 + c1*t + c2 = 0 when c0, c1, and c2 are REAL.
static vtkPolynomialSolversUnivariate * New()