yat/utility/multivariable/f.h

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