Logo ROOT  
Reference Guide
GSLMultiRootFunctionWrapper.h
Go to the documentation of this file.
1// @(#)root/mathmore:$Id$
2// Authors: L. Moneta Dec 2006
3
4 /**********************************************************************
5 * *
6 * Copyright (c) 2004 ROOT Foundation, CERN/PH-SFT *
7 * *
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU General Public License *
10 * as published by the Free Software Foundation; either version 2 *
11 * of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this library (see file COPYING); if not, write *
20 * to the Free Software Foundation, Inc., 59 Temple Place, Suite *
21 * 330, Boston, MA 02111-1307 USA, or contact the author. *
22 * *
23 **********************************************************************/
24
25// Header file for class GSLMultiRootFunctionWrapper
26//
27// Created by: moneta at Sat Nov 13 14:54:41 2004
28//
29// Last update: Sat Nov 13 14:54:41 2004
30//
31#ifndef ROOT_Math_GSLMultiRootFunctionWrapper
32#define ROOT_Math_GSLMultiRootFunctionWrapper
33
34#include "gsl/gsl_multiroots.h"
35
37
38
39#include <cassert>
40
41namespace ROOT {
42namespace Math {
43
44
45
46// can re-use same type for multi-fit
47
48 typedef double ( * GSLMultiRootFPointer ) ( const gsl_vector *, void *, gsl_vector *);
49 typedef void ( * GSLMultiRootDfPointer ) ( const gsl_vector *, void *, gsl_matrix *);
50 typedef void ( * GSLMultiRootFdfPointer ) ( const gsl_vector *, void *, gsl_vector *, gsl_matrix *);
51
52
53/**
54 wrapper to a multi-dim function without derivatives for multi roots
55 algorithm
56
57 @ingroup MultiRoots
58*/
60
61public:
62
64 {
65 fFunc.f = 0;
66 fFunc.n = 0;
67 fFunc.params = 0;
68 }
69
70
71 /// Fill gsl function structure from a C++ function iterator and size and number of residuals
72 template<class FuncVector>
73 void SetFunctions(const FuncVector & f, unsigned int n ) {
74 const void * p = &f;
75 assert (p != 0);
77 fFunc.n = n;
78 fFunc.params = const_cast<void *>(p);
79 }
80
81 gsl_multiroot_function * GetFunctions() { return &fFunc; }
82
83
84 private:
85
86 gsl_multiroot_function fFunc;
87
88};
89
90
91/**
92 wrapper to a multi-dim function with derivatives for multi roots
93 algorithm
94
95 @ingroup MultiRoot
96*/
97
99
100public:
101
103 {
104 fFunc.f = 0;
105 fFunc.df = 0;
106 fFunc.fdf = 0;
107 fFunc.n = 0;
108 fFunc.params = 0;
109 }
110
111
112 /// Fill gsl function structure from a C++ function iterator and size and number of residuals
113 template<class FuncVector>
114 void SetFunctions(const FuncVector & f, unsigned int n ) {
115 const void * p = &f;
116 assert (p != 0);
120 fFunc.n = n;
121 fFunc.params = const_cast<void *>(p);
122 }
123
124 gsl_multiroot_function_fdf * GetFunctions() { return &fFunc; }
125
126
127 private:
128
129 gsl_multiroot_function_fdf fFunc;
130
131};
132
133
134
135} // namespace Math
136} // namespace ROOT
137
138#endif /* ROOT_Math_GSLMultiMinFunctionWrapper */
double
Definition: Converters.cxx:921
#define f(i)
Definition: RSha256.hxx:104
typedef void((*Func_t)())
wrapper to a multi-dim function with derivatives for multi roots algorithm
void SetFunctions(const FuncVector &f, unsigned int n)
Fill gsl function structure from a C++ function iterator and size and number of residuals.
Class for adapting a C++ functor class to C function pointers used by GSL MultiRoot Algorithm The tem...
wrapper to a multi-dim function without derivatives for multi roots algorithm
void SetFunctions(const FuncVector &f, unsigned int n)
Fill gsl function structure from a C++ function iterator and size and number of residuals.
const Int_t n
Definition: legend1.C:16
Namespace for new Math classes and functions.
void(* GSLMultiRootFdfPointer)(const gsl_vector *, void *, gsl_vector *, gsl_matrix *)
void(* GSLMultiRootDfPointer)(const gsl_vector *, void *, gsl_matrix *)
double(* GSLMultiRootFPointer)(const gsl_vector *, void *, gsl_vector *)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: StringConv.hxx:21