# Sequence of Invoking TT Routines

Computation of a transform using TT interface is conceptually divided into four steps, each of which is performed via a dedicated routine. Table “TT Interface Routines” lists the routines and briefly describes their purpose and use.

Most TT routines have versions operating with single-precision and double-precision data. Names of such routines begin respectively with “`s`” and “`d`”. The wildcard “?” stands for either of these symbols in routine names.

TT Interface Routines
Routine | Description
--- | ---
?_init_trig_transform | Initializes basic data structures of Trigonometric Transforms.
?_commit_trig_transform | Checks consistency and correctness of user-defined data as well as creates a data structure to be used by Intel MKL FFT interface1.
?_forward_trig_transform ?_backward_trig_transform | Computes a forward/backward Trigonometric Transform of a specified type using the appropriate formula (see Transforms Implemented).
free_trig_transform | Cleans the memory used by a data structure needed for calling FFT interface1.

1TT routines call Intel MKL FFT interface for better performance.

To find a transformed vector for a particular input vector only once, the Intel MKL TT interface routines are normally invoked in the order in which they are listed in Table “TT Interface Routines”.

### Note

Though the order of invoking TT routines may be changed, it is highly recommended to follow the above order of routine calls.

The diagram in Figure “Typical Order of Invoking TT Interface Routines” indicates the typical order in which TT interface routines can be invoked in a general case (prefixes and suffixes in routine names are omitted).

Typical Order of Invoking TT Interface Routines

A general scheme of using TT routines for double-precision computations is shown below. A similar scheme holds for single-precision computations with the only difference in the initial letter of routine names.

...

d_init_trig_transform(&n, &tt_type, ipar, dpar, &ir);

/* Change parameters in ipar if necessary. */

/* Note that the result of the Transform will be in f ! If you want to preserve the data stored in f,

save them before this place in your code */

d_commit_trig_transform(f, &handle, ipar, dpar, &ir);

d_forward_trig_transform(f, &handle, ipar, dpar, &ir);

d_backward_trig_transform(f, &handle, ipar, dpar, &ir);

free_trig_transform(&handle, ipar, &ir);

/* here the user may clean the memory used by f, dpar, ipar */

...

You can find examples of Fortran 90 and C code that use TT interface routines to solve one-dimensional Helmholtz problem in Trigonometric Transform Code Examples in the “Code Examples” Appendix.

Parent topic: Trigonometric Transform Routines