Logo ROOT   6.18/05
Reference Guide
RootFinderAlgorithms.cxx
Go to the documentation of this file.
1// @(#)root/mathmore:$Id$
2// Authors: L. Moneta, A. Zsenei 08/2005
3
4 /**********************************************************************
5 * *
6 * Copyright (c) 2004 ROOT Foundation, CERN/PH-SFT *
7 * *
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU General Public License *
10 * as published by the Free Software Foundation; either version 2 *
11 * of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this library (see file COPYING); if not, write *
20 * to the Free Software Foundation, Inc., 59 Temple Place, Suite *
21 * 330, Boston, MA 02111-1307 USA, or contact the author. *
22 * *
23 **********************************************************************/
24
25// Implementation file for class GSLRootFinderAlgorithms
26//
27// Created by: moneta at Sun Nov 14 14:07:50 2004
28//
29// Last update: Sun Nov 14 14:07:50 2004
30//
31
33#include "GSLRootFSolver.h"
34#include "GSLRootFdFSolver.h"
35
36#include "gsl/gsl_roots.h"
37
38namespace ROOT {
39namespace Math {
40
41
42namespace Roots {
43
44
45
47{
48 // Bisection constructor
49 GSLRootFSolver * s = new GSLRootFSolver( gsl_root_fsolver_bisection );
50 SetSolver(s);
51}
52
54{
55 // destructor
56 FreeSolver();
57}
58
60{
61 // dummy copy ctr
62}
63
65{
66 // dummy (private) operator=
67 if (this == &rhs) return *this; // time saving self-test
68 return *this;
69}
70
71
72// falsepos method
73
75{
76 // FalsePos constructor
77 GSLRootFSolver * s = new GSLRootFSolver( gsl_root_fsolver_falsepos );
78 SetSolver(s);
79}
80
82{
83 // destructor
84 FreeSolver();
85}
86
88{
89 // dummy copy ctr
90}
91
93{
94 // dummy (private) operator=
95 if (this == &rhs) return *this; // time saving self-test
96 return *this;
97}
98
99// Brent method
100
102{
103 // Brent constructor
104 GSLRootFSolver * s = new GSLRootFSolver( gsl_root_fsolver_brent );
105 SetSolver(s);
106}
107
109{
110 // destructor
111 FreeSolver();
112}
113
115{
116 // dummy copy ctr
117}
118
120{
121 // dummy (private) operator=
122 if (this == &rhs) return *this; // time saving self-test
123 return *this;
124}
125
126
127//---------------------------------------------------------------------
128// algorithms with Derivatives
129//--------------------------------------------------------------------
130
131// Newton
132
134{
135 // Newton constructor
136 GSLRootFdFSolver * s = new GSLRootFdFSolver( gsl_root_fdfsolver_newton );
137 SetSolver(s);
138}
139
141{
142 // destructor
143 FreeSolver();
144}
145
147{
148 // dummy copy ctr
149}
150
152{
153 // dummy (private) operator=
154 if (this == &rhs) return *this; // time saving self-test
155 return *this;
156}
157
158// Secant
159
161{
162 // Secant constructor
163 GSLRootFdFSolver * s = new GSLRootFdFSolver( gsl_root_fdfsolver_secant );
164 SetSolver(s);
165}
166
168{
169 // destructor
170 FreeSolver();
171}
172
174{
175 // dummy copy ctr
176}
177
179{
180 // dummy (private) operator=
181 if (this == &rhs) return *this; // time saving self-test
182 return *this;
183}
184
185// Steffenson
186
188{
189 // Steffenson constructor
190 GSLRootFdFSolver * s = new GSLRootFdFSolver( gsl_root_fdfsolver_steffenson );
191 SetSolver(s);
192}
193
195{
196 // destructor
197 FreeSolver();
198}
199
201{
202 // dummy copy ctr
203}
204
206{
207 // dummy (private) operator=
208 if (this == &rhs) return *this; // time saving self-test
209 return *this;
210}
211
212
213
214} // end namespace GSLRoots
215
216} // namespace Math
217} // namespace ROOT
Root-Finder implementation class using GSL.
Root-Finder with derivatives implementation class using GSL.
Base class for GSL Root-Finding algorithms for one dimensional functions which use function derivativ...
void SetSolver(GSLRootFdFSolver *s)
Base class for GSL Root-Finding algorithms for one dimensional functions which do not use function de...
Definition: GSLRootFinder.h:73
void SetSolver(GSLRootFSolver *s)
Roots::Bisection Bisection algorithm, simplest algorithm for bracketing the roots of a function,...
Bisection & operator=(const Bisection &)
Brent-Dekker algorithm which combines an interpolation strategy with the bisection algorithm See the ...
Brent & operator=(const Brent &)
False Position algorithm based on linear interpolation.
FalsePos & operator=(const FalsePos &)
a Newton algorithm, which computes the derivative at each iteration See the GSL manual for more infor...
Newton & operator=(const Newton &)
Secant algorithm, simplified version of Newton method, which does not require the derivative at every...
Secant & operator=(const Secant &)
Steffenson method, providing the fastes convergence.
Steffenson & operator=(const Steffenson &)
Namespace for new Math classes and functions.
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
static constexpr double s