| # Gaudi Framework, version v21r11 |

Home |  | Generated: 30 Sep 2010

# EqSolver.cpp File Reference

Implementation file for class : EqSolver. More...

`#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.

## 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.

## Function Documentation

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

The gradient of the function "fun_gsl".

Definition at line 125 of file EqSolver.cpp.

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

int @120::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 155 of file EqSolver.cpp.

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

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

The function which we solver.

Definition at line 99 of file EqSolver.cpp.

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