|
DryChem 1.0.0
A generic, compile-time C++ toolbox with no dependencies for the modern computational chemistry project.
|
Namespaces | |
| namespace | details |
Classes | |
| class | InputSizeMismatch |
| class | Vector3D |
Functions | |
| template<typename IteratorX, typename IteratorY = IteratorX, typename Tx = typename std::iterator_traits<IteratorX>::value_type, typename Ty = typename std::iterator_traits<IteratorY>::value_type, typename = std::enable_if_t<std::conjunction_v<std::is_default_constructible<Tx>, std::is_default_constructible<Ty>>>> | |
| constexpr auto | backwardsDifferenceMethod (IteratorX x_begin, IteratorX x_end, IteratorY y_begin, IteratorY y_end) |
| template<typename ContainerX, typename ContainerY = ContainerX, typename = std::enable_if_t<std::conjunction_v<std::is_default_constructible<typename ContainerX::value_type>, std::is_default_constructible<typename ContainerY::value_type>>>> | |
| constexpr auto | backwardsDifferenceMethod (const ContainerX &x, const ContainerY &y) |
| template<typename IteratorX, typename IteratorY = IteratorX, typename Tx = typename std::iterator_traits<IteratorX>::value_type, typename Ty = typename std::iterator_traits<IteratorY>::value_type, typename = std::enable_if_t<std::conjunction_v<std::is_default_constructible<Tx>, std::is_default_constructible<Ty>>>> | |
| constexpr auto | centeredDifferenceMethod (IteratorX x_begin, IteratorX x_end, IteratorY y_begin, IteratorY y_end, bool correctBoundaries=true) |
| template<typename ContainerX, typename ContainerY = ContainerX, typename = std::enable_if_t<std::conjunction_v<std::is_default_constructible<typename ContainerX::value_type>, std::is_default_constructible<typename ContainerY::value_type>>>> | |
| constexpr auto | centeredDifferenceMethod (const ContainerX &x, const ContainerY &y, bool correctBoundaries=true) |
| template<typename IteratorX, typename IteratorY = IteratorX, typename Tx = typename std::iterator_traits<IteratorX>::value_type, typename Ty = typename std::iterator_traits<IteratorY>::value_type, typename = std::enable_if_t<std::conjunction_v<std::is_default_constructible<Tx>, std::is_default_constructible<Ty>>>> | |
| constexpr auto | forwardDifferenceMethod (IteratorX x_begin, IteratorX x_end, IteratorY y_begin, IteratorY y_end) |
| template<typename ContainerX, typename ContainerY = ContainerX, typename = std::enable_if_t<std::conjunction_v<std::is_default_constructible<typename ContainerX::value_type>, std::is_default_constructible<typename ContainerY::value_type>>>> | |
| constexpr auto | forwardDifferenceMethod (const ContainerX &x, const ContainerY &y) |
| template<typename ContainerX, typename ContainerY = ContainerX, typename = std::enable_if_t<std::conjunction_v<std::is_default_constructible<typename ContainerX::value_type>, std::is_default_constructible<typename ContainerY::value_type>>>> | |
| constexpr auto | fivePointStencilMethod (const ContainerX &x, const ContainerY &y) |
| template<typename ContainerX, typename ContainerY = ContainerX, typename = std::enable_if_t<std::conjunction_v<std::is_default_constructible<typename ContainerX::value_type>, std::is_default_constructible<typename ContainerY::value_type>>>> | |
| constexpr auto | sevenPointStencilMethod (const ContainerX &x, const ContainerY &y) |
| template<typename ContainerX, typename ContainerY = ContainerX, typename = std::enable_if_t<std::conjunction_v<std::is_default_constructible<typename ContainerX::value_type>, std::is_default_constructible<typename ContainerY::value_type>>>> | |
| constexpr auto | ninePointStencilMethod (const ContainerX &x, const ContainerY &y) |
| template<typename Tx, typename Ty = Tx> | |
| constexpr auto | trapz (Tx x1, Tx x2, Ty y1, Ty y2) noexcept |
| template<typename IteratorX, typename IteratorY = IteratorX, typename Tx = typename std::iterator_traits<IteratorX>::value_type, typename Ty = typename std::iterator_traits<IteratorY>::value_type, typename = std::enable_if_t<std::conjunction_v<std::is_default_constructible<Tx>, std::is_default_constructible<Ty>>>> | |
| constexpr auto | cumulativeTrapzIntegration (IteratorX x_begin, IteratorX x_end, IteratorY y_begin, IteratorY y_end, std::optional< decltype(*x_begin **y_begin)> initialValue=std::nullopt) |
| template<typename ContainerX, typename ContainerY = ContainerX, typename Tx = typename ContainerX::value_type, typename Ty = typename ContainerY::value_type, typename = std::enable_if_t<std::conjunction_v<std::is_default_constructible<Tx>, std::is_default_constructible<Ty>>>> | |
| constexpr auto | cumulativeTrapzIntegration (const ContainerX &x, const ContainerY &y, std::optional< decltype(std::declval< Tx >() *std::declval< Ty >())> initialValue=std::nullopt) |
| template<std::size_t Index, typename T> | |
| decltype(auto) | get (Vector3D< T > &vec) |
| template<std::size_t Index, typename T> | |
| decltype(auto) | get (const Vector3D< T > &vec) |
| template<std::size_t Index, typename T> | |
| decltype(auto) | get (Vector3D< T > &&vec) |
| template<typename IteratorX, typename IteratorY = IteratorX, typename Tx = typename std::iterator_traits<IteratorX>::value_type, typename Ty = typename std::iterator_traits<IteratorY>::value_type, typename = std::enable_if_t<std::conjunction_v<std::is_default_constructible<Tx>, std::is_default_constructible<Ty>>>> | |
| constexpr decltype(auto) | linearLeastSquaresFitting (IteratorX x_begin, IteratorX x_end, IteratorY y_begin, IteratorY y_end) |
| template<typename IteratorX, typename IteratorY = IteratorX, typename Tx = typename std::iterator_traits<IteratorX>::value_type, typename Ty = typename std::iterator_traits<IteratorY>::value_type, typename = std::enable_if_t<std::conjunction_v<std::is_default_constructible<Tx>, std::is_default_constructible<Ty>>>> | |
| constexpr decltype(auto) | quadraticLeastSquaresFitting (IteratorX x_begin, IteratorX x_end, IteratorY y_begin, IteratorY y_end) |
| template<typename T, typename = std::enable_if_t<std::is_arithmetic_v<T>>> | |
| constexpr int | findOrderOfMagnitude (T value) noexcept |
| template<typename T, typename = std::enable_if_t<std::is_arithmetic_v<T>>> | |
| constexpr long double | findAbsoluteError (T expectedValue, std::size_t significantFigures) noexcept |
| template<typename Iterator, typename T = typename std::iterator_traits<Iterator>::value_type, typename = std::enable_if_t<std::is_default_constructible_v<T>>> | |
| constexpr T | calculateAverage (Iterator x_begin, Iterator x_end) |
| template<typename Iterator, typename T = typename std::iterator_traits<Iterator>::value_type, typename = std::enable_if_t<std::is_default_constructible_v<T>>> | |
| constexpr decltype(auto) | calculateVariance (Iterator x_begin, Iterator x_end) |
| template<typename T, typename = std::enable_if_t<std::is_integral_v<T> && !std::is_same_v<T, bool>>> | |
| constexpr bool | isEven (T value) |
| template<typename T, typename = std::enable_if_t<std::is_integral_v<T>>> | |
| constexpr bool | isOdd (T value) |
| template<typename T> | |
| constexpr bool | withinRange (T value, T min, T max) |
| template<int Min, int Max, typename T> | |
| constexpr bool | withinRange (T value) |
| template<typename T> | |
| constexpr std::vector< T > | linearlyInterpolate (const std::vector< T > &x, T y1, T y2) |
|
constexpr |
A function taking the derivative (by numerical methods) of a given function y with respect to x. Each of the functions, x and y, are represeted by containers with an iterator interface. The function computes the following: \(\frac{dy}{dx} \approx \frac{y_n - y_{n-1}}{x_n - x_{n-1}}.\)
| IteratorX | - The type of iterator used for the x container |
| IteratorY | - The type of iterator used for the y container (defaults to the type of IteratorX) |
| Tx | - The type of data in the x container, must be default constructible |
| Ty | - The type of data in the y container, must be default constructible |
| x_begin | - The beginning of the range of x values to use |
| x_end | - The end of the range of x values to use |
| y_begin | - The beginning of the range of y values to use |
| y_end | - The end of the range of y values to use |
| CppUtils::Math::InputSizeMismatch | If the sizes of the two containers don't match, we will throw an exception |
Referenced by backwardsDifferenceMethod(), and centeredDifferenceMethod().
|
constexpr |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
References backwardsDifferenceMethod().
|
constexpr |
A function taking the derivative (by numerical methods) of a given function y with respect to x. Each of the functions, x and y, are represeted by containers with an iterator interface. The function computes the following: \(\frac{dy}{dx} \approx \frac{\frac{y_{n+1} - y_n}{x_{n+1} - x_n} + \frac{y_n - y_{n-1}}{x_n - x_{n-1}}}{2}.\)
| IteratorX | - The type of iterator used for the x container |
| IteratorY | - The type of iterator used for the y container (defaults to the type of IteratorX) |
| Tx | - The type of data in the x container, must be default constructible |
| Ty | - The type of data in the y container, must be default constructible |
| x_begin | - The beginning of the range of x values to use |
| x_end | - The end of the range of x values to use |
| y_begin | - The beginning of the range of y values to use |
| y_end | - The end of the range of y values to use |
| correctBoundaries | - Approximates the derivative on the ends with the forward and backwards methods |
correctBoundaries flag is set to false, the size of the output will be two less than the input size.| CppUtils::Math::InputSizeMismatch | If the sizes of the two containers don't match, we will throw an exception |
References backwardsDifferenceMethod(), and forwardDifferenceMethod().
Referenced by centeredDifferenceMethod(), and GTEST_TEST().
|
constexpr |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
References centeredDifferenceMethod().
|
constexpr |
A function taking the derivative (by numerical methods) of a given function y with respect to x. Each of the functions, x and y, are represeted by containers with an iterator interface. The function computes the following: \(\frac{dy}{dx} \approx \frac{y_{n+1} - y_n}{x_{n+1} - x_n}.\)
| IteratorX | - The type of iterator used for the x container |
| IteratorY | - The type of iterator used for the y container (defaults to the type of IteratorX) |
| Tx | - The type of data in the x container, must be default constructible |
| Ty | - The type of data in the y container, must be default constructible |
| x_begin | - The beginning of the range of x values to use |
| x_end | - The end of the range of x values to use |
| y_begin | - The beginning of the range of y values to use |
| y_end | - The end of the range of y values to use |
| CppUtils::Math::InputSizeMismatch | If the sizes of the two containers don't match, we will throw an exception |
Referenced by centeredDifferenceMethod(), and forwardDifferenceMethod().
|
constexpr |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
References forwardDifferenceMethod().
|
constexpr |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
References CppUtils::Math::details::nPointStencilMethod().
|
constexpr |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
References CppUtils::Math::details::nPointStencilMethod().
|
constexpr |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
References CppUtils::Math::details::nPointStencilMethod().
|
constexprnoexcept |
A simple function responsible for the main work in the cumulativeTrapzIntegration() function, this computes the following approximation for the integral: \(\displaystyle \int_{x_1}^{x_2} y \,dx \approx (x_2 - x_1) \cdot {\frac{y_1 + y_2}{2}}.\)
| Tx | - The type of x |
| Ty | - The type of y (defaults to the type of x) |
| x1 | - The beginning of the range we are integrating the function over |
| x2 | - The end of the range we are integrating the function over |
| y1 | - The value of the function we are integrating at the point x1 |
| y2 | - The end of the function we are integrating at the point x2 |
Referenced by cumulativeTrapzIntegration().
|
constexpr |
A function taking the integral (by numerical methods) of a given function y with respect to x. Each of the functions, x and y, are represeted by containers with an iterator interface.
| IteratorX | - The type of iterator used for the x container |
| IteratorY | - The type of iterator used for the y container (defaults to the type of IteratorX) |
| Tx | - The type of data in the x container, must be default constructible |
| Ty | - The type of data in the x container, must be default constructible |
| x_begin | - The beginning of the range of x values to use |
| x_end | - The end of the range of x values to use |
| y_begin | - The beginning of the range of y values to use |
| y_end | - The end of the range of y values to use |
| initialValue | - A value for use as the first point in the returned vector (optional) |
initialValue parameter is set, the size of the output will be the same as than of the input.| CppUtils::Math::InputSizeMismatch | If the sizes of the two containers don't match, we will throw an exception |
References trapz().
Referenced by cumulativeTrapzIntegration(), and GTEST_TEST().
|
constexpr |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
References cumulativeTrapzIntegration().
| decltype(auto) CppUtils::Math::get | ( | Vector3D< T > & | vec | ) |
Specific getters for use in the tuple-like API, allows for the structured binding of a Vector3D
| decltype(auto) CppUtils::Math::get | ( | const Vector3D< T > & | vec | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| decltype(auto) CppUtils::Math::get | ( | Vector3D< T > && | vec | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
constexpr |
Calculates the linear regression of a given function y with respect to x. Each of the functions, x and y, are represeted by containers with an iterator interface.
| IteratorX | - The type of iterator used for the x container |
| IteratorY | - The type of iterator used for the y container (defaults to the type of IteratorX) |
| Tx | - The type of data in the x container, must be default constructible |
| Ty | - The type of data in the y container, must be default constructible |
| x_begin | - The beginning of the range of x values to use |
| x_end | - The end of the range of x values to use |
| y_begin | - The beginning of the range of y values to use |
| y_end | - The end of the range of y values to use |
details::LinearLeastSquaresResult. However, rather than use this strucure directly, we can use structured bindings to return the slope, intercept, and variance.| CppUtils::Math::InputSizeMismatch | If the sizes of the two containers don't match, we will throw an exception |
std::sqrt() isn't overloaded properly. References calculateAverage(), and CppUtils::Math::details::LinearLeastSquaresResult< T_slope, T_intercept, T_variance, typename >::slope.
Referenced by GTEST_TEST().
|
constexpr |
Calculates the quadratic least squares regression of a given function y with respect to x. Each of the functions, x and y, are represeted by containers with an iterator interface.
| IteratorX | - The type of iterator used for the x container |
| IteratorY | - The type of iterator used for the y container (defaults to the type of IteratorX) |
| Tx | - The type of data in the x container, must be default constructible |
| Ty | - The type of data in the y container, must be default constructible |
| x_begin | - The beginning of the range of x values to use |
| x_end | - The end of the range of x values to use |
| y_begin | - The beginning of the range of y values to use |
| y_end | - The end of the range of y values to use |
details::QuadraticLeastSquaresResult. However, rather than use this strucure directly, we can use structured bindings to return the parameters a, b, and c.| CppUtils::Math::InputSizeMismatch | If the sizes of the two containers don't match, we will throw an exception |
References CppUtils::Math::details::QuadraticLeastSquaresResult< T_a, T_b, T_c, typename >::a.
|
constexprnoexcept |
Finds the order of magnitude of a given arithmetic value.
| T | - The type of the parameter value, must be an arithmetic type |
| value | - The value we are trying to find the order of magnitude of |
Referenced by findAbsoluteError().
|
constexprnoexcept |
Computes the absolute error in an expected value up to a certain amount of know significant digits.
| T | - The type of the parameter expectedValue, must be an arithmetic type |
| expectedValue | - The value we want to know the absolute error of |
| significantFigures | - The number of digits we know to be precise in expectedValue |
References findOrderOfMagnitude().
Referenced by GTEST_TEST(), and GTEST_TEST().
|
constexpr |
Computes the average of a range of values specified by input iterators.
| Iterator | - The input iterator for the container we are iterating over |
| T | - The type of the value the iterator points to, must be default constructible |
| x_begin | - The beginning of the range we are iterating over |
| x_end | - The end of the range we are iterating over |
Referenced by calculateVariance(), GTEST_TEST(), and linearLeastSquaresFitting().
|
constexpr |
Computes the variance from a range of values specified by input iterators from the following equation: \( \sigma^2 = \frac{1}{N - 1} \displaystyle \sum_{i = 0}^{N} (x_i - \bar x)^2.\)
| Iterator | - The input iterator for the container we are iterating over |
| T | - The type of the value the iterator points to, must be default constructible |
| x_begin | - The beginning of the range we are iterating over |
| x_end | - The end of the range we are iterating over |
References calculateAverage().
Referenced by GTEST_TEST().
|
constexpr |
Function to determine whether an integral type is even.
| T | - The type of the input to check, must be an integral type |
| value | - The input integral to check |
Referenced by isOdd().
|
constexpr |
Function to determine whether an integral type is odd.
| T | - The type of the input to check, must be an integral type |
| value | - The input integral to check |
References isEven().
|
constexpr |
A function to determine whether a given value is greater than or equal to a minimum value and less than or equal to a maximum value.
| T | - The type of the input variables |
| value | - The value we want to compare |
| min | - The minimum number in the range |
| max | - The maximum number in the range |
Referenced by withinRange().
|
constexpr |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
References withinRange().
|
constexpr |
A function to linearly interpolate some function over a range set by an input vector.
| T | - The type of the values we are interpolating |
| x | - The input vector containing the values we are interpolating over |
| y1 | - The value of the function we are interpolating in the beginning of the range |
| y2 | - The value of the function we are interpolating in the end of the range |
x