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

Generate and return the factorization vector factor of the specified input sequence length and the corresponding vector of trigonometric coefficients coef.
More...

Detailed Description

Generate and return the factorization vector factor of the specified input sequence length and the corresponding vector of trigonometric coefficients coef.

The factorization and the trigonometric coefficient vectors are required for computing the Forward or Reverse FFT.
Note that the computed factoring is not necessarily a complete prime factoring of the length of the input data sequence.
This is because some of target algorithms corresponding to some higher factors are more efficient than the composition of the lower factors.
For example, the corresponding algorithms to the composite factors 4 and 6 are faster than combining the corresponding algorithms for 2*2 and 2*3.

Parameters
[in]data: The input contiguous vector of either,
  • type complex of kind any supported by the processor (e.g., CK, CK32, CK64, or CK128), or
  • type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128), or
containing the data sequence whose Forward or Reverse FFT is to computed.
Only the length and the type of input vector is used within the algorithm.
[out]coef: The output contiguous vector of the same type, kind, and size as the input data sequence vector, containing the trigonometric look up table required for Forward or Reverse FFT of the specified data sequence.
(optional. If missing, the trigonometric coefficients will not be computed.)
[in]attr: The input scalar of type allocatable_type signifying the allocatable status of the input coef vector.
If present, the input coef will be reallocated to size(data).
(optional. It can be present only if the input argument coef has the allocatable attribute.)
Returns
factor : The output allocatable array of shape (:) of type integer of default kind IK, containing the factorization of the length of the data sequence whose Forward or Reverse FFT is to be computed.
By definition, the condition product(factor) == size(data) holds.


Possible calling interfaces

integer(IK), allocatable :: factor(:)
factor = getFactorFFT(data(1:lenData))
factor = getFactorFFT(data(1:lenData), coef(1:lenData))
factor = getFactorFFT(data(1:lenData), coef(:), attr)
Generate and return the factorization vector factor of the specified input sequence length and the co...
Definition: pm_fftpack.F90:292
This module contains procedures and generic interfaces for computing the Discrete Fourier Transform o...
Definition: pm_fftpack.F90:205
Warning
The condition size(data) > 1 must hold for the corresponding arguments.
The condition size(data) == size(coef) must hold for the corresponding arguments.
These conditions are 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. The procedures under this generic interface are always impure when the output argument coef is present.
Remarks
While the contents of the input data sequence is not used within the algorithm, its presence and requirement is to minimize user-mistakes.
See also
getFFTF
getFFTI
getFFTR
setFFTF
setFFTI
setFFTR


Example usage

1program example
2
3 use pm_kind, only: SK, IK, LK
4 use pm_io, only: display_type
5 use pm_fftpack, only: getfactorFFT
6 use pm_arrayFill, only: getFilled
7 use pm_err, only: setAsserted
8
9 implicit none
10
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), allocatable :: coef(:)
19 call disp%skip()
20 call disp%show("allocate(coef(13))")
21 allocate(coef(13))
22 call disp%show("factor = getfactorFFT(getFilled((0._TKG, 0._TKG), size(coef, 1, IK)), coef)")
23 factor = getfactorFFT(getFilled((0._TKG, 0._TKG), size(coef, 1, IK)), coef)
24 call disp%show("factor")
25 call disp%show( factor )
26 call disp%show("coef")
27 call disp%show( coef )
28 call disp%show("call setAsserted(product([factor]) == size(coef, 1, IK))")
29 call setAsserted(product([factor]) == size(coef, 1, IK))
30 call disp%skip()
31 end block
32
33 block
34 use pm_kind, only: TKG => RKS
35 real(TKG), allocatable :: coef(:)
36 call disp%skip()
37 call disp%show("allocate(coef(13))")
38 allocate(coef(13))
39 call disp%show("factor = getfactorFFT(getFilled(0._TKG, size(coef, 1, IK)), coef)")
40 factor = getfactorFFT(getFilled(0._TKG, size(coef, 1, IK)), coef)
41 call disp%show("factor")
42 call disp%show( factor )
43 call disp%show("coef")
44 call disp%show( coef )
45 call disp%show("call setAsserted(product([factor]) == size(coef, 1, IK))")
46 call setAsserted(product([factor]) == size(coef, 1, IK))
47 call disp%skip()
48 end block
49
50 block
51 use pm_kind, only: TKG => RKS
52 real(TKG), allocatable :: coef(:)
53 call disp%skip()
54 call disp%show("allocate(coef(273))")
55 allocate(coef(273))
56 call disp%show("factor = getfactorFFT(getFilled(0._TKG, size(coef, 1, IK)), coef)")
57 factor = getfactorFFT(getFilled(0._TKG, size(coef, 1, IK)), coef)
58 call disp%show("factor")
59 call disp%show( factor )
60 call disp%show("coef")
61 call disp%show( coef )
62 call disp%show("call setAsserted(product([factor]) == size(coef, 1, IK))")
63 call setAsserted(product([factor]) == size(coef, 1, IK))
64 call disp%skip()
65 end block
66
67end program example
Generate and return an array of the specified rank and shape of arbitrary intrinsic type and kind wit...
Verify the input assertion holds and if it does not, print the (optional) input message on stdout and...
Definition: pm_err.F90:735
Generate and return an object of type stop_type with the user-specified input attributes.
Definition: pm_err.F90:1618
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 convenient allocation and filling of array...
This module contains classes and procedures for reporting and handling errors.
Definition: pm_err.F90:52
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 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 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 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
2allocate(coef(13))
3factor = getfactorFFT(getFilled((0._TKG, 0._TKG), size(coef, 1, IK)), coef)
4factor
5+13
6coef
7(+0.885456026, +0.464723200), (+0.568064690, +0.822983861), (+0.120536566, +0.992708862), (-0.354604959, +0.935016215), (-0.748510778, +0.663122654), (-0.970941901, +0.239315450), (-0.970941782, -0.239315853), (-0.748510659, -0.663122773), (-0.354604572, -0.935016334), (+0.120536745, -0.992708862), (+0.568064928, -0.822983742), (+0.885456264, -0.464722782), (+0.885456264, -0.464722782)
8call setAsserted(product([factor]) == size(coef, 1, IK))
9
10
11allocate(coef(13))
12factor = getfactorFFT(getFilled(0._TKG, size(coef, 1, IK)), coef)
13factor
14+13
15coef
16-0.129212331E+20, +0.306562065E-40, -0.129212276E+20, +0.306562065E-40, +0.00000000, +0.00000000, +0.574532370E-43, +0.00000000, +0.280259693E-44, +0.00000000, +0.140129846E-44, +0.00000000, -0.129368890E+20
17call setAsserted(product([factor]) == size(coef, 1, IK))
18
19
20allocate(coef(273))
21factor = getfactorFFT(getFilled(0._TKG, size(coef, 1, IK)), coef)
22factor
23+3, +7, +13
24coef
25+0.999735177, +0.230132993E-1, +0.998940766, +0.460144095E-1, +0.997617245, +0.689911395E-1, +0.995765328, +0.919313431E-1, +0.993385971, +0.114822842, +0.990480423, +0.137653515, +0.987050235, +0.160411283, +0.983097255, +0.183084086, +0.978623509, +0.205659911, +0.973631442, +0.228126809, +0.968123615, +0.250472844, +0.962103009, +0.272686213, +0.955572784, +0.294755191, +0.948536456, +0.316668004, +0.940997660, +0.338413090, +0.932960451, +0.359978914, +0.924429059, +0.381354064, +0.915408015, +0.402527243, +0.905902088, +0.423487186, +0.895916343, +0.444222867, +0.885456026, +0.464723200, +0.874526680, +0.484977365, +0.863134146, +0.504974663, +0.851284444, +0.524704456, +0.838983774, +0.544156432, +0.826238751, +0.563320100, +0.813056111, +0.582185388, +0.799442768, +0.600742280, +0.785405993, +0.618981004, +0.770953119, +0.636891842, +0.756092012, +0.654465377, +0.740830362, +0.671692193, +0.725176275, +0.688563228, +0.709138155, +0.705069542, +0.692724347, +0.721202493, +0.675943613, +0.736953318, +0.658804893, +0.752313852, +0.641317189, +0.767275870, +0.623489797, +0.781831503, +0.605332136, +0.795973003, +0.586853862, +0.809692919, +0.568064690, +0.822983861, +0.548974693, +0.835838974, +0.529593885, +0.848251283, +0.509932518, +0.860214412, +0.00000000, +0.998940766, +0.460144095E-1, +0.995765328, +0.919313431E-1, +0.990480423, +0.137653515, +0.983097255, +0.183084086, +0.973631442, +0.228126809, +0.962103009, +0.272686213, +0.948536456, +0.316668004, +0.932960451, +0.359978914, +0.915408015, +0.402527243, +0.895916343, +0.444222867, +0.874526680, +0.484977365, +0.851284444, +0.524704456, +0.826238751, +0.563320100, +0.799442768, +0.600742280, +0.770953119, +0.636891842, +0.740830362, +0.671692193, +0.709138155, +0.705069542, +0.675943613, +0.736953318, +0.641317189, +0.767275870, +0.605332136, +0.795973003, +0.568064690, +0.822983861, +0.529593885, +0.848251283, +0.490001172, +0.871721745, +0.449370414, +0.893345535, +0.407787591, +0.913076818, +0.365340978, +0.930873752, +0.322120428, +0.946698725, +0.278217465, +0.960518122, +0.233725116, +0.972302735, +0.188737512, +0.982027590, +0.143350199, +0.989672005, +0.976592079E-1, +0.995219886, +0.517613292E-1, +0.998659492, +0.575379934E-2, +0.999983430, -0.402660407E-1, +0.999189019, -0.862004608E-1, +0.996277809, -0.131952271, +0.991256058, -0.177424535, +0.984134436, -0.222520947, +0.974927902, -0.267146081, +0.963656068, -0.311205149, +0.950342774, -0.354604959, +0.935016215, -0.397253543, +0.917708874, -0.439060569, +0.898457468, -0.479937583, +0.877302647, +0.00000000, +0.997617245, +0.689911395E-1, +0.990480423, +0.137653515, +0.978623509, +0.205659896, +0.962103009, +0.272686213, +0.940997660, +0.338413060, +0.915408015, +0.402527243, +0.00000000, +0.990480423, +0.137653515, +0.962103009, +0.272686213, +0.915408015, +0.402527243, +0.851284444, +0.524704456, +0.770953178, +0.636891842, +0.675943673, +0.736953318, +0.00000000, +0.978623509, +0.205659911, +0.915408015, +0.402527243, +0.813056111, +0.582185388, +0.675943613, +0.736953318, +0.509932518, +0.860214412, +0.322120428, +0.946698725, +0.00000000, +0.962103009, +0.272686213, +0.851284444, +0.524704456, +0.675943673, +0.736953318, +0.449370414, +0.893345535, +0.188737631, +0.982027531, -0.862003416E-1, +0.996277809, +0.00000000, +0.940997660, +0.338413090, +0.770953119, +0.636891842, +0.509932518, +0.860214412, +0.188737512, +0.982027590, -0.154729441, +0.987956882, -0.479937583, +0.877302647, +0.00000000, +0.915408015, +0.402527243, +0.675943613, +0.736953318, +0.322120428, +0.946698725, -0.862004608E-1, +0.996277809, -0.479937583, +0.877302647, -0.792476892, +0.609901965, +0.00000000, +0.00000000, +0.00000000, +0.00000000, +0.00000000, +0.00000000, +0.00000000, +0.00000000, +0.00000000, +0.00000000, +0.00000000, +0.00000000, +0.00000000, +0.00000000
26call setAsserted(product([factor]) == size(coef, 1, IK))
27
28
Test:
test_pm_fftpack
Todo:
Low Priority: Extension to higher order factors may be worthwhile in future.


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 292 of file pm_fftpack.F90.


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