I have a 3D array which is stored as a 1D array in a columnwise fashion. For example,

```
for( int k = 0; k < nk; k++ ) // Loop through the height.
    for( int j = 0; j < nj; j++ ) // Loop through the rows.
        for( int i = 0; i < ni; i++ ) // Loop through the columns.
        {
            ijk = i + ni * j + ni * nj * k;
            my3Darray[ ijk ] = 1.0;
        }

```

For my application, I need to access all the rows/columns/height of `my3Darray`. By height, I mean the vectors in the third dimension of the array. I need this because I want to process the FFT of each vector and return the resulted vector. I would be thankful to have my friends's thoughts in stackoverflow, how I can efficiently access these vectors. Of course one trivial possibility, for example, for the height vectors is:

```
for( int i = 0; i < ni; i++ ) // Loop through the columns.
    for( int j = 0; j < nj; j++ ) // Loop through the rows.
    {
        for( int k = 0; k < nk; k++ ) // Loop through the heights.
        {
            ijk = i + ni * j + ni * nj * k;
            myvec[ k ] = my3Darray[ ijk ];
            fft( myvec, myvec_processed );
        }

        // Store the results in a new array, which is storing myvec_processed in my3Darray_fft_values.
        for( int k = 0; k < nk; k++ ) // Loop through the heights.
        {
            ijk = i + ni * j + ni * nj * k;
            my3Darray_fft_values[ ijk ] = myvec_processed[ k ];
        }
    }

```

Am I computing this efficiently? Is there a possibility of passing `my3Darray` directly to the function which processes the FFT of the vectors (instead of copying the vector to `myvec`)?