Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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*/
58
59public:
60
62 {
63 fFunc.f = nullptr;
64 fFunc.n = 0;
65 fFunc.params = nullptr;
66 }
67
68
69 /// Fill gsl function structure from a C++ function iterator and size and number of residuals
70 template<class FuncVector>
71 void SetFunctions(const FuncVector & f, unsigned int n ) {
72 const void * p = &f;
73 assert (p != nullptr);
75 fFunc.n = n;
76 fFunc.params = const_cast<void *>(p);
77 }
78
79 gsl_multiroot_function * GetFunctions() { return &fFunc; }
80
81
82 private:
83
84 gsl_multiroot_function fFunc;
85
86};
87
88
89/**
90 wrapper to a multi-dim function with derivatives for multi roots
91 algorithm
92
93 @ingroup MultiRoot
94*/
95
97
98public:
99
101 {
102 fFunc.f = nullptr;
103 fFunc.df = nullptr;
104 fFunc.fdf = nullptr;
105 fFunc.n = 0;
106 fFunc.params = nullptr;
107 }
108
109
110 /// Fill gsl function structure from a C++ function iterator and size and number of residuals
111 template<class FuncVector>
112 void SetFunctions(const FuncVector & f, unsigned int n ) {
113 const void * p = &f;
114 assert (p != nullptr);
118 fFunc.n = n;
119 fFunc.params = const_cast<void *>(p);
120 }
121
122 gsl_multiroot_function_fdf * GetFunctions() { return &fFunc; }
123
124
125 private:
126
127 gsl_multiroot_function_fdf fFunc;
128
129};
130
131
132
133} // namespace Math
134} // namespace ROOT
135
136#endif /* ROOT_Math_GSLMultiMinFunctionWrapper */
#define f(i)
Definition RSha256.hxx:104
winID h TVirtualViewer3D TVirtualGLPainter p
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...