gsl_mroot_hybrids_b.h

00001 /*
00002   -------------------------------------------------------------------
00003   
00004   Copyright (C) 2006, 2007, 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 functions for 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       \todo Document the individual functions for this class
00044   
00045   */
00046   class hybrids_base {
00047   protected:
00048 
00049     /// Compute the norm of \c f
00050     double enorm(const gsl_vector *f);
00051 
00052     /// Compute the norm of \f$ \vec{f} \cdot \vec{d} \f$
00053     double scaled_enorm(const gsl_vector *d, const gsl_vector *f);
00054 
00055     /// Compute the norm of \f$ \vec{a} + \vec{b} \f$.
00056     double enorm_sum(const gsl_vector *a, const gsl_vector *b);
00057   
00058     /// Desc.
00059     void compute_wv(const gsl_vector *qtdf, const gsl_vector *rdx, 
00060                     const gsl_vector *dx, const gsl_vector *diag, 
00061                     double pnorm, gsl_vector *w, gsl_vector *v);
00062     
00063     /// Desc.
00064     void compute_df(const gsl_vector *f_trial, const gsl_vector *f, 
00065                     gsl_vector *df);
00066     
00067     /// Desc.
00068     void compute_diag(const gsl_matrix *J, gsl_vector *diag);
00069 
00070     /// Desc.
00071     void update_diag(const gsl_matrix *J, gsl_vector *diag);
00072 
00073     /// Desc.
00074     double compute_delta(gsl_vector *diag, gsl_vector *x);
00075 
00076     /// Desc.
00077     double compute_actual_reduction(double fnorm, double fnorm1);
00078 
00079     /// Desc.
00080     double compute_predicted_reduction(double fnorm, double fnorm1);
00081 
00082     /// Compute \f$ Q^{T} f \f$
00083     void compute_qtf(const gsl_matrix *q, const gsl_vector *f, 
00084                      gsl_vector *qtf);
00085 
00086     /// Desc.
00087     void compute_rdx(const gsl_matrix *r, const gsl_vector *dx, 
00088                      gsl_vector *rdx);
00089 
00090     /// Desc.
00091     void compute_trial_step(gsl_vector *x, gsl_vector *dx, 
00092                             gsl_vector *x_trial);
00093 
00094     /// Desc.
00095     int newton_direction(const gsl_matrix *r, const gsl_vector *qtf, 
00096                          gsl_vector *p);
00097 
00098     /// Desc.
00099     void gradient_direction(const gsl_matrix *r, const gsl_vector *qtf,
00100                             const gsl_vector *diag, gsl_vector *g);
00101 
00102     /// Desc.
00103     void minimum_step(double gnorm, const gsl_vector *diag, gsl_vector *g);
00104 
00105 
00106     /// Desc.
00107     void compute_Rg(const gsl_matrix *r, const gsl_vector *gradient, 
00108                     gsl_vector *Rg);
00109 
00110     /// Desc.
00111     void scaled_addition(double alpha, gsl_vector *newton, double beta, 
00112                          gsl_vector *gradient, gsl_vector *p);
00113 
00114     /// Take a dogleg step
00115     int dogleg(const gsl_matrix *r, const gsl_vector *qtf,
00116                const gsl_vector *diag, double delta,
00117                gsl_vector *newton, gsl_vector *gradient, gsl_vector *p);
00118 
00119   };
00120   
00121 #ifndef DOXYGENP
00122 }
00123 #endif
00124 
00125 #endif

Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.

Project hosting provided by SourceForge.net Logo, O2scl Sourceforge Project Page