Sirius  0.0.0
numeric.h
Go to the documentation of this file.
1 
22 #ifndef SIRIUS_UTILS_NUMERIC_H_
23 #define SIRIUS_UTILS_NUMERIC_H_
24 
25 #include "sirius/types.h"
26 
27 namespace sirius {
28 namespace utils {
29 
34 int Gcd(int a, int b);
35 
39 void FFTShift2D(const double* data, const Size& size, double* shifted_data);
40 
44 void IFFTShift2D(const double* data, const Size& size, double* shifted_data);
45 
53 void IFFTShift2DUncentered(const double* data, const Size& size,
54  const Point& hot_point, double* shifted_data);
55 
64 void FFTShift2DUncentered(const double* data, const Size& size,
65  const Point& hot_point, double* shifted_data);
66 
73 std::vector<double> ComputeFFTFreq(int n_samples, bool half = true);
74 
82 Size GenerateDyadicSize(const Size& size, const int res_in,
83  const Size& padding_size);
84 
91 Size GenerateZoomCompliantSize(const Size& size, const ZoomRatio& zoom_r);
92 
102 void CreateMeshgrid(int x_min, int x_max, int y_min, int y_max,
103  std::vector<int>& xx, std::vector<int>& yy);
104 
105 } // namespace utils
106 } // namespace sirius
107 
108 #endif // SIRIUS_UTILS_NUMERIC_H_
void IFFTShift2DUncentered(const double *data, const Size &size, const Point &hot_point, double *shifted_data)
IFFTShift 2D matrix in which hot point is not centered.
std::vector< double > ComputeFFTFreq(int n_samples, bool half=true)
Compute frequencies for which fft will be calculated.
int Gcd(int a, int b)
Compute Gcd of a and b using C++17: will be replaced with std::gcd.
Definition: exception.h:27
Size GenerateDyadicSize(const Size &size, const int res_in, const Size &padding_size)
Rounds the parameters so log2(param) is an int.
void CreateMeshgrid(int x_min, int x_max, int y_min, int y_max, std::vector< int > &xx, std::vector< int > &yy)
Create coordinates vector.
void FFTShift2DUncentered(const double *data, const Size &size, const Point &hot_point, double *shifted_data)
FFTShift 2D matrix in which hot point must remain uncentered after shift.
void IFFTShift2D(const double *data, const Size &size, double *shifted_data)
IFFTShift 2D matrix.
void FFTShift2D(const double *data, const Size &size, double *shifted_data)
FFTShift 2D matrix.
Size GenerateZoomCompliantSize(const Size &size, const ZoomRatio &zoom_r)
Resize given dimensions so it matches with given zoom ratio.