Kstars
#include <Eigen/Dense>
#include <unsupported/Eigen/FFT>
#include <limits>
#include <vector>
#include <stdexcept>
#include <cstdint>
#include <cmath>
Go to the source code of this file.
Macros | |
#define | M_PI 3.14159265358979323846 |
#define | MINIMAL_THETA 1e-7 |
Functions | |
Eigen::MatrixXd | math_tools::box_muller (const Eigen::VectorXd &vRand) |
std::pair< Eigen::VectorXd, Eigen::VectorXd > | math_tools::compute_spectrum (Eigen::VectorXd &data, int N) |
Eigen::MatrixXd | math_tools::generate_normal_random_matrix (const size_t n, const size_t m) |
Eigen::MatrixXd | math_tools::generate_uniform_random_matrix_0_1 (const size_t n, const size_t m) |
Eigen::VectorXd | math_tools::hamming_window (int N) |
bool | math_tools::isInf (double x) |
bool | math_tools::isNaN (double x) |
Eigen::MatrixXd | math_tools::squareDistance (const Eigen::MatrixXd &a) |
Eigen::MatrixXd | math_tools::squareDistance (const Eigen::MatrixXd &a, const Eigen::MatrixXd &b) |
double | math_tools::stdandard_deviation (Eigen::VectorXd &input) |
Variables | |
static const double | math_tools::NaN = std::numeric_limits<double>::quiet_NaN() |
Detailed Description
Provides mathematical tools needed for the Gaussian process toolbox.
- Date
- 2014-2017
- Copyright
- Max Planck Society
Definition in file src/math_tools.h.
Macro Definition Documentation
◆ M_PI
#define M_PI 3.14159265358979323846 |
Definition at line 35 of file src/math_tools.h.
◆ MINIMAL_THETA
#define MINIMAL_THETA 1e-7 |
Definition at line 23 of file src/math_tools.h.
Function Documentation
◆ box_muller()
Eigen::MatrixXd math_tools::box_muller | ( | const Eigen::VectorXd & | vRand | ) |
Apply the Box-Muller transform, which transforms uniform random samples to Gaussian distributed random samples.
Definition at line 109 of file src/math_tools.cpp.
◆ compute_spectrum()
std::pair< Eigen::VectorXd, Eigen::VectorXd > math_tools::compute_spectrum | ( | Eigen::VectorXd & | data, |
int | N = 0 ) |
Calculates the spectrum of a data vector.
Does pre-and postprocessing:
- The data is zero-padded until the desired resolution is reached.
- ditfft2 is called to compute the FFT.
- The frequencies from the padding are removed.
- The constant coefficient is removed.
- A list of frequencies is generated.
Definition at line 151 of file src/math_tools.cpp.
◆ generate_normal_random_matrix()
Eigen::MatrixXd math_tools::generate_normal_random_matrix | ( | const size_t | n, |
const size_t | m ) |
Generates normal random samples. First it gets some uniform random samples and then uses the Box-Muller transform to get normal samples out of it
Definition at line 138 of file src/math_tools.cpp.
◆ generate_uniform_random_matrix_0_1()
Eigen::MatrixXd math_tools::generate_uniform_random_matrix_0_1 | ( | const size_t | n, |
const size_t | m ) |
Generates a uniformly distributed random matrix of values between 0 and 1.
Definition at line 95 of file src/math_tools.cpp.
◆ hamming_window()
Eigen::VectorXd math_tools::hamming_window | ( | int | N | ) |
Computes a Hamming window (used to reduce spectral leakage of subsequent DFT).
Definition at line 187 of file src/math_tools.cpp.
◆ isInf()
|
inline |
Checks if a double is infinite via std::numeric_limits<double> functions.
Taken from: http://bytes.com/topic/c/answers/588254-how-check-double-inf-nan#post2309761
Definition at line 107 of file src/math_tools.h.
◆ isNaN()
|
inline |
Checks if a value is NaN by comparing it with itself.
The rationale is that NaN is the only value that does not evaluate to true when comparing it with itself. Taken from: http://stackoverflow.com/questions/3437085/check-nan-number http://stackoverflow.com/questions/570669/checking-if-a-double-or-float-is-nan-in-c
Definition at line 94 of file src/math_tools.h.
◆ squareDistance() [1/2]
Eigen::MatrixXd math_tools::squareDistance | ( | const Eigen::MatrixXd & | a | ) |
Single-input version of squaredDistance. For single inputs, it is assumed that the pairwise distance matrix should be computed between the passed vector itself.
Definition at line 90 of file src/math_tools.cpp.
◆ squareDistance() [2/2]
Eigen::MatrixXd math_tools::squareDistance | ( | const Eigen::MatrixXd & | a, |
const Eigen::MatrixXd & | b ) |
The squareDistance is the pairwise distance between all points of the passed vectors. I.e. it generates a symmetric matrix when two vectors are passed.
The first dimension (rows) is the dimensionality of the input space, the second dimension (columns) is the number of datapoints. The number of rows must be identical.
- Parameters
-
a a Matrix of size Dxn b a Matrix of size Dxm
- Returns
- a Matrix of size nxm containing all pairwise squared distances
Definition at line 28 of file src/math_tools.cpp.
◆ stdandard_deviation()
double math_tools::stdandard_deviation | ( | Eigen::VectorXd & | input | ) |
Computes the standard deviation of a vector... which is not part of Eigen.
Definition at line 198 of file src/math_tools.cpp.
Variable Documentation
◆ NaN
|
static |
Definition at line 99 of file src/math_tools.h.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:42 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.