00001 /* 00002 ------------------------------------------------------------------- 00003 00004 Copyright (C) 2006, 2007, 2008, 2009, 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 /** 00038 \brief Base functionality for the GSL hybrids solver used 00039 in \ref gsl_mroot_hybrids 00040 00041 This is a trivial recasting of the functions that were in file 00042 scope in the GSL version of the hybrids solver. 00043 */ 00044 class mroot_hybrids_base { 00045 protected: 00046 00047 /** \brief Compute the Euclidean norm of \c f 00048 00049 \future Replace this with \c dnrm2 from \ref cblas_base.h 00050 */ 00051 double enorm(const gsl_vector *f); 00052 00053 /** \brief Compute the norm of the vector \f$ \vec{v} \f$ defined 00054 by \f$ v_i = d_i f_i \f$ 00055 */ 00056 double scaled_enorm(const gsl_vector *d, const gsl_vector *f); 00057 00058 /** \brief Compute the norm of the vector \f$ \vec{v} \f$ defined 00059 by \f$ v_i = a_i + b_i \f$ 00060 */ 00061 double enorm_sum(const gsl_vector *a, const gsl_vector *b); 00062 00063 /// Compute the actual reduction 00064 double compute_actual_reduction(double fnorm, double fnorm1); 00065 00066 /// Compute the predicted reduction phi1p=|Q^T f + R dx| 00067 double compute_predicted_reduction(double fnorm, double fnorm1); 00068 00069 /** \brief Compute \f$ Q^{T} f \f$ 00070 00071 \future This is just right-multiplication, so we could 00072 use the \o2 cblas routines instead 00073 */ 00074 void compute_qtf(const gsl_matrix *q, const gsl_vector *f, 00075 gsl_vector *qtf); 00076 00077 /// Compute the Gauss-Newton direction 00078 int newton_direction(const gsl_matrix *r, const gsl_vector *qtf, 00079 gsl_vector *p); 00080 00081 /// Compute the gradient direction 00082 void gradient_direction(const gsl_matrix *r, const gsl_vector *qtf, 00083 const gsl_vector *diag, gsl_vector *g); 00084 00085 /// Compute the point at which the gradient is minimized 00086 void minimum_step(double gnorm, const gsl_vector *diag, gsl_vector *g); 00087 00088 00089 }; 00090 00091 #ifndef DOXYGENP 00092 } 00093 #endif 00094 00095 #endif
Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.
Project hosting provided by
,
O2scl Sourceforge Project Page