Theoretica
A C++ numerical and automatic mathematical library
|
Differential operators using automatic differentiation. More...
#include "dual.h"
#include "dual2.h"
#include "multidual.h"
#include "../algebra/vec.h"
#include "../algebra/mat.h"
#include "../core/error.h"
#include "../core/core_traits.h"
#include "./autodiff_types.h"
#include <functional>
Go to the source code of this file.
Namespaces | |
theoretica | |
Main namespace of the library which contains all functions and objects. | |
theoretica::autodiff | |
Differential operators with automatic differentiation. | |
Functions | |
template<typename DualFunction = std::function<dual(dual)>, enable_dual_func< DualFunction > = true> | |
real | theoretica::autodiff::deriv (DualFunction f, real x) |
Compute the derivative of a function at the given point using univariate automatic differentiation. More... | |
template<typename DualFunction = std::function<dual(dual)>, enable_dual_func< DualFunction > = true> | |
auto | theoretica::autodiff::deriv (DualFunction f) |
Get a lambda function which computes the derivative of the given function at the given point, using automatic differentiation. More... | |
template<typename Dual2Function = std::function<dual2(dual2)>, enable_dual2_func< Dual2Function > = true> | |
real | theoretica::autodiff::deriv2 (Dual2Function f, real x) |
Compute the second derivative of a function at the given point using univariate automatic differentiation. More... | |
template<typename Dual2Function = std::function<dual2(dual2)>, enable_dual2_func< Dual2Function > = true> | |
auto | theoretica::autodiff::deriv2 (Dual2Function f) |
Get a lambda function which computes the second derivative of the given function at the given point, using automatic differentiation. More... | |
template<typename MultidualType , typename Vector = vec<real>> | |
auto | theoretica::autodiff::make_autodiff_arg (const Vector &x) |
Prepare a vector of multidual numbers in "canonical" form, where the i-th element of the vector has a dual part which is the i-th canonical vector. More... | |
template<typename Function , typename Vector = vec<real>, enable_scalar_field< Function > = true, enable_vector< Vector > = true> | |
auto | theoretica::autodiff::gradient (Function f, const Vector &x) |
Compute the gradient \(\nabla f = \sum_i^n \vec e_i \frac{\partial}{\partial x_i} f(\vec x)\) for a given \(\vec x\) of a scalar field of the form \(f: \mathbb{R}^N \rightarrow \mathbb{R}\) using automatic differentiation. More... | |
template<typename Function , enable_scalar_field< Function > = true> | |
auto | theoretica::autodiff::gradient (Function f) |
Get a lambda function which computes the gradient \(\nabla f = \sum_i^n \vec e_i \frac{\partial}{\partial x_i} f(\vec x)\) of a given scalar field of the form \(f: \mathbb{R}^N \rightarrow \mathbb{R}\) at \(\vec x\) using automatic differentiation. More... | |
template<typename Function , typename Vector = vec<real>, enable_scalar_field< Function > = true, enable_vector< Vector > = true> | |
real | theoretica::autodiff::divergence (Function f, const Vector &x) |
Compute the divergence \(\sum_i^n \frac{\partial}{\partial x_i} f(\vec x)\) for a given \(\vec x\) of a scalar field of the form \(f: \mathbb{R}^N \rightarrow \mathbb{R}\) using automatic differentiation. More... | |
template<typename Function , enable_scalar_field< Function > = true> | |
auto | theoretica::autodiff::divergence (Function f) |
Get a lambda function which computes the divergence of a given function of the form \(f: \mathbb{R}^N \rightarrow \mathbb{R}\) at a given \(\vec x\) using automatic differentiation. More... | |
template<unsigned int N = 0, unsigned int M = 0> | |
mat< real, M, N > | theoretica::autodiff::jacobian (vec< multidual< N >, M >(*f)(vec< multidual< N >, N >), const vec< real, N > &x) |
Compute the jacobian of a vector field of the form \(f: \mathbb{R}^N \rightarrow \mathbb{R}^M\). More... | |
template<unsigned int N = 0, unsigned int M = 0> | |
auto | theoretica::autodiff::jacobian (vec< multidual< N >, M >(*f)(vec< multidual< N >, N >)) |
Get a lambda function which computes the jacobian of a generic function of the form \(f: \mathbb{R}^N \rightarrow \mathbb{R}^M\) for a given $\vec x$. More... | |
template<unsigned int N = 0> | |
vec< real, N > | theoretica::autodiff::curl (vec< multidual< N >, N >(*f)(vec< multidual< N >, N >), const vec< real, N > &x) |
Compute the curl for a given \(\vec x\) of a vector field defined by \(f: \mathbb{R}^3 \rightarrow \mathbb{R}^3\) using automatic differentiation. More... | |
template<unsigned int N = 0> | |
auto | theoretica::autodiff::curl (vec< multidual< N >, N >(*f)(vec< multidual< N >, N >)) |
Get a lambda function which computes the curl for a given \(\vec x\) of a vector field defined by \(f: \mathbb{R}^3 \rightarrow \mathbb{R}^3\) using automatic differentiation. More... | |
template<unsigned int N = 0> | |
vec< real, N > | theoretica::autodiff::directional_derivative (multidual< N >(*f)(vec< multidual< N >, N >), const vec< real, N > &x, const vec< real, N > &v) |
Compute the directional derivative of a generic function of the form \(f: \mathbb{R}^N \rightarrow \mathbb{R}\). More... | |
template<unsigned int N = 0> | |
auto | theoretica::autodiff::directional_derivative (multidual< N >(*f)(vec< multidual< N >, N >), const vec< real, N > &v) |
Get a lambda function which computes the directional derivative of a generic function of the form \(f: \mathbb{R}^N \rightarrow \mathbb{R}\). More... | |
template<unsigned int N = 0> | |
real | theoretica::autodiff::laplacian (dual2(*f)(vec< dual2, N >), const vec< real, N > &x) |
Compute the Laplacian differential operator for a generic function of the form \(f: \mathbb{R}^N \rightarrow \mathbb{R}\) at a given $\vec x$. More... | |
template<unsigned int N = 0> | |
auto | theoretica::autodiff::laplacian (dual2(*f)(vec< dual2, N >)) |
Get a lambda function which computes the Laplacian differential operator for a generic function of the form \(f: \mathbb{R}^N \rightarrow \mathbb{R}\) at a given $\vec x$. More... | |
template<unsigned int N = 0> | |
real | theoretica::autodiff::sturm_liouville (multidual< N >(*f)(vec< multidual< N >, N >), multidual< N >(*H)(vec< multidual< N >, N >), vec< real, N > eta) |
Compute the Sturm-Liouville operator on a generic function of the form \(f: \mathbb{R}^{2N} \rightarrow \mathbb{R}\) with respect to a given Hamiltonian function of the form \(H: \mathbb{R}^{2N} \rightarrow \mathbb{R}\) where the first N arguments are the coordinates in phase space and the last N arguments are the conjugate momenta, for a given point in phase space. More... | |
Differential operators using automatic differentiation.