Signature | Description | Parameters |
---|---|---|
template<typename T> std::vector<T> gen_log_space_nums(std::size_t n, T first, T last, T base); |
Produces n logarithmically spaced numbers between the given base raised to the power of first to last. It returns the vector of results |
T: Any type that supports arithmetic n: Number of numerics to generate first: Starting power to raise the base to last: Last power to raise the base to base: Base of the numbers |
template<typename T> std::vector<T> gen_even_space_nums(std::size_t n, T first, T last); |
This function generates n evenly spaced numbers between the given first and ast parameters. The result vector always starts with first and ends shy of last It returns the vector of results |
T: Any type that supports arithmetic n: Number of values to generate first: Starting value last: Last value (excluded) |
template<typename T> std::vector<T> gen_triangular_nums(T last, T first = 1); |
A number is termed as triangular number if we can represent it in the form of triangular grid of points such that the points form an equilateral triangle and each row contains as many points as the row number, i.e., the first row has one point, second row has two points, third row has three points and so on. This function generates n triangle numbers arranged in an equilateral triangle. The n-th triangular number is equal to the sum of the n natural numbers from 1 to n (assuming first is 1 and last is n). The result vector always starts with a value >= than first and ends with a value <= than last. It returns the vector of results |
T: Any type that supports arithmetic last: Last value last: Starting value defaulted to 1 |
template<typename T> std::vector<T> gen_sym_triangle(std::size_t n, const T &start_val, bool normalize = false); |
This generates a set of numbers that represent the upper portion of a symmetric triangle. For example, n = 10 will generate [1, 2, 3, 4, 5, 5, 4, 3, 2, 1], n = 9 will generate [1, 2, 3, 4, 5, 4, 3, 2, 1]. If normalize is true, the numbers are normalized by the sum of all numbers. It returns the vector of results |
T: Any type that supports arithmetic start_val: Starting vlaue of the result normalize: if true, result numbers are divided by the sum of all numbers |
template<typename T> std::vector<T> gen_dft_sample_freq(std::size_t n, T spacing = 1.0); |
This generates the Discrete Fourier Transform sample frequencies. The returned vector contains the frequency bin centers in cycles per unit of the sample spacing (with zero at the start). For instance, if the sample spacing is in seconds, then the frequency unit is cycles/second. It returns the vector of results |
T: Any type that supports arithmetic n: Window length spacing: Sample spacing (inverse of the sampling rate). Defaults to 1 |