[not important] mkl examples (complex_1d_double_ex1.c), allocating memory

[not important] mkl examples (complex_1d_double_ex1.c), allocating memory

Hija all

The mkl example (e.g.) complex_1d_double_ex1.c allocates memory as

/*
** Allocate array for input data
*/
x_in = (mkl_double_complex*)malloc(2*n*sizeof(double));
x_exp = (mkl_double_complex*)malloc(2*n*sizeof(double));

Would it not be 'nicer' to use?

//allocate memory
x = (mkl_double_complex*) malloc(n*sizeof(mkl_double_complex));
y = (mkl_double_complex*) malloc(n*sizeof(mkl_double_complex));

Thanks for your help

Erich

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Erich,

Strictly speaking, it would be nice to correctMKL examplesusing namely MKL complex types (see mkl_types.h). But currently, in DFTC exampes thereare introduced another additional types: mkl_double_complex and mkl_float_complex instead of using MKL_Complex16 and MKL_Complex8.

As to using sizeof(mkl_double_complex) instead of 2*sizeof(double), I guess, it's just a matter of taste.
Because these values are the same.

And if validation of results is made by calculation with complex numbers then they should be defined as complex. But currently in DFTC examples all support functions are implemented as interleaved real numbers (see source/dfti_example_support.c)

Thanks,
-- Victor

Leave a Comment

Please sign in to add a comment. Not a member? Join today