Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library
- [not important] mkl examples (complex_1d_double_ex1.c), allocating memory

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Erich_Zwyssig

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-08-2010
03:02 AM

78 Views

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

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

Link Copied

1 Reply

barragan_villanueva_

Valued Contributor I

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-08-2010
03:45 AM

78 Views

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)

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

For more complete information about compiler optimizations, see our Optimization Notice.