VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkPolynomialSolversUnivariate.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 ========================================================================= 00015 Copyright 2011 Sandia Corporation. 00016 Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00017 license for use of this work by or on behalf of the 00018 U.S. Government. Redistribution and use in source and binary forms, with 00019 or without modification, are permitted provided that this Notice and any 00020 statement of authorship are reproduced on all copies. 00021 00022 Contact: pppebay@sandia.gov,dcthomp@sandia.gov 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&); // Not implemented. 00254 void operator=(const vtkPolynomialSolversUnivariate&); // Not implemented. 00255 }; 00256 00257 #endif