Do more. Code less. Free software for GPU computing.
<scroll to top>

examples/misc/fft.cpp

#include <cuda.h>
#include <stdio.h>
#include <arrayfire.h>

using namespace af;

int main(int argc, char **argv)
{
    try{
        array A = af::fft(randu(3,3));
        print(A);
        cuComplex *B = A.host<cuComplex>();

        float real = cuCrealf(*B), imag = cuCimagf(*B);
        printf("B[0] = %g %c %gi\n",
               real,
               imag< 0 ? '-' : '+',
               imag);
    } catch (af::exception& e) {
        fprintf(stderr, "%s\n", e.what());
    }

    #ifdef WIN32 // pause in Windows
    if (!(argc == 2 && argv[1][0] == '-')) {
        printf("hit [enter]...");
        getchar();
    }
    #endif
    return 0;
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines