Scythe-1.0.3
|
Definitions of functions for doing numerical optimization and related operations. More...
#include "scythestat/matrix.h"
#include "scythestat/algorithm.h"
#include "scythestat/error.h"
#include "scythestat/rng.h"
#include "scythestat/distributions.h"
#include "scythestat/la.h"
#include "scythestat/ide.h"
#include "scythestat/smath.h"
#include "scythestat/stat.h"
Go to the source code of this file.
Namespaces | |
namespace | scythe |
The Scythe library namespace. | |
Functions | |
template<typename T > | |
T | scythe::epsilon () |
Compute the machine epsilon. | |
template<typename T , typename FUNCTOR > | |
T | scythe::intsimp (FUNCTOR fun, T a, T b, unsigned int N) |
Calculate the definite integral of a function from a to b. | |
template<typename T , typename FUNCTOR > | |
T | scythe::adaptsimp (FUNCTOR fun, T a, T b, unsigned int N, double tol=1e-5) |
Calculate the definite integral of a function from a to b. | |
template<matrix_order RO, matrix_style RS, typename T , matrix_order PO, matrix_style PS, typename FUNCTOR > | |
Matrix< T, RO, RS > | scythe::gradfdif (FUNCTOR fun, const Matrix< T, PO, PS > &theta) |
Calculate gradient of a function using a forward difference formula. | |
template<typename T , matrix_order O, matrix_style S, typename FUNCTOR > | |
Matrix< T, O, Concrete > | scythe::gradfdif (FUNCTOR fun, const Matrix< T, O, S > &theta) |
template<typename T , matrix_order PO1, matrix_style PS1, matrix_order PO2, matrix_style PS2, typename FUNCTOR > | |
T | scythe::gradfdifls (FUNCTOR fun, T alpha, const Matrix< T, PO1, PS1 > &theta, const Matrix< T, PO2, PS2 > &p) |
Calculate the first derivative of the function using a forward difference formula. | |
template<matrix_order RO, matrix_style RS, typename T , matrix_order PO, matrix_style PS, typename FUNCTOR > | |
Matrix< T, RO, RS > | scythe::jacfdif (FUNCTOR fun, const Matrix< T, PO, PS > &theta) |
Calculate the Jacobian of a function using a forward difference formula. | |
template<typename T , matrix_order PO, matrix_style PS, typename FUNCTOR > | |
Matrix< T, PO, PS > | scythe::jacfdif (FUNCTOR fun, const Matrix< T, PO, PS > &theta) |
template<matrix_order RO, matrix_style RS, typename T , matrix_order PO, matrix_style PS, typename FUNCTOR > | |
Matrix< T, RO, RS > | scythe::hesscdif (FUNCTOR fun, const Matrix< T, PO, PS > &theta) |
Calculate the Hessian of a function using a central difference formula. | |
template<typename T , matrix_order PO, matrix_style PS, typename FUNCTOR > | |
Matrix< T, PO, PS > | scythe::hesscdif (FUNCTOR fun, const Matrix< T, PO, PS > &theta) |
template<typename T , matrix_order PO1, matrix_style PS1, matrix_order PO2, matrix_style PS2, typename FUNCTOR > | |
T | scythe::linesearch1 (FUNCTOR fun, const Matrix< T, PO1, PS1 > &theta, const Matrix< T, PO2, PS2 > &p) |
Find the step length that minimizes an implied 1-dimensional function. | |
template<typename T , matrix_order PO1, matrix_style PS1, matrix_order PO2, matrix_style PS2, typename FUNCTOR , typename RNGTYPE > | |
T | scythe::linesearch2 (FUNCTOR fun, const Matrix< T, PO1, PS1 > &theta, const Matrix< T, PO2, PS2 > &p, rng< RNGTYPE > &runif) |
Find the step length that minimizes an implied 1-dimensional function. | |
template<typename T , matrix_order PO1, matrix_style PS1, matrix_order PO2, matrix_style PS2, typename FUNCTOR > | |
T | scythe::zoom (FUNCTOR fun, T alpha_lo, T alpha_hi, const Matrix< T, PO1, PS1 > &theta, const Matrix< T, PO2, PS2 > &p) |
Find minimum of a function once bracketed. | |
template<matrix_order RO, matrix_style RS, typename T , matrix_order PO, matrix_style PS, typename FUNCTOR , typename RNGTYPE > | |
Matrix< T, RO, RS > | scythe::BFGS (FUNCTOR fun, const Matrix< T, PO, PS > &theta, rng< RNGTYPE > &runif, unsigned int maxit, T tolerance, bool trace=false) |
Find function minimum using the BFGS algorithm. | |
template<typename T , matrix_order O, matrix_style S, typename FUNCTOR , typename RNGTYPE > | |
Matrix< T, O, Concrete > | scythe::BFGS (FUNCTOR fun, const Matrix< T, O, S > &theta, rng< RNGTYPE > &runif, unsigned int maxit, T tolerance, bool trace=false) |
template<matrix_order RO, matrix_style RS, typename T , matrix_order PO, matrix_style PS, typename FUNCTOR > | |
Matrix< T, RO, RS > | scythe::nls_broyden (FUNCTOR fun, const Matrix< T, PO, PS > &theta, unsigned int maxit=5000, T tolerance=1e-6) |
Solve a system of nonlinear equations. | |
template<typename T , matrix_order O, matrix_style S, typename FUNCTOR > | |
Matrix< T, O, Concrete > | scythe::nls_broyden (FUNCTOR fun, const Matrix< T, O, S > &theta, unsigned int maxit=5000, T tolerance=1e-6) |
Definitions of functions for doing numerical optimization and related operations.
This file contains a number of functions that are useful for numerical optimization and maximum likelihood estimation. In addition, it contains some basic facilities for evaluating definite integrals.
As is the case across Scythe, we provide both general and default template definitions for the functions in this file that return Matrix objects. The general definitions allow the user to customize the matrix_order and matrix_style of the returned Matrix, while the default versions return concrete matrices of the same matrix_order as the first (or only) Matrix argument to the function. In cases where we supply these two types of definitions, we explicitly document only the general version, although the default definition will typically appear in the function list below.