|
TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
|
Adaptive 1D integration, a generic CLEF integrator wrapper and root-finding routines.
These utilities provide the numerical building blocks used by the experimental Lattice tools (experimental) tools: an adaptive 13-point Kronrod 1D integrator, a generic wrapper that integrates CLEF expressions over a placeholder, and dichotomy/bisection root finding.
Classes | |
| class | triqs::experimental::utility::integrate_1d_adapt< T > |
| Adaptive one-dimensional integrator based on a 13-point Gauss-Kronrod-Lobatto rule. More... | |
Functions | |
| std::pair< double, double > | triqs::experimental::utility::bisection (std::function< double(double)> f, double x_low, double x_high, double y_target, double precision, long max_loops, std::string x_name, std::string y_name, bool verbosity) |
| Solve \( f(x) = y \) on a bracketing interval using the bisection method. | |
| std::pair< double, double > | triqs::experimental::utility::dichotomy (std::function< double(double)> f, double x_low, double x_high, double y_target, double precision, long max_loops, std::string x_name, std::string y_name, bool verbosity) |
| Solve \( f(x) = y \) on a bracketing interval using the false-position (dichotomy) method. | |
| std::pair< double, double > | triqs::experimental::utility::find_bounds (std::function< double(double)> f, double x_init, double y_value, double delta_x, double precision, long max_loops=1000) |
| Find a lower and an upper bound that bracket the solution of \( f(x) = y \). | |
| template<typename D, int I> | |
| auto | triqs::experimental::utility::integrate (auto const &integrator1d, auto expr_to_integrate, nda::clef::pair< I, D > const &p) |
| Integrate a CLEF expression over one of its placeholders using an arbitrary one-dimensional integrator. | |
| std::pair< double, double > | triqs::experimental::utility::root_finder (std::string method, std::function< double(double)> f, double x_init, double y_value, double precision, double delta_x, long max_loops=1000, std::string x_name="", std::string y_name="", bool verbosity=false) |
| Find the value \( x \) that solves \( f(x) = y \) using the requested root-finding method. | |
|
inline |
#include <triqs/experimental/utility/root_finder.hpp>
Solve \( f(x) = y \) on a bracketing interval using the bisection method.
Given an interval \( [x_\mathrm{low}, x_\mathrm{high}] \) that brackets the target value, this method repeatedly halves the interval, keeping the half in which the target value remains bracketed, until the residual drops below the requested precision.
It raises an error if convergence is not reached within max_loops iterations.
| f | Function \( f(x) : \mathbb{R} \to \mathbb{R} \) whose root is sought. |
| x_low | Lower bound of the bracketing interval. |
| x_high | Upper bound of the bracketing interval. |
| y_target | Target value \( y \) for \( f(x) \). |
| precision | Absolute precision \( |f(x) - y| \) at which the iteration stops. |
| max_loops | Maximum number of iterations. |
| x_name | Name of the \( x \) variable, used in the progress log. |
| y_name | Name of the \( y \) variable, used in the progress log. |
| verbosity | Whether to print the convergence progress. |
Definition at line 153 of file root_finder.hpp.
|
inline |
#include <triqs/experimental/utility/root_finder.hpp>
Solve \( f(x) = y \) on a bracketing interval using the false-position (dichotomy) method.
Given an interval \( [x_\mathrm{low}, x_\mathrm{high}] \) that brackets the target value, this method iteratively replaces one of the bounds with the linear (secant) estimate of the root until the residual drops below the requested precision.
It raises an error if convergence is not reached within max_loops iterations.
| f | Function \( f(x) : \mathbb{R} \to \mathbb{R} \) whose root is sought. |
| x_low | Lower bound of the bracketing interval. |
| x_high | Upper bound of the bracketing interval. |
| y_target | Target value \( y \) for \( f(x) \). |
| precision | Absolute precision \( |f(x) - y| \) at which the iteration stops. |
| max_loops | Maximum number of iterations. |
| x_name | Name of the \( x \) variable, used in the progress log. |
| y_name | Name of the \( y \) variable, used in the progress log. |
| verbosity | Whether to print the convergence progress. |
Definition at line 92 of file root_finder.hpp.
|
inline |
#include <triqs/experimental/utility/root_finder.hpp>
Find a lower and an upper bound that bracket the solution of \( f(x) = y \).
Starting from an initial guess, this function steps along \( x \) in increments of delta_x until the target value \( y \) is bracketed by the function values at the two most recent points (or until the maximum number of steps is reached). The returned bounds are ordered such that the first is smaller than the second.
| f | Function \( f(x) : \mathbb{R} \to \mathbb{R} \) whose root is sought. |
| x_init | Initial guess for \( x \). |
| y_value | Target value \( y = f(x) \). |
| delta_x | Step size by which \( x \) is incremented. |
| precision | Absolute precision \( |f(x) - y| \) used to stop the search early. |
| max_loops | Maximum number of steps. |
Definition at line 45 of file root_finder.hpp.
| auto triqs::experimental::utility::integrate | ( | auto const & | integrator1d, |
| auto | expr_to_integrate, | ||
| nda::clef::pair< I, D > const & | p ) |
#include <triqs/experimental/utility/integrator.hpp>
Integrate a CLEF expression over one of its placeholders using an arbitrary one-dimensional integrator.
This function turns the given expression into a unary CLEF function of the placeholder with index \( I \) and hands it to the supplied one-dimensional integrator together with the integration domain. If the expression still depends on other placeholders, the result is again a lazy CLEF expression; otherwise it is the value of the integral.
| D | Type of the integration domain (e.g. a pair of bounds). |
| I | Index of the placeholder that is integrated over. |
| integrator1d | One-dimensional integrator that integrates a callable \( f(x) \) over the domain. |
| expr_to_integrate | CLEF expression to be integrated. |
| p | Placeholder-to-domain assignment, i.e. a placeholder = domain pair. |
Definition at line 29 of file integrator.hpp.
|
inline |
#include <triqs/experimental/utility/root_finder.hpp>
Find the value \( x \) that solves \( f(x) = y \) using the requested root-finding method.
This is the main entry point of the root finder. It first brackets the solution and then refines it with either a dichotomy or a bisection step, depending on the chosen method.
It raises an error if the method name is not recognized.
| method | Root-finding method, either "dichotomy" or "bisection". |
| f | Function \( f(x) : \mathbb{R} \to \mathbb{R} \) whose root is sought. |
| x_init | Initial guess for \( x \). |
| y_value | Target value \( y \) for \( f(x) \). |
| precision | Absolute precision \( |f(x) - y| \) at which the iteration stops. |
| delta_x | Step size used when bracketing the solution. |
| max_loops | Maximum number of iterations. |
| x_name | Name of the \( x \) variable, used in the progress log. |
| y_name | Name of the \( y = f(x) \) variable, used in the progress log. |
| verbosity | Whether to print the convergence progress. |
Definition at line 201 of file root_finder.hpp.