Useful set of math functions. More...
#include <vector>#include <cmath>Go to the source code of this file.
Functions | |
| template<typename T> | |
| T | CppTools::MaximumFromCArray (const T *entries, const unsigned long n) |
| Returns maximum value from C array. | |
| template<typename... Ts> | |
| double | CppTools::Maximum (Ts... args) |
| Returns maximum value from parameter pack. | |
| template<typename T> | |
| T | CppTools::MinimumFromCArray (const T *entries, const unsigned long n) |
| Returns minimum value from C array. | |
| template<typename... Ts> | |
| double | CppTools::Minimum (Ts... args) |
| Returns minimum value from parameter pack. | |
| template<typename T> | |
| T | CppTools::AverageFromCArray (const T *entries, const unsigned long n) |
| Returns average value from C array. | |
| template<typename... Ts> | |
| double | CppTools::Average (Ts... args) |
| Returns average value from parameter pack. | |
| double | CppTools::WeightedAverage (const double *entries, const double *weights, const unsigned long n) |
| Returns average value from C arrays containing values and weights. | |
| template<typename T> | |
| double | CppTools::StandardErrorFromCArray (const T *entries, const unsigned long n, const double average) |
| Returns standard error value from C array. | |
| template<typename... Ts> | |
| double | CppTools::StandardError (Ts... args) |
| Returns average value from parameter pack. | |
| template<typename T> | |
| double | CppTools::UncertaintyPropFromCArray (const T *entries, const unsigned long n) |
| Returns uncertainty that is the propagated uncertainty from all uncertainties from C array. | |
| template<typename... Ts> | |
| double | CppTools::UncertaintyProp (Ts... args) |
| Returns uncertainty that is the propagated uncertainty from all uncertainties from parameter pack. | |
| template<typename T> | |
| T | CppTools::ProductFromCArray (const T *entries, const unsigned long n) |
| Returns product of values from C array. | |
| template<typename... Ts> | |
| double | CppTools::Product (Ts... args) |
| Returns product of values from parameter pack. | |
| template<typename T> | |
| double | CppTools::AtLeast1ProbFromCArray (const T *entries, const unsigned long n) |
| Returns probability of at least 1 success from probabilities of different independent successes from C array. | |
| template<typename... Ts> | |
| double | CppTools::AtLeast1Prob (Ts... args) |
| Returns probability of at least 1 success from probabilities of different independent successes from parameter pack. | |
| template<typename T> | |
| double | CppTools::RMSFromCArray (const T *entries, const unsigned long n) |
| Returns root mean square (RMS) of values from C array. | |
| template<typename... Ts> | |
| double | CppTools::RMS (Ts... args) |
| Returns root mean square (RMS) of values from parameter pack. | |
Useful set of math functions.
No library loading is required to use functions from this file since many of the functions in this file are template functions which do not support separate declaration.
This file is a part of a project CppTools (https://github.com/Sergeyir/CppTools).
| double CppTools::AtLeast1Prob | ( | Ts... | args | ) |
Returns probability of at least 1 success from probabilities of different independent successes from parameter pack.
| [in] | args | Parameter pack |
| [out] | result | Probability |
| double CppTools::AtLeast1ProbFromCArray | ( | const T * | entries, |
| const unsigned long | n ) |
Returns probability of at least 1 success from probabilities of different independent successes from C array.
Can be used with std::vector or std::array as such: AtLeast1ProbFromCArray(&some_vector[0], some_vector.size())
| [in] | entries | array |
| [in] | n | Size of array |
| [out] | result | Probability |
| double CppTools::Average | ( | Ts... | args | ) |
Returns average value from parameter pack.
| [in] | args | Parameter pack |
| [out] | result | Average value |
| T CppTools::AverageFromCArray | ( | const T * | entries, |
| const unsigned long | n ) |
Returns average value from C array.
Can be used with std::vector or std::array as such: AverageFromCArray(&some_vector[0], some_vector.size())
| [in] | entries | array |
| [in] | n | Size of array |
| [out] | result | Average value |
| double CppTools::Maximum | ( | Ts... | args | ) |
Returns maximum value from parameter pack.
| [in] | args | Parameter pack |
| [out] | result | Maximum value |
| T CppTools::MaximumFromCArray | ( | const T * | entries, |
| const unsigned long | n ) |
Returns maximum value from C array.
Can be used with std::vector or std::array as such: MaximumFromCArray(&some_vector[0], some_vector.size())
| [in] | entries | array |
| [in] | n | Size of array |
| [out] | result | Maximum value |
| double CppTools::Minimum | ( | Ts... | args | ) |
Returns minimum value from parameter pack.
| [in] | args | Parameter pack |
| [out] | result | Minimum value |
| T CppTools::MinimumFromCArray | ( | const T * | entries, |
| const unsigned long | n ) |
Returns minimum value from C array.
Can be used with std::vector or std::array as such: MinimumArray(&some_vector[0], some_vector.size())
| [in] | entries | array |
| [in] | n | Size of array |
| [out] | result | Minimum value |
| double CppTools::Product | ( | Ts... | args | ) |
Returns product of values from parameter pack.
| [in] | args | Parameter pack |
| [out] | result | Product |
| T CppTools::ProductFromCArray | ( | const T * | entries, |
| const unsigned long | n ) |
Returns product of values from C array.
Can be used with std::vector or std::array as such: ProductFromCArray(&some_vector[0], some_vector.size())
| [in] | entries | array |
| [in] | n | Size of array |
| [out] | result | Product |
| double CppTools::RMS | ( | Ts... | args | ) |
Returns root mean square (RMS) of values from parameter pack.
| [in] | args | Parameter pack |
| [out] | result | RMS |
| double CppTools::RMSFromCArray | ( | const T * | entries, |
| const unsigned long | n ) |
Returns root mean square (RMS) of values from C array.
Can be used with std::vector or std::array as such: RMSFromCarray(&some_vector[0], some_vector.size())
| [in] | entries | array |
| [in] | n | Size of array |
| [out] | result | RMS |
| double CppTools::StandardError | ( | Ts... | args | ) |
Returns average value from parameter pack.
| [in] | args | Parameter pack, last value in the pack must be the average value of the pack |
| [out] | result | Standard error value |
| double CppTools::StandardErrorFromCArray | ( | const T * | entries, |
| const unsigned long | n, | ||
| const double | average ) |
Returns standard error value from C array.
Can be used with std::vector or std::array as such: StandardErrorFromCArray(&some_vector[0], some_vector.size())
| [in] | entries | array |
| [in] | n | Size of array |
| [out] | result | Standard error value |
| double CppTools::UncertaintyProp | ( | Ts... | args | ) |
Returns uncertainty that is the propagated uncertainty from all uncertainties from parameter pack.
Uncertainties are relative.
| [in] | args | Parameter pack |
| [out] | result | Propagated uncertainty |
| double CppTools::UncertaintyPropFromCArray | ( | const T * | entries, |
| const unsigned long | n ) |
Returns uncertainty that is the propagated uncertainty from all uncertainties from C array.
Uncertainties are relative. Can be used with std::vector or std::array as such: StandardErrorFromCArray(&some_vector[0], some_vector.size())
| [in] | entries | array (contains uncertainties) |
| [in] | n | Size of array |
| [out] | result | Propagated uncertainty |
| double CppTools::WeightedAverage | ( | const double * | entries, |
| const double * | weights, | ||
| const unsigned long | n ) |
Returns average value from C arrays containing values and weights.
Can be used with std::vector or std::array as such: WeightedAverage(&some_vector[0], some_vector.size())
| [in] | entries | array with values |
| [in] | weights | array with weights |
| [in] | n | Size of array |
| [out] | result | Weighted average value |