ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_fftnr::setFFTF Interface Reference

Return the Forward Fourier Transform of a periodic sequence of type complex or real of arbitrary kind parameter. More...

Detailed Description

Return the Forward Fourier Transform of a periodic sequence of type complex or real of arbitrary kind parameter.

See the documentation of pm_fftnr for more details.

Parameters
[in,out]data: The input/output contiguous vector of arbitrary size of,
  1. type complex of kind any supported by the processor (e.g., CK, CK32, CK64, or CK128),
  2. type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128),
containing the periodic sequence whose FFT is to be computed.
On output, data contains the FFT result.


Possible calling interfaces

use pm_fftnr, only: setFFTF
call setFFTF(data(:))
Return the Forward Fourier Transform of a periodic sequence of type complex or real of arbitrary kind...
Definition: pm_fftnr.F90:783
This module contains procedures and generic interfaces for computing the Discrete Fourier Transform o...
Definition: pm_fftnr.F90:184
Warning
The condition 1 < size(data) .and. isIntPow(size(data)) must hold for the corresponding input arguments.
This condition is verified only if the library is built with the preprocessor macro CHECK_ENABLED=1.
The pure procedure(s) documented herein become impure when the ParaMonte library is compiled with preprocessor macro CHECK_ENABLED=1.
By default, these procedures are pure in release build and impure in debug and testing builds.
See also
getFFTF
getFFTR
getFFTI
setFFTF
setFFTR
setFFTI


Example usage

1program example
2
3 use pm_kind, only: SK, IK, LK
4 use pm_io, only: display_type
5 use pm_fftnr, only: setFFTF, setFFTR
7
8 implicit none
9
10 logical(LK) :: inwork
11 integer(IK), allocatable :: factor(:)
12
13 type(display_type) :: disp
14 disp = display_type(file = "main.out.F90")
15
16 block
17 use pm_kind, only: TKG => CKS
18 complex(TKG), parameter :: ZERO = (0._TKG, 0._TKG)
19 complex(TKG), allocatable :: data(:)
20 call disp%skip()
21 call disp%show("data = [complex(TKG) :: (1., -6.), (2., -5.), (3., -4.), (4., -3.), (5., -2.), (6., -1.), ZERO, ZERO]")
22 data = [complex(TKG) :: (1., -6.), (2., -5.), (3., -4.), (4., -3.), (5., -2.), (6., -1.), ZERO, ZERO]
23 call disp%show("call setFFTF(data)")
24 call setFFTF(data)
25 call disp%show("data")
26 call disp%show( data )
27 call disp%skip()
28 call disp%show("call setFFTR(data)")
29 call setFFTR(data)
30 call disp%show("data * 2 / size(data)")
31 call disp%show( data * 2 / size(data) )
32 call disp%skip()
33 end block
34
35 block
36 use pm_kind, only: TKG => CKD
37 complex(TKG), parameter :: ZERO = (0._TKG, 0._TKG)
38 complex(TKG), allocatable :: data(:)
39 call disp%skip()
40 call disp%show("data = [complex(TKG) :: (1., -6.), (2., -5.), (3., -4.), (4., -3.), (5., -2.), (6., -1.), ZERO, ZERO]")
41 data = [complex(TKG) :: (1., -6.), (2., -5.), (3., -4.), (4., -3.), (5., -2.), (6., -1.), ZERO, ZERO]
42 call disp%show("call setFFTF(data)")
43 call setFFTF(data)
44 call disp%show("data")
45 call disp%show( data )
46 call disp%skip()
47 call disp%show("call setFFTR(data)")
48 call setFFTR(data)
49 call disp%show("data * 2 / size(data)")
50 call disp%show( data * 2 / size(data) )
51 call disp%skip()
52 end block
53
54 block
55 use pm_kind, only: TKG => CKH
56 complex(TKG), parameter :: ZERO = (0._TKG, 0._TKG)
57 complex(TKG), allocatable :: data(:)
58 call disp%skip()
59 call disp%show("data = [complex(TKG) :: (1., -6.), (2., -5.), (3., -4.), (4., -3.), (5., -2.), (6., -1.), ZERO, ZERO]")
60 data = [complex(TKG) :: (1., -6.), (2., -5.), (3., -4.), (4., -3.), (5., -2.), (6., -1.), ZERO, ZERO]
61 call disp%show("call setFFTF(data)")
62 call setFFTF(data)
63 call disp%show("data")
64 call disp%show( data )
65 call disp%skip()
66 call disp%show("call setFFTR(data)")
67 call setFFTR(data)
68 call disp%show("data * 2 / size(data)")
69 call disp%show( data * 2 / size(data) )
70 call disp%skip()
71 end block
72
73 block
74 use pm_kind, only: TKG => RKS
75 real(TKG), allocatable :: data(:)
76 real(TKG), parameter :: ZERO = 0._TKG
77 call disp%skip()
78 call disp%show("data = [real(TKG) :: 1., 2., 3., 4., 5., 6.5, ZERO, ZERO]")
79 data = [real(TKG) :: 1., 2., 3., 4., 5., 6.5, ZERO, ZERO]
80 call disp%show("call setFFTF(data)")
81 call setFFTF(data)
82 call disp%show("data")
83 call disp%show( data )
84 call disp%skip()
85 call disp%show("call setFFTR(data)")
86 call setFFTR(data)
87 call disp%show("data * 2 / size(data)")
88 call disp%show( data * 2 / size(data) )
89 call disp%skip()
90 end block
91
92 block
93 use pm_kind, only: TKG => RKD
94 real(TKG), allocatable :: data(:)
95 real(TKG), parameter :: ZERO = 0._TKG
96 call disp%skip()
97 call disp%show("data = [real(TKG) :: 1., 2., 3., 4., 5., 6.5, ZERO, ZERO]")
98 data = [real(TKG) :: 1., 2., 3., 4., 5., 6.5, ZERO, ZERO]
99 call disp%show("call setFFTF(data)")
100 call setFFTF(data)
101 call disp%show("data")
102 call disp%show( data )
103 call disp%skip()
104 call disp%show("call setFFTR(data)")
105 call setFFTR(data)
106 call disp%show("data * 2 / size(data)")
107 call disp%show( data * 2 / size(data) )
108 call disp%skip()
109 end block
110
111 block
112 use pm_kind, only: TKG => RKH
113 real(TKG), allocatable :: data(:)
114 real(TKG), parameter :: ZERO = 0._TKG
115 call disp%skip()
116 call disp%show("data = [real(TKG) :: 1., 2., 3., 4., 5., 6.5, ZERO, ZERO]")
117 data = [real(TKG) :: 1., 2., 3., 4., 5., 6.5, ZERO, ZERO]
118 call disp%show("call setFFTF(data)")
119 call setFFTF(data)
120 call disp%show("data")
121 call disp%show( data )
122 call disp%skip()
123 call disp%show("call setFFTR(data)")
124 call setFFTR(data)
125 call disp%show("data * 2 / size(data)")
126 call disp%show( data * 2 / size(data) )
127 call disp%skip()
128 end block
129
130end program example
Allocate or resize (shrink or expand) an input allocatable scalar string or array of rank 1....
Return the Reverse (unnormalized) Fourier Transform of a periodic sequence of type complex or real of...
Definition: pm_fftnr.F90:1107
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11726
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11508
This module contains procedures and generic interfaces for resizing allocatable arrays of various typ...
This module contains classes and procedures for input/output (IO) or generic display operations on st...
Definition: pm_io.F90:252
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
Definition: pm_io.F90:11393
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
Definition: pm_kind.F90:541
integer, parameter CKH
The scalar integer constant of intrinsic default kind, representing the highest-precision complex kin...
Definition: pm_kind.F90:843
integer, parameter CKS
The single-precision complex kind in Fortran mode. On most platforms, this is a 32-bit real kind.
Definition: pm_kind.F90:570
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
Definition: pm_kind.F90:540
integer, parameter CKD
The double precision complex kind in Fortran mode. On most platforms, this is a 64-bit real kind.
Definition: pm_kind.F90:571
integer, parameter RKD
The double precision real kind in Fortran mode. On most platforms, this is an 64-bit real kind.
Definition: pm_kind.F90:568
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Definition: pm_kind.F90:539
integer, parameter RKH
The scalar integer constant of intrinsic default kind, representing the highest-precision real kind t...
Definition: pm_kind.F90:858
integer, parameter RKS
The single-precision real kind in Fortran mode. On most platforms, this is an 32-bit real kind.
Definition: pm_kind.F90:567
Generate and return an object of type display_type.
Definition: pm_io.F90:10282

Example Unix compile command via Intel ifort compiler
1#!/usr/bin/env sh
2rm main.exe
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example Windows Batch compile command via Intel ifort compiler
1del main.exe
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
4main.exe

Example Unix / MinGW compile command via GNU gfortran compiler
1#!/usr/bin/env sh
2rm main.exe
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example output
1
2data = [complex(TKG) :: (1., -6.), (2., -5.), (3., -4.), (4., -3.), (5., -2.), (6., -1.), ZERO, ZERO]
3call setFFTF(data)
4data
5(+21.0000000, -21.0000000), (-0.707106352, -1.70710707), (+5.99999905, -0.238418579E-6), (+2.60659981, -6.29289198), (-3.00000000, -3.00000000), (+0.707106352, -0.292893469), (+0.715255737E-6, -8.00000000), (-18.6065998, -7.70710802)
6
7call setFFTR(data)
8data * 2 / size(data)
9(+2.00000000, -12.0000000), (+4.00000143, -9.99999905), (+5.99999905, -8.00000000), (+7.99999905, -5.99999905), (+10.0000000, -4.00000000), (+11.9999981, -2.00000000), (+0.715255737E-6, -0.238418579E-6), (+0.119209290E-5, -0.166893005E-5)
10
11
12data = [complex(TKG) :: (1., -6.), (2., -5.), (3., -4.), (4., -3.), (5., -2.), (6., -1.), ZERO, ZERO]
13call setFFTF(data)
14data
15(+21.000000000000000, -21.000000000000000), (-0.70710678118654524, -1.7071067811865483), (+5.9999999999999991, -0.88817841970012523E-15), (+2.6066017177982097, -6.2928932188134530), (-3.0000000000000000, -3.0000000000000000), (+0.70710678118654702, -0.29289321881345343), (+0.88817841970012523E-15, -7.9999999999999991), (-18.606601717798210, -7.7071067811865452)
16
17call setFFTR(data)
18data * 2 / size(data)
19(+2.0000000000000004, -12.000000000000000), (+4.0000000000000018, -9.9999999999999982), (+5.9999999999999982, -7.9999999999999991), (+7.9999999999999973, -5.9999999999999991), (+10.000000000000000, -4.0000000000000000), (+11.999999999999998, -1.9999999999999996), (+0.13322676295501878E-14, -0.88817841970012523E-15), (+0.26645352591003757E-14, -0.26645352591003757E-14)
20
21
22data = [complex(TKG) :: (1., -6.), (2., -5.), (3., -4.), (4., -3.), (5., -2.), (6., -1.), ZERO, ZERO]
23call setFFTF(data)
24data
25(+21.0000000000000000000000000000000000, -21.0000000000000000000000000000000000), (-0.707106781186547524400844362104848511, -1.70710678118654752440084436210484928), (+6.00000000000000000000000000000000000, -0.385185988877447170611195588516985464E-33), (+2.60660171779821286601266543157273536, -6.29289321881345247559915563789515226), (-3.00000000000000000000000000000000000, -3.00000000000000000000000000000000000), (+0.707106781186547524400844362104848511, -0.292893218813452475599155637895151393), (-0.385185988877447170611195588516985464E-33, -8.00000000000000000000000000000000000), (-18.6066017177982128660126654315727354, -7.70710678118654752440084436210484774)
26
27call setFFTR(data)
28data * 2 / size(data)
29(+2.00000000000000000000000000000000000, -12.0000000000000000000000000000000000), (+4.00000000000000000000000000000000000, -10.0000000000000000000000000000000000), (+6.00000000000000000000000000000000000, -8.00000000000000000000000000000000000), (+8.00000000000000000000000000000000000, -5.99999999999999999999999999999999923), (+10.0000000000000000000000000000000000, -4.00000000000000000000000000000000000), (+12.0000000000000000000000000000000000, -2.00000000000000000000000000000000000), (-0.385185988877447170611195588516985464E-33, -0.385185988877447170611195588516985464E-33), (+0.00000000000000000000000000000000000, -0.770371977754894341222391177033970927E-33)
30
31
32data = [real(TKG) :: 1., 2., 3., 4., 5., 6.5, ZERO, ZERO]
33call setFFTF(data)
34data
35+21.5000000, -3.50000000, -10.0104074, +2.64644647, +3.00000000, +4.50000000, +2.01040721, -3.35355353
36
37call setFFTR(data)
38data * 2 / size(data)
39+1.00000000, +2.00000024, +3.00000000, +4.00000000, +5.00000000, +6.50000000, +0.119209290E-6, +0.00000000
40
41
42data = [real(TKG) :: 1., 2., 3., 4., 5., 6.5, ZERO, ZERO]
43call setFFTF(data)
44data
45+21.500000000000000, -3.5000000000000000, -10.010407640085653, +2.6464466094067260, +3.0000000000000000, +4.5000000000000000, +2.0104076400856532, -3.3535533905932753
46
47call setFFTR(data)
48data * 2 / size(data)
49+1.0000000000000000, +2.0000000000000000, +3.0000000000000000, +3.9999999999999996, +5.0000000000000000, +6.5000000000000000, +0.0000000000000000, +0.44408920985006262E-15
50
51
52data = [real(TKG) :: 1., 2., 3., 4., 5., 6.5, ZERO, ZERO]
53call setFFTF(data)
54data
55+21.5000000000000000000000000000000000, -3.50000000000000000000000000000000000, -10.0104076400856539574071770778912162, +2.64644660940672623779957781894757574, +3.00000000000000000000000000000000000, +4.50000000000000000000000000000000000, +2.01040764008565395740717707789121696, -3.35355339059327376220042218105242426
56
57call setFFTR(data)
58data * 2 / size(data)
59+1.00000000000000000000000000000000039, +2.00000000000000000000000000000000000, +3.00000000000000000000000000000000000, +4.00000000000000000000000000000000000, +5.00000000000000000000000000000000000, +6.50000000000000000000000000000000000, +0.192592994438723585305597794258492732E-33, +0.192592994438723585305597794258492732E-33
60
61
Test:
test_pm_fftnr


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Fatemeh Bagheri, Tuesday 11:34 PM, August 10, 2021, Dallas, TX

Definition at line 783 of file pm_fftnr.F90.


The documentation for this interface was generated from the following file: