# cufft problem with real-to-complex 1d transform

Greetings,

I’ve one problem with che cufft library:

when i calculate 1d transform Real-to-Complex of an array of 500 elements
the function returns an array where the first 251 positions are the coefficients and the other 249 are ‘nan’-

this because (i suppose) the transform of a real function is simmetric, so i can calculate the 249 missing elements simply copying
the complex coniugate of the first 250 elements.

here the question:
in which position is the freq 0 in the array that the function returns? 0 or 251?

nobody can help me?

Here’s a crazy idea: give as input a DC signal. Examine output for non-zero values.

Good Idea!

i tried with a box function:

``````cufftReal box[] = {0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,0.0,0.0,0.0

,0.0,0.0};
``````

and the output is:

``````tra[0].x: 3.000000 tra[0].y: 0.000000

tra[1].x: -2.816163 tra[1].y: -0.526432

tra[2].x: 2.310682 tra[2].y: 0.895164

tra[3].x: -1.608166 tra[3].y: -0.995735

tra[4].x: 0.875383 tra[4].y: 0.798018

tra[5].x: -0.272797 tra[5].y: -0.361242

tra[6].x: -0.091496 tra[6].y: -0.183749

tra[7].x: 0.191684 tra[7].y: 0.673696

tra[8].x: -0.089125 tra[8].y: -0.961825

tra[9].x: -nan tra[9].y: -nan

tra[10].x: -nan tra[10].y: -nan

tra[11].x: -nan tra[11].y: -168810647249264880326041152057895813120.000000

tra[12].x: -nan tra[12].y: -1.873534

tra[13].x: -nan tra[13].y: -nan

tra[14].x: 170141153036854826254181667795007176704.000000 tra[14].y: -31127745928385003520.000000

tra[15].x: -nan tra[15].y: -nan

tra[16].x: -158446644177238792414399823872.000000 tra[16].y: -2417556347208890920730624.000000
``````

tra.x is the real part of the transform and tra.y is the imaginary part…

so the freq 0 is stored in pos 0 ( [3] + [0]i ).