00001 // @(#)root/mathmore:$Id: RootFinderAlgorithms.cxx 20882 2007-11-19 11:31:26Z rdm $ 00002 // Authors: L. Moneta, A. Zsenei 08/2005 00003 00004 /********************************************************************** 00005 * * 00006 * Copyright (c) 2004 ROOT Foundation, CERN/PH-SFT * 00007 * * 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU General Public License * 00010 * as published by the Free Software Foundation; either version 2 * 00011 * of the License, or (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU General Public License * 00019 * along with this library (see file COPYING); if not, write * 00020 * to the Free Software Foundation, Inc., 59 Temple Place, Suite * 00021 * 330, Boston, MA 02111-1307 USA, or contact the author. * 00022 * * 00023 **********************************************************************/ 00024 00025 // Implementation file for class GSLRootFinderAlgorithms 00026 // 00027 // Created by: moneta at Sun Nov 14 14:07:50 2004 00028 // 00029 // Last update: Sun Nov 14 14:07:50 2004 00030 // 00031 00032 #include "Math/RootFinderAlgorithms.h" 00033 #include "GSLRootFSolver.h" 00034 #include "GSLRootFdFSolver.h" 00035 00036 #include "gsl/gsl_roots.h" 00037 00038 namespace ROOT { 00039 namespace Math { 00040 00041 00042 namespace Roots { 00043 00044 00045 00046 Bisection::Bisection() 00047 { 00048 // Bisection constructor 00049 GSLRootFSolver * s = new GSLRootFSolver( gsl_root_fsolver_bisection ); 00050 SetSolver(s); 00051 } 00052 00053 Bisection::~Bisection() 00054 { 00055 // destructor 00056 FreeSolver(); 00057 } 00058 00059 Bisection::Bisection(const Bisection &) : GSLRootFinder() 00060 { 00061 // dummy copy ctr 00062 } 00063 00064 Bisection & Bisection::operator = (const Bisection &rhs) 00065 { 00066 // dummy (private) operator= 00067 if (this == &rhs) return *this; // time saving self-test 00068 return *this; 00069 } 00070 00071 00072 // falsepos method 00073 00074 FalsePos::FalsePos() 00075 { 00076 // FalsePos constructor 00077 GSLRootFSolver * s = new GSLRootFSolver( gsl_root_fsolver_falsepos ); 00078 SetSolver(s); 00079 } 00080 00081 FalsePos::~FalsePos() 00082 { 00083 // destructor 00084 FreeSolver(); 00085 } 00086 00087 FalsePos::FalsePos(const FalsePos &) : GSLRootFinder() 00088 { 00089 // dummy copy ctr 00090 } 00091 00092 FalsePos & FalsePos::operator = (const FalsePos &rhs) 00093 { 00094 // dummy (private) operator= 00095 if (this == &rhs) return *this; // time saving self-test 00096 return *this; 00097 } 00098 00099 // Brent method 00100 00101 Brent::Brent() 00102 { 00103 // Brent constructor 00104 GSLRootFSolver * s = new GSLRootFSolver( gsl_root_fsolver_brent ); 00105 SetSolver(s); 00106 } 00107 00108 Brent::~Brent() 00109 { 00110 // destructor 00111 FreeSolver(); 00112 } 00113 00114 Brent::Brent(const Brent &) : GSLRootFinder() 00115 { 00116 // dummy copy ctr 00117 } 00118 00119 Brent & Brent::operator = (const Brent &rhs) 00120 { 00121 // dummy (private) operator= 00122 if (this == &rhs) return *this; // time saving self-test 00123 return *this; 00124 } 00125 00126 00127 //--------------------------------------------------------------------- 00128 // algorithms with Derivatives 00129 //-------------------------------------------------------------------- 00130 00131 // Newton 00132 00133 Newton::Newton() 00134 { 00135 // Newton constructor 00136 GSLRootFdFSolver * s = new GSLRootFdFSolver( gsl_root_fdfsolver_newton ); 00137 SetSolver(s); 00138 } 00139 00140 Newton::~Newton() 00141 { 00142 // destructor 00143 FreeSolver(); 00144 } 00145 00146 Newton::Newton(const Newton &) : GSLRootFinderDeriv() 00147 { 00148 // dummy copy ctr 00149 } 00150 00151 Newton & Newton::operator = (const Newton &rhs) 00152 { 00153 // dummy (private) operator= 00154 if (this == &rhs) return *this; // time saving self-test 00155 return *this; 00156 } 00157 00158 // Secant 00159 00160 Secant::Secant() 00161 { 00162 // Secant constructor 00163 GSLRootFdFSolver * s = new GSLRootFdFSolver( gsl_root_fdfsolver_secant ); 00164 SetSolver(s); 00165 } 00166 00167 Secant::~Secant() 00168 { 00169 // destructor 00170 FreeSolver(); 00171 } 00172 00173 Secant::Secant(const Secant &) : GSLRootFinderDeriv() 00174 { 00175 // dummy copy ctr 00176 } 00177 00178 Secant & Secant::operator = (const Secant &rhs) 00179 { 00180 // dummy (private) operator= 00181 if (this == &rhs) return *this; // time saving self-test 00182 return *this; 00183 } 00184 00185 // Steffenson 00186 00187 Steffenson::Steffenson() 00188 { 00189 // Steffenson constructor 00190 GSLRootFdFSolver * s = new GSLRootFdFSolver( gsl_root_fdfsolver_steffenson ); 00191 SetSolver(s); 00192 } 00193 00194 Steffenson::~Steffenson() 00195 { 00196 // destructor 00197 FreeSolver(); 00198 } 00199 00200 Steffenson::Steffenson(const Steffenson &) : GSLRootFinderDeriv() 00201 { 00202 // dummy copy ctr 00203 } 00204 00205 Steffenson & Steffenson::operator = (const Steffenson &rhs) 00206 { 00207 // dummy (private) operator= 00208 if (this == &rhs) return *this; // time saving self-test 00209 return *this; 00210 } 00211 00212 00213 00214 } // end namespace GSLRoots 00215 00216 } // namespace Math 00217 } // namespace ROOT