Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
0d63f150
Commit
0d63f150
authored
8 months ago
by
Mikhail Svechnikov
Browse files
Options
Downloads
Patches
Plain Diff
change comments
parent
af14829c
No related branches found
No related tags found
1 merge request
!2653
Add inverse FFT
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Base/Math/FourierTransform.h
+17
-24
17 additions, 24 deletions
Base/Math/FourierTransform.h
with
17 additions
and
24 deletions
Base/Math/FourierTransform.h
+
17
−
24
View file @
0d63f150
...
@@ -23,15 +23,6 @@
...
@@ -23,15 +23,6 @@
#include
<vector>
#include
<vector>
//! Fourier transform of vectors (in 1D or 2D) using Fast Fourier Transform (fftw package).
//! Fourier transform of vectors (in 1D or 2D) using Fast Fourier Transform (fftw package).
//!
//! Usage:
//! std::vector<double> signal, result;
//! FourierTransform ft;
//! ft.fft(signal, result)
//!
//! Given code rely on code from Jeremy Fix page, http://jeremy.fix.free.fr/spip.php?article15,
//! see also "Efficient convolution using the Fast Fourier Transform, Application in C++"
//! by Jeremy Fix, May 30, 2011
class
FourierTransform
{
class
FourierTransform
{
public:
public:
// 1D and 2D vectors
// 1D and 2D vectors
...
@@ -42,29 +33,31 @@ public:
...
@@ -42,29 +33,31 @@ public:
FourierTransform
();
FourierTransform
();
//
! FT in 1D
//
forward transform
void
rfft
(
const
double1d_t
&
source
,
complex1d_t
&
result
);
void
rfft
(
const
double1d_t
&
source
,
complex1d_t
&
result
);
void
irfft
(
const
complex1d_t
&
source
,
double1d_t
&
result
,
int
w_src
);
void
rfft
(
const
double2d_t
&
source
,
complex2d_t
&
result
);
void
ramplitude
(
const
double1d_t
&
source
,
double1d_t
&
result
);
//! Shift low frequency to the center of 1D FT array
static
void
fftshift
(
double1d_t
&
result
);
static
void
fftshift
(
complex1d_t
&
result
);
//
! Shift low frequency to the edges of 1D FT array
//
forward transform with real-valued amplitudes in output
static
void
ifftshift
(
double1d_t
&
result
);
void
ramplitude
(
const
double1d_t
&
source
,
double1d_t
&
result
);
static
void
ifftshift
(
complex1
d_t
&
result
);
void
ramplitude
(
const
double2d_t
&
source
,
double2
d_t
&
result
);
//
! FT in 2D
//
backward transform
void
rfft
(
const
double2
d_t
&
source
,
complex2
d_t
&
result
);
void
i
rfft
(
const
complex1
d_t
&
source
,
double1
d_t
&
result
,
int
w_src
);
void
irfft
(
const
complex2d_t
&
source
,
double2d_t
&
result
,
int
w_real
);
void
irfft
(
const
complex2d_t
&
source
,
double2d_t
&
result
,
int
w_real
);
void
ramplitude
(
const
double2d_t
&
source
,
double2d_t
&
result
);
//! Shift low frequency to the center of 2D FT array
// Frequency shifts are useful for providing different representations of spectrum: with lowest
// frequency at edges of array (default output of fft) or with lowest frequency in center of
// array
// shift low frequency from corners to center
static
void
fftshift
(
double1d_t
&
result
);
static
void
fftshift
(
complex1d_t
&
result
);
static
void
fftshift
(
double2d_t
&
result
);
static
void
fftshift
(
double2d_t
&
result
);
static
void
fftshift
(
complex2d_t
&
result
);
static
void
fftshift
(
complex2d_t
&
result
);
//! Shift low frequency to the corners of 2D FT array
// shift low frequency from center to corners
static
void
ifftshift
(
double1d_t
&
result
);
static
void
ifftshift
(
complex1d_t
&
result
);
static
void
ifftshift
(
double2d_t
&
result
);
static
void
ifftshift
(
double2d_t
&
result
);
static
void
ifftshift
(
complex2d_t
&
result
);
static
void
ifftshift
(
complex2d_t
&
result
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment