einsums::compute_graph::compose_approximation#
Note
Generated from the C++ headers by apiary --emit-cpp-docs-json.
Defined in header Einsums/ComputeGraph/Approximation.hpp.
-
constexpr double compose_approximation(ApproximationEffect effect, double first, double second) noexcept#
The bound that holds after applying an approximation of size
secondon top of one of sizefirst.Why the relative case is not a sum
For an ABSOLUTE effect this is the triangle inequality and the answer is the sum: if the first rewrite moved the result by at most
firstand the second by at mostsecond, the pair moved it by at most their sum.For a RELATIVE one, summing is not a bound, it is an under-estimate. The second pass’s error is relative to the ALREADY PERTURBED result, so with \(\|x_1 - x_0\| \le e_1 \|x_0\|\) and \(\|x_2 - x_1\| \le e_2 \|x_1\|\), \(\|x_2 - x_0\| \le (e_1 + e_2 + e_1 e_2)\|x_0\|\). The product term is what a sum drops, and dropping it makes a composed budget quietly optimistic, which is the one direction an accuracy contract must never fail in.
Added in version 2.0.0.
- Parameters:
effect – The units both bounds are in.
first – The bound already standing.
second – The bound being added.
- Returns:
The composed bound, never smaller than either input.