QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.38
Loading...
Searching...
No Matches
lmdif.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2006 Klaus Spanderen
5 Copyright (C) 2015 Peter Caspers
6
7 This file is part of QuantLib, a free-software/open-source library
8 for financial quantitative analysts and developers - http://quantlib.org/
9
10 QuantLib is free software: you can redistribute it and/or modify it
11 under the terms of the QuantLib license. You should have received a
12 copy of the license along with this program; if not, please email
13 <quantlib-dev@lists.sf.net>. The license is also available online at
14 <http://quantlib.org/license.shtml>.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the license for more details.
19*/
20
21/*! \file lmdif.hpp
22 \brief wrapper for MINPACK minimization routine
23*/
24
25#ifndef quantlib_optimization_lmdif_hpp
26#define quantlib_optimization_lmdif_hpp
27
28#include <ql/types.hpp>
29#include <ql/functional.hpp>
30
31namespace QuantLib::MINPACK {
32 typedef std::function<void (int,
33 int,
34 Real*,
35 Real*,
37
38 void lmdif(int m,int n,Real* x,Real* fvec,Real ftol,
39 Real xtol,Real gtol,int maxfev,Real epsfcn,
40 Real* diag, int mode, Real factor,
41 int nprint, int* info,int* nfev,Real* fjac,
42 int ldfjac,int* ipvt,Real* qtf,
43 Real* wa1,Real* wa2,Real* wa3,Real* wa4,
44 const LmdifCostFunction& fcn,
45 const LmdifCostFunction& jacFcn);
46
47 void qrsolv(int n,
48 Real* r,
49 int ldr,
50 const int* ipvt,
51 const Real* diag,
52 const Real* qtb,
53 Real* x,
54 Real* sdiag,
55 Real* wa);
56 void qrfac(int m,int n,Real* a,int, int pivot,int* ipvt,
57 int,Real* rdiag,Real* acnorm,Real* wa);
58 }
59#endif
Maps function, bind and cref to either the boost or std implementation.
QL_REAL Real
real number
Definition: types.hpp:50
void lmdif(int m, int n, Real *x, Real *fvec, Real ftol, Real xtol, Real gtol, int maxfev, Real epsfcn, Real *diag, int mode, Real factor, int nprint, int *info, int *nfev, Real *fjac, int ldfjac, int *ipvt, Real *qtf, Real *wa1, Real *wa2, Real *wa3, Real *wa4, const QuantLib::MINPACK::LmdifCostFunction &fcn, const QuantLib::MINPACK::LmdifCostFunction &jacFcn)
Definition: lmdif.cpp:1130
void qrfac(int m, int n, Real *a, int, int pivot, int *ipvt, int, Real *rdiag, Real *acnorm, Real *wa)
Definition: lmdif.cpp:373
void qrsolv(int n, Real *r, int ldr, const int *ipvt, const Real *diag, const Real *qtb, Real *x, Real *sdiag, Real *wa)
Definition: lmdif.cpp:579
std::function< void(int, int, Real *, Real *, int *)> LmdifCostFunction
Definition: lmdif.hpp:36
ext::shared_ptr< YieldTermStructure > r
Custom types.