Simbody  3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PolynomialRootFinder.h
Go to the documentation of this file.
1 #ifndef SimTK_SimTKCOMMON_POLYNOMIALROOTFINDER_H_
2 #define SimTK_SimTKCOMMON_POLYNOMIALROOTFINDER_H_
3 
4 /* -------------------------------------------------------------------------- *
5  * Simbody(tm): SimTKcommon *
6  * -------------------------------------------------------------------------- *
7  * This is part of the SimTK biosimulation toolkit originating from *
8  * Simbios, the NIH National Center for Physics-Based Simulation of *
9  * Biological Structures at Stanford, funded under the NIH Roadmap for *
10  * Medical Research, grant U54 GM072970. See https://simtk.org/home/simbody. *
11  * *
12  * Portions copyright (c) 2007-12 Stanford University and the Authors. *
13  * Authors: Peter Eastman *
14  * Contributors: *
15  * *
16  * Licensed under the Apache License, Version 2.0 (the "License"); you may *
17  * not use this file except in compliance with the License. You may obtain a *
18  * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. *
19  * *
20  * Unless required by applicable law or agreed to in writing, software *
21  * distributed under the License is distributed on an "AS IS" BASIS, *
22  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
23  * See the License for the specific language governing permissions and *
24  * limitations under the License. *
25  * -------------------------------------------------------------------------- */
26 
27 #include "SimTKcommon/basics.h"
28 #include "SimTKcommon/Simmatrix.h"
29 
30 namespace SimTK {
31 
58 public:
66  template <class T>
67  static void findRoots(const Vec<3,T>& coefficients, Vec<2,complex<T> >& roots);
74  template <class T>
75  static void findRoots(const Vec<3,complex<T> >& coefficients, Vec<2,complex<T> >& roots);
82  template <class T>
83  static void findRoots(const Vec<4,T>& coefficients, Vec<3,complex<T> >& roots);
90  template <class T>
91  static void findRoots(const Vec<4,complex<T> >& coefficients, Vec<3,complex<T> >& roots);
98  template <class T>
99  static void findRoots(const Vector_<T>& coefficients, Vector_<complex<T> >& roots);
106  template <class T>
107  static void findRoots(const Vector_<complex<T> >& coefficients, Vector_<complex<T> >& roots);
108 };
109 
117 public:
118  ZeroLeadingCoefficient(const char* fn, int ln) : Base(fn,ln) {
119  setMessage("Attempting to find roots of a polynomial whose leading coefficient is 0.");
120  }
121  virtual ~ZeroLeadingCoefficient() throw() { }
122 };
123 
124 } // namespace SimTK
125 
126 #endif // SimTK_SimTKCOMMON_POLYNOMIALROOTFINDER_H_
ZeroLeadingCoefficient(const char *fn, int ln)
Definition: PolynomialRootFinder.h:118
#define SimTK_SimTKCOMMON_EXPORT
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:202
Base(const char *fn="<UNKNOWN>", int ln=0)
Definition: Exception.h:47
void setMessage(const std::string &msgin)
Definition: Exception.h:56
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
virtual ~ZeroLeadingCoefficient()
Definition: PolynomialRootFinder.h:121
Definition: Exception.h:45
This is a fixed-length column vector designed for no-overhead inline computation. ...
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:589
This is the header which should be included in user programs that would like to make use of all the S...
Includes internal headers providing declarations for the basic SimTK Core classes.
This is an exception which is thrown by all of the PolynomialRootFinder::findRoots() methods...
Definition: PolynomialRootFinder.h:116
This class provides static methods for finding the roots of polynomials.
Definition: PolynomialRootFinder.h:57