Gaudi Framework, version v20r4

Generated: 8 Jan 2009

EqSolver.cpp File Reference


Detailed Description

Implementation file for class : EqSolver.

See also:
EqSolver.h
Author:
Kirill Miklyaev kirillm@iris1.itep.ru
Date:
2002-09-14

Definition in file EqSolver.cpp.

#include <stdlib.h>
#include <stdio.h>
#include "GaudiKernel/ToolFactory.h"
#include "GaudiKernel/MsgStream.h"
#include "gsl/gsl_vector.h"
#include "gsl/gsl_multimin.h"
#include "gsl/gsl_math.h"
#include "gsl/gsl_matrix.h"
#include "gsl/gsl_linalg.h"
#include "gsl/gsl_blas.h"
#include "gsl/gsl_errno.h"
#include "EqSolver.h"

Include dependency graph for EqSolver.cpp:

Go to the source code of this file.

Functions

int fun_gsl (const gsl_vector *v, void *params, gsl_vector *f)
 The function which we solver.
int dfun_gsl (const gsl_vector *v, void *params, gsl_matrix *df)
 The gradient of the function "fun_gsl".
int fdfun_gsl (const gsl_vector *v, void *params, gsl_vector *f, gsl_matrix *df)
 Compute both the function "fun_gsl" and gradient of this function "dfun_gsl" together.


Function Documentation

int @121::dfun_gsl ( const gsl_vector *  v,
void *  params,
gsl_matrix *  df 
) [static]

The gradient of the function "fun_gsl".

Definition at line 127 of file EqSolver.cpp.

00130   {
00131     EqSolver::EqSolverMisc* local = 
00132       static_cast <EqSolver::EqSolverMisc*> (params);
00133     const EqSolver::Jacobi&     jac = local -> jacobi()    ;
00134     Argument&                   arg = local -> argument()  ;
00135     
00136     {for ( unsigned int i = 0; i < v->size; ++i)
00137       {
00138         arg[i] = gsl_vector_get (v, i);
00139       }
00140     }
00141     
00142     {for( unsigned int i = 0 ; i < v->size ; ++i )
00143       {
00144         for (unsigned int j = 0; j < v->size; ++j)
00145           {
00146             Genfun::GENFUNCTION  f = *(jac[i][j]) ;
00147             gsl_matrix_set      ( df , i , j , f ( arg ) ) ;
00148           }
00149       }
00150     }
00151     return GSL_SUCCESS;
00152   }

int @121::fdfun_gsl ( const gsl_vector *  v,
void *  params,
gsl_vector *  f,
gsl_matrix *  df 
) [static]

Compute both the function "fun_gsl" and gradient of this function "dfun_gsl" together.

Definition at line 157 of file EqSolver.cpp.

00161   {
00162     EqSolver::EqSolverMisc* local = 
00163       static_cast <EqSolver::EqSolverMisc*> (params);
00164     const EqSolver::Equations&  eqs = *(local->equations()) ;
00165     const EqSolver::Jacobi&     jac = local->jacobi()    ;
00166     Argument&                   arg = local->argument()  ;
00167     
00168     {for ( unsigned int i = 0; i < v->size; ++i)
00169       {
00170         arg[i] = gsl_vector_get (v, i);
00171       }
00172     }
00173     
00174     {for( unsigned int i = 0 ; i < v->size ; ++i )
00175       {
00176         gsl_vector_set(f, i, (*eqs[i])(arg ) ) ; 
00177         for (unsigned int j = 0; j < v->size; ++j)
00178           {
00179             Genfun::GENFUNCTION  f = *(jac[i][j]) ;
00180             gsl_matrix_set      ( df , i , j , f(arg) ) ;
00181           }
00182       }
00183     }
00184     return GSL_SUCCESS;
00185   }

int @121::fun_gsl ( const gsl_vector *  v,
void *  params,
gsl_vector *  f 
) [static]

The function which we solver.

Definition at line 101 of file EqSolver.cpp.

00104   {
00105     EqSolver::EqSolverMisc* local = 
00106       static_cast <EqSolver::EqSolverMisc*> (params);
00107     const EqSolver::Equations& eqs = *(local->equations()) ;
00108     Argument&                  arg = local->argument()  ;
00109     
00110     {for ( unsigned int i = 0; i < v->size; ++i)
00111       {
00112         arg[i] = gsl_vector_get (v, i);
00113       }
00114     }
00115     
00116     {for ( unsigned int i = 0; i < v->size; ++i)
00117       {
00118         gsl_vector_set(f, i, (*eqs[i])(arg));
00119       }
00120     }
00121     return GSL_SUCCESS;
00122   }


Generated at Thu Jan 8 17:45:42 2009 for Gaudi Framework, version v20r4 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004