Line data Source code
1 : /** \file templateLevmar.cpp
2 : * \author Jared R. Males (jaredmales@gmail.com)
3 : * \brief Templatized wrappers to the levmar minimization routines (definitions).
4 : * \ingroup fitting_files
5 : *
6 : */
7 :
8 : //***********************************************************************//
9 : // Copyright 2020 Jared R. Males (jaredmales@gmail.com)
10 : //
11 : // This file is part of mxlib.
12 : //
13 : // mxlib is free software: you can redistribute it and/or modify
14 : // it under the terms of the GNU General Public License as published by
15 : // the Free Software Foundation, either version 3 of the License, or
16 : // (at your option) any later version.
17 : //
18 : // mxlib is distributed in the hope that it will be useful,
19 : // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 : // GNU General Public License for more details.
22 : //
23 : // You should have received a copy of the GNU General Public License
24 : // along with mxlib. If not, see <http://www.gnu.org/licenses/>.
25 : //***********************************************************************//
26 :
27 : #include "math/fit/templateLevmar.hpp"
28 :
29 : extern "C"
30 : {
31 : #include "../../vendor/levmar-2.6/levmar.h"
32 : }
33 :
34 : namespace mx
35 : {
36 : namespace math
37 : {
38 : namespace fit
39 : {
40 :
41 : template <>
42 8 : int levmar_dif<double>( void ( *func )( double *p, double *hx, int m, int n, void *adata ),
43 : double *p,
44 : double *x,
45 : int m,
46 : int n,
47 : int itmax,
48 : double *opts,
49 : double *info,
50 : double *work,
51 : double *covar,
52 : void *adata )
53 : {
54 8 : return dlevmar_dif( func, p, x, m, n, itmax, opts, info, work, covar, adata );
55 : }
56 :
57 : template <>
58 0 : int levmar_dif<float>( void ( *func )( float *p, float *hx, int m, int n, void *adata ),
59 : float *p,
60 : float *x,
61 : int m,
62 : int n,
63 : int itmax,
64 : float *opts,
65 : float *info,
66 : float *work,
67 : float *covar,
68 : void *adata )
69 : {
70 0 : return slevmar_dif( func, p, x, m, n, itmax, opts, info, work, covar, adata );
71 : }
72 :
73 : template <>
74 0 : int levmar_der<double>( void ( *func )( double *p, double *hx, int m, int n, void *adata ),
75 : void ( *jacf )( double *p, double *j, int m, int n, void *adata ),
76 : double *p,
77 : double *x,
78 : int m,
79 : int n,
80 : int itmax,
81 : double *opts,
82 : double *info,
83 : double *work,
84 : double *covar,
85 : void *adata )
86 : {
87 0 : return dlevmar_der( func, jacf, p, x, m, n, itmax, opts, info, work, covar, adata );
88 : }
89 :
90 : template <>
91 0 : int levmar_der<float>( void ( *func )( float *p, float *hx, int m, int n, void *adata ),
92 : void ( *jacf )( float *p, float *j, int m, int n, void *adata ),
93 : float *p,
94 : float *x,
95 : int m,
96 : int n,
97 : int itmax,
98 : float *opts,
99 : float *info,
100 : float *work,
101 : float *covar,
102 : void *adata )
103 : {
104 0 : return slevmar_der( func, jacf, p, x, m, n, itmax, opts, info, work, covar, adata );
105 : }
106 :
107 : } // namespace fit
108 : } // namespace math
109 : } // namespace mx
|