CMP++: Uncertainty Quantification & Bayesian Calibration
Loading...
Searching...
No Matches
finite_diff.h File Reference
#include "cmp_defines.h"
Include dependency graph for finite_diff.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  cmp
 

Enumerations

enum  cmp::accuracy { cmp::SECOND , cmp::FOURTH , cmp::SIXTH , cmp::EIGHTH }
 Accuracy order of the FD stencil. More...
 

Functions

double cmp::fd_gradient (const Eigen::VectorXd &x_0, const std::function< double(const Eigen::VectorXd &)> fun, const int &i, const accuracy order=SECOND, const double h=1E-5)
 Computes the i-th component of the gradient of the function fun evaluated at x_0 using a central difference scheme.
 
double cmp::fd_hessian (const Eigen::VectorXd &x_0, const std::function< double(const Eigen::VectorXd &)> fun, const int &i, const int &j, const accuracy order=SECOND, const double h=1E-5)
 Computes the i-th and j-th component of the Hessian of the function fun evaluated at x_0 using a central difference scheme.