yat  0.21pre
df.h
1 #ifndef theplu_yat_utility_univariable_df
2 #define theplu_yat_utility_univariable_df
3 
4 // $Id: df.h 4239 2022-09-18 03:17:13Z peter $
5 
6 /*
7  Copyright (C) 2022 Peter Johansson
8 
9  This file is part of the yat library, http://dev.thep.lu.se/yat
10 
11  The yat library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License as
13  published by the Free Software Foundation; either version 3 of the
14  License, or (at your option) any later version.
15 
16  The yat library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with yat. If not, see <https://www.gnu.org/licenses/>.
23 */
24 
25 namespace theplu {
26 namespace yat {
27 namespace utility {
28 
29  namespace univariable
30  {
31  template<class FUNC>
32  double df(double x, void* params)
33  {
34  FUNC* func = static_cast<FUNC*>(params);
35  return func->derivative(x);
36  }
37 
38  template<class FUNC>
39  void fdf(double x, void* params, double* f, double* df)
40  {
41  FUNC* func = static_cast<FUNC*>(params);
42  *f = (*func)(x);
43  *df = func->derivative(x);
44  }
45  } // end namespace univariable
46 
47 }}} // end namespaces utility, yat and theplu
48 #endif
The Department of Theoretical Physics namespace as we define it.

Generated on Wed Jan 25 2023 03:34:29 for yat by  doxygen 1.8.14