VTK
dox/Common/Math/vtkPolynomialSolversUnivariate.h
Go to the documentation of this file.
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 "vtkCommonMathModule.h" // For export macro
00055 #include "vtkObject.h"
00056 
00057 class VTKCOMMONMATH_EXPORT vtkPolynomialSolversUnivariate : public vtkObject
00058 {
00059 public:
00060   static vtkPolynomialSolversUnivariate *New();
00061   vtkTypeMacro(vtkPolynomialSolversUnivariate,vtkObject);
00062   void PrintSelf(ostream& os, vtkIndent indent);
00063   static ostream& PrintPolynomial( ostream& os, double* P, int degP );
00064 
00066 
00093   static int HabichtBisectionSolve(
00094     double* P, int d, double* a, double* upperBnds, double tol );
00095   static int HabichtBisectionSolve(
00096     double* P, int d, double* a, double* upperBnds, double tol,
00097     int intervalType );
00098   static int HabichtBisectionSolve(
00099     double* P, int d, double* a, double* upperBnds, double tol,
00100     int intervalType, bool divideGCD );
00102 
00104 
00125   static int SturmBisectionSolve(
00126     double* P, int d, double* a, double* upperBnds, double tol );
00127   static int SturmBisectionSolve(
00128     double* P, int d, double* a, double* upperBnds, double tol,
00129     int intervalType );
00130   static int SturmBisectionSolve(
00131     double* P, int d, double* a, double* upperBnds, double tol,
00132     int intervalType, bool divideGCD );
00134 
00136 
00141   static int FilterRoots(
00142     double* P, int d, double *upperBnds, int rootcount, double diameter );
00144 
00153   static int LinBairstowSolve( double* c, int d, double* r, double& tolerance );
00154 
00163   static int FerrariSolve( double* c, double* r, int* m, double tol );
00164 
00177   static int TartagliaCardanSolve( double* c, double* r, int* m, double tol );
00178 
00185   static double* SolveCubic(double c0, double c1, double c2, double c3);
00186 
00193   static double* SolveQuadratic(double c0, double c1, double c2);
00194 
00198   static double* SolveLinear(double c0, double c1);
00199 
00201 
00212   static int SolveCubic(double c0, double c1, double c2, double c3,
00213                         double *r1, double *r2, double *r3, int *num_roots);
00215 
00217 
00221   static int SolveQuadratic(double c0, double c1, double c2,
00222                             double *r1, double *r2, int *num_roots);
00224 
00230   static int SolveQuadratic( double* c, double* r, int* m );
00231 
00236   static int SolveLinear(double c0, double c1, double *r1, int *num_roots);
00237 
00239 
00243   static void SetDivisionTolerance( double tol );
00244   static double GetDivisionTolerance();
00246 
00247 protected:
00248   vtkPolynomialSolversUnivariate() {};
00249   ~vtkPolynomialSolversUnivariate() {};
00250 
00251   static double DivisionTolerance;
00252 
00253 private:
00254   vtkPolynomialSolversUnivariate(const vtkPolynomialSolversUnivariate&);  // Not implemented.
00255   void operator=(const vtkPolynomialSolversUnivariate&);  // Not implemented.
00256 };
00257 
00258 #endif