![]() |
Object-oriented Scientific Computing Library: Version 0.909
|
00001 /* 00002 ------------------------------------------------------------------- 00003 00004 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, Andrew W. Steiner 00005 00006 This file is part of O2scl. 00007 00008 O2scl is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 3 of the License, or 00011 (at your option) any later version. 00012 00013 O2scl 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 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with O2scl. If not, see <http://www.gnu.org/licenses/>. 00020 00021 ------------------------------------------------------------------- 00022 */ 00023 00024 #ifndef O2SCL_GSL_MROOT_HYBRIDS_B_H 00025 #define O2SCL_GSL_MROOT_HYBRIDS_B_H 00026 00027 #include <cmath> 00028 00029 #include <gsl/gsl_vector.h> 00030 #include <gsl/gsl_matrix.h> 00031 #include <gsl/gsl_linalg.h> 00032 00033 #ifndef DOXYGENP 00034 namespace o2scl { 00035 #endif 00036 00037 /** \brief Base functionality for the GSL hybrids solver used 00038 in \ref gsl_mroot_hybrids 00039 00040 This is a trivial recasting of the functions that were in file 00041 scope in the GSL version of the hybrids solver. 00042 */ 00043 class mroot_hybrids_base { 00044 protected: 00045 00046 /** \brief Compute the Euclidean norm of \c f 00047 00048 \future Replace this with \c dnrm2 from \ref cblas_base.h 00049 */ 00050 double enorm(const gsl_vector *f); 00051 00052 /** \brief Compute the norm of the vector \f$ \vec{v} \f$ defined 00053 by \f$ v_i = d_i f_i \f$ 00054 */ 00055 double scaled_enorm(const gsl_vector *d, const gsl_vector *f); 00056 00057 /** \brief Compute the norm of the vector \f$ \vec{v} \f$ defined 00058 by \f$ v_i = a_i + b_i \f$ 00059 */ 00060 double enorm_sum(const gsl_vector *a, const gsl_vector *b); 00061 00062 /// Compute the actual reduction 00063 double compute_actual_reduction(double fnorm, double fnorm1); 00064 00065 /// Compute the predicted reduction phi1p=|Q^T f + R dx| 00066 double compute_predicted_reduction(double fnorm, double fnorm1); 00067 00068 /** \brief Compute \f$ Q^{T} f \f$ 00069 00070 \future This is just right-multiplication, so we could 00071 use the \o2 cblas routines instead 00072 */ 00073 void compute_qtf(const gsl_matrix *q, const gsl_vector *f, 00074 gsl_vector *qtf); 00075 00076 /// Compute the Gauss-Newton direction 00077 int newton_direction(const gsl_matrix *r, const gsl_vector *qtf, 00078 gsl_vector *p); 00079 00080 /// Compute the gradient direction 00081 void gradient_direction(const gsl_matrix *r, const gsl_vector *qtf, 00082 const gsl_vector *diag, gsl_vector *g); 00083 00084 /// Compute the point at which the gradient is minimized 00085 void minimum_step(double gnorm, const gsl_vector *diag, gsl_vector *g); 00086 00087 }; 00088 00089 #ifndef DOXYGENP 00090 } 00091 #endif 00092 00093 #endif
Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).