Fast Trigonometric Transforms For Non-Equispaced Nodes
In many areas, computers are increasingly used. Thus, the need for fast algorithms in fundamental tasks is constantly growing. One of the most frequent problems are certainly transformations such as DFT (discrete fourier transform), DCT (discrete cosine transform), and DST (discrete sine transform). Fast algorithms have been known for a longer period of time now, however, they all come with the same restriction. The nodes have to be on an equispaced grid. Today, as a matter of fact, there is an increasing number of applications working with non-uniform sampling sets. To allow for this trend, we propose fast algorithms and provide an implementation.
We consider the index set
Let
The libraries are written in C, containing the NFCT and NFST as well as their inverse transforms iNFCT and iNFST.
Example
Given a set of
![]() |
![]() |
|
Figure 1: These images are the results of two-dimensional scattered data interpolations employing the iterative solver CGNR that uses the NFCT (left) and NFST (right), respectively, for fast matrix-vector multiplication. |
Runtime
May
![]() |
![]() |
|
Figure 2: These graphs show running times (in seconds) of the one-dimensional (left) and two-dimensional (right) NFCT and NFST in respect to |
Approximation Error
The NFCT and NFST are approximate algorithms. Consequently, we make an approximation error
![]() |
![]() |
||
Figure 3: These graphs show the approximation error E∞ of the NFCT (left) and NFST (right) in respect to |
Usage
Two simple examples how to use the NFCT/NFST and iNFCT/iNFST are shown below ("R" is used as a wildcard for "c" and "s"):
void my_2d_nfRt_trafo(); { int j,k; nfRt_plan my_plan; // initializing plan for two dimensional transform // with bandwitdhs 32, 32 and 1024 nodes nfRt_init_2d( &my_plan, 32, 32, 1024); // initializing the nodes for( j = 0; j < my_plan.d * my_plan.M_total; j++) my_plan.x[j] = 0.5 * ((double)rand()) / RAND_MAX; // if PRE_PSI is set, then do precomputation if( my_plan.nfRt_flags & PRE_PSI) nfRt_precompute_psi( &my_plan); // initializing coefficients for( k = 0; k < my_plan.N_total; k++) my_plan.f_hat[k] = ((double)rand()) / RAND_MAX; // execute transform nfRt_trafo( &my_plan); // process results (i.e. print to stdout) for( j = 0; j < my_plan.M_total; j++) printf( "f[%d] = %e\n", j, my_plan.f[j]); // deallocate memory nfRt_finalize( &my_plan); }
void my_2d_inv_nfRt(); { int j,k; int iter, iter_end = 5; nfRt_plan my_plan; infRt_plan my_inv_plan; // initializing plan for two dimensional transform // with bandwidths 32, 32 and 1024 nodes nfRt_init_2d( &my_plan, 32, 32, 1024); // initializing plan for an inverse transform infRt_init( &my_inv_plan, &my_plan); // initializing nodes for( j = 0; j < my_plan.d * my_plan.M_total; j++) my_plan.x[j] = 0.5 * ((double)rand()) / RAND_MAX; // if PRE_PSI is set, then do precomputation if( my_plan.nfRt_flags & PRE_PSI) nfRt_precompute_psi( &my_plan); // initializing samples for( j = 0; j < my_plan.M_total; j++) my_inv_plan.y[j] = ((double)rand()) / RAND_MAX; // initializing fourier coefficients for( k = 0; k < my_plan.N_total; k++) my_inv_plan.f_hat_iter[k] = 0.0; // precomputations for the iterative solver infRt_before_loop( &my_inv_plan); // execute iterations for( iter = 0; iter < iter_end; iter++) infRt_loop_one_step( &my_inv_plan); // further processing (i.e. print to stdout) for( k = 0; k < my_plan.N_total; k++) printf( "%e\n", my_inv_plan.f_hat_iter[k]); // deallocate memory infRt_finalize( &my_inv_plan); nfRt_finalize( &my_plan); }
Steffen Klatt, Nov. 2005
The algorithms are implemented by Steffen Klatt in ./examples/nfst
and ./examples/nfct
. The OpenMP parallelization and the Matlab interface in ./matlab/nfct
and ./matlab/nfst
were implemented by Toni Volkmer. The Julia interface was implemented by Michael Schmischke in ./julia/nfct
and ./julia/nfst
. Related paper are