00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00051 #ifndef __vtkPolynomialSolversUnivariate_h
00052 #define __vtkPolynomialSolversUnivariate_h
00053
00054 #include "vtkObject.h"
00055
00056 class VTK_COMMON_EXPORT vtkPolynomialSolversUnivariate : public vtkObject
00057 {
00058 public:
00059 static vtkPolynomialSolversUnivariate *New();
00060 vtkTypeMacro(vtkPolynomialSolversUnivariate,vtkObject);
00061 void PrintSelf(ostream& os, vtkIndent indent);
00062 static ostream& PrintPolynomial( ostream& os, double* P, int degP );
00063
00065
00092 static int HabichtBisectionSolve(
00093 double* P, int d, double* a, double* upperBnds, double tol );
00094 static int HabichtBisectionSolve(
00095 double* P, int d, double* a, double* upperBnds, double tol,
00096 int intervalType );
00097 static int HabichtBisectionSolve(
00098 double* P, int d, double* a, double* upperBnds, double tol,
00099 int intervalType, bool divideGCD );
00101
00103
00124 static int SturmBisectionSolve(
00125 double* P, int d, double* a, double* upperBnds, double tol );
00126 static int SturmBisectionSolve(
00127 double* P, int d, double* a, double* upperBnds, double tol,
00128 int intervalType );
00129 static int SturmBisectionSolve(
00130 double* P, int d, double* a, double* upperBnds, double tol,
00131 int intervalType, bool divideGCD );
00133
00135
00140 static int FilterRoots(
00141 double* P, int d, double *upperBnds, int rootcount, double diameter );
00143
00152 static int LinBairstowSolve( double* c, int d, double* r, double& tolerance );
00153
00162 static int FerrariSolve( double* c, double* r, int* m, double tol );
00163
00176 static int TartagliaCardanSolve( double* c, double* r, int* m, double tol );
00177
00184 static double* SolveCubic(double c0, double c1, double c2, double c3);
00185
00192 static double* SolveQuadratic(double c0, double c1, double c2);
00193
00197 static double* SolveLinear(double c0, double c1);
00198
00200
00211 static int SolveCubic(double c0, double c1, double c2, double c3,
00212 double *r1, double *r2, double *r3, int *num_roots);
00214
00216
00220 static int SolveQuadratic(double c0, double c1, double c2,
00221 double *r1, double *r2, int *num_roots);
00223
00229 static int SolveQuadratic( double* c, double* r, int* m );
00230
00235 static int SolveLinear(double c0, double c1, double *r1, int *num_roots);
00236
00238
00242 static void SetDivisionTolerance( double tol );
00243 static double GetDivisionTolerance();
00245
00246 protected:
00247 vtkPolynomialSolversUnivariate() {};
00248 ~vtkPolynomialSolversUnivariate() {};
00249
00250 static double DivisionTolerance;
00251
00252 private:
00253 vtkPolynomialSolversUnivariate(const vtkPolynomialSolversUnivariate&);
00254 void operator=(const vtkPolynomialSolversUnivariate&);
00255 };
00256
00257 #ifndef DBL_EPSILON
00258 # define VTK_DBL_EPSILON 2.2204460492503131e-16
00259 #else // DBL_EPSILON
00260 # define VTK_DBL_EPSILON DBL_EPSILON
00261 #endif // DBL_EPSILON
00262
00263 #ifndef DBL_MIN
00264 # define VTK_DBL_MIN 2.2250738585072014e-308
00265 #else // DBL_MIN
00266 # define VTK_DBL_MIN DBL_MIN
00267 #endif // DBL_MIN
00268
00269 #endif