|
virtual vtkTypeBool | IsA (const char *type) |
| Return 1 if this class is the same type of (or a subclass of) the named class. More...
|
|
vtkPolynomialSolversUnivariate * | NewInstance () const |
|
void | PrintSelf (ostream &os, vtkIndent indent) override |
| Methods invoked by print to print information about the object including superclasses. More...
|
|
| vtkBaseTypeMacro (vtkObject, vtkObjectBase) |
|
virtual void | DebugOn () |
| Turn debugging output on. More...
|
|
virtual void | DebugOff () |
| Turn debugging output off. More...
|
|
bool | GetDebug () |
| Get the value of the debug flag. More...
|
|
void | SetDebug (bool debugFlag) |
| Set the value of the debug flag. More...
|
|
virtual void | Modified () |
| Update the modification time for this object. More...
|
|
virtual vtkMTimeType | GetMTime () |
| Return this object's modified time. More...
|
|
unsigned long | AddObserver (unsigned long event, vtkCommand *, float priority=0.0f) |
| Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
|
|
unsigned long | AddObserver (const char *event, vtkCommand *, float priority=0.0f) |
|
vtkCommand * | GetCommand (unsigned long tag) |
|
void | RemoveObserver (vtkCommand *) |
|
void | RemoveObservers (unsigned long event, vtkCommand *) |
|
void | RemoveObservers (const char *event, vtkCommand *) |
|
vtkTypeBool | HasObserver (unsigned long event, vtkCommand *) |
|
vtkTypeBool | HasObserver (const char *event, vtkCommand *) |
|
void | RemoveObserver (unsigned long tag) |
|
void | RemoveObservers (unsigned long event) |
|
void | RemoveObservers (const char *event) |
|
void | RemoveAllObservers () |
|
vtkTypeBool | HasObserver (unsigned long event) |
|
vtkTypeBool | HasObserver (const char *event) |
|
template<class U , class T > |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f) |
| Overloads to AddObserver that allow developers to add class member functions as callbacks for events. More...
|
|
template<class U , class T > |
unsigned long | AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
|
template<class U , class T > |
unsigned long | AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f) |
| Allow user to set the AbortFlagOn() with the return value of the callback method. More...
|
|
int | InvokeEvent (unsigned long event, void *callData) |
| This method invokes an event and return whether the event was aborted or not. More...
|
|
int | InvokeEvent (const char *event, void *callData) |
|
int | InvokeEvent (unsigned long event) |
|
int | InvokeEvent (const char *event) |
|
const char * | GetClassName () const |
| Return the class name as a string. More...
|
|
virtual void | Delete () |
| Delete a VTK object. More...
|
|
virtual void | FastDelete () |
| Delete a reference to this object. More...
|
|
void | InitializeObjectBase () |
|
void | Print (ostream &os) |
| Print an object to an ostream. More...
|
|
virtual void | PrintHeader (ostream &os, vtkIndent indent) |
|
virtual void | PrintTrailer (ostream &os, vtkIndent indent) |
|
virtual void | Register (vtkObjectBase *o) |
| Increase the reference count (mark as used by another object). More...
|
|
virtual void | UnRegister (vtkObjectBase *o) |
| Decrease the reference count (release by another object). More...
|
|
int | GetReferenceCount () |
| Return the current reference count of this object. More...
|
|
void | SetReferenceCount (int) |
| Sets the reference count. More...
|
|
void | PrintRevisions (ostream &) |
| Legacy. More...
|
|
|
static vtkPolynomialSolversUnivariate * | New () |
|
static vtkTypeBool | IsTypeOf (const char *type) |
|
static vtkPolynomialSolversUnivariate * | SafeDownCast (vtkObjectBase *o) |
|
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. More...
|
|
static int | HabichtBisectionSolve (double *P, int d, double *a, double *upperBnds, double tol, int intervalType) |
|
static int | HabichtBisectionSolve (double *P, int d, double *a, double *upperBnds, double tol, int intervalType, bool divideGCD) |
|
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 + ... More...
|
|
static int | SturmBisectionSolve (double *P, int d, double *a, double *upperBnds, double tol, int intervalType) |
|
static int | SturmBisectionSolve (double *P, int d, double *a, double *upperBnds, double tol, int intervalType, bool divideGCD) |
|
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. More...
|
|
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 + ... More...
|
|
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[1] X^2 + c[2] X + c[3] and stores them (when they exist) and their respective multiplicities in the r and m arrays, based on Ferrari's method. More...
|
|
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] X + c[2] and stores them (when they exist) and their respective multiplicities in the r and m arrays. More...
|
|
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. More...
|
|
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. More...
|
|
static double * | SolveLinear (double c0, double c1) |
| Solves a linear equation c0*t + c1 = 0 when c0 and c1 are REAL. More...
|
|
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. More...
|
|
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. More...
|
|
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] X + c[2] and stores them (when they exist) and their respective multiplicities in the r and m arrays. More...
|
|
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. More...
|
|
static void | SetDivisionTolerance (double tol) |
| Set/get the tolerance used when performing polynomial Euclidean division to find polynomial roots. More...
|
|
static double | GetDivisionTolerance () |
|
static vtkObject * | New () |
| Create an object with Debug turned off, modified time initialized to zero, and reference counting on. More...
|
|
static void | BreakOnError () |
| This method is called when vtkErrorMacro executes. More...
|
|
static void | SetGlobalWarningDisplay (int val) |
| This is a global flag that controls whether any debug, warning or error messages are displayed. More...
|
|
static void | GlobalWarningDisplayOn () |
|
static void | GlobalWarningDisplayOff () |
|
static int | GetGlobalWarningDisplay () |
|
static vtkTypeBool | IsTypeOf (const char *name) |
| Return 1 if this class type is the same type of (or a subclass of) the named class. More...
|
|
static vtkObjectBase * | New () |
| Create an object with Debug turned off, modified time initialized to zero, and reference counting on. More...
|
|
polynomial solvers
vtkPolynomialSolversUnivariate provides solvers for univariate polynomial equations with real coefficients. The Tartaglia-Cardan and Ferrari solvers work on polynomials of fixed degree 3 and 4, respectively. The Lin-Bairstow and Sturm solvers work on polynomials of arbitrary degree. The Sturm solver is the most robust solver but only reports roots within an interval and does not report multiplicities. The Lin-Bairstow solver reports multiplicities.
For difficult polynomials, you may wish to use FilterRoots to eliminate some of the roots reported by the Sturm solver. FilterRoots evaluates the derivatives near each root to eliminate cases where a local minimum or maximum is close to zero.
- Thanks:
- Thanks to Philippe Pebay, Korben Rusek, David Thompson, and Maurice Rojas for implementing these solvers.
- Tests:
- vtkPolynomialSolversUnivariate (Tests)
Definition at line 58 of file vtkPolynomialSolversUnivariate.h.
Finds all REAL roots (within tolerance tol) of the d -th degree polynomial.
in ]a[0] ; a[1]] using the Habicht sequence (polynomial coefficients are REAL) and returns the count nr. All roots are bracketed in the \nr first ]upperBnds[i] - tol ; upperBnds[i]] intervals. Returns -1 if anything went wrong (such as: polynomial does not have degree d, the interval provided by the other is absurd, etc.).
intervalType specifies the search interval as follows: 0 = 00 = ]a,b[ 1 = 10 = [a,b[ 2 = 01 = ]a,b] 3 = 11 = [a,b] This defaults to 0.
The last non-zero item in the Habicht sequence is the gcd of P and P'. The parameter divideGCD specifies whether the program should attempt to divide by the gcd and run again. It works better with polynomials known to have high multiplicities. When divideGCD != 0 then it attempts to divide by the GCD, if applicable. This defaults to 0.
Compared to the Sturm solver the Habicht solver is slower, although both are O(d^2). The Habicht solver has the added benefit that it has a built in mechanism to keep the leading coefficients of the result from polynomial division bounded above and below in absolute value. This will tend to keep the coefficients of the polynomials in the sequence from zeroing out prematurely or becoming infinite.
Constructing the Habicht sequence is O(d^2) in both time and space.
Warning: it is the user's responsibility to make sure the upperBnds array is large enough to contain the maximal number of expected roots. Note that nr is smaller or equal to the actual number of roots in ]a[0] ; a[1]] since roots within \tol are lumped in the same bracket. array is large enough to contain the maximal number of expected upper bounds.
Finds all REAL roots (within tolerance tol) of the d -th degree polynomial P[0] X^d + ...
- P[d-1] X + P[d] in ]a[0] ; a[1]] using Sturm's theorem ( polynomial coefficients are REAL ) and returns the count nr. All roots are bracketed in the \nr first ]upperBnds[i] - tol ; upperBnds[i]] intervals. Returns -1 if anything went wrong (such as: polynomial does not have degree d, the interval provided by the other is absurd, etc.).
intervalType specifies the search interval as follows: 0 = 00 = ]a,b[ 1 = 10 = [a,b[ 2 = 01 = ]a,b] 3 = 11 = [a,b] This defaults to 0.
The last non-zero item in the Sturm sequence is the gcd of P and P'. The parameter divideGCD specifies whether the program should attempt to divide by the gcd and run again. It works better with polynomials known to have high multiplicities. When divideGCD != 0 then it attempts to divide by the GCD, if applicable. This defaults to 0.
Constructing the Sturm sequence is O(d^2) in both time and space.
Warning: it is the user's responsibility to make sure the upperBnds array is large enough to contain the maximal number of expected roots. Note that nr is smaller or equal to the actual number of roots in ]a[0] ; a[1]] since roots within \tol are lumped in the same bracket. array is large enough to contain the maximal number of expected upper bounds.