From 2b4580fa966ca3bddaaf3276a31b09a056c48cea Mon Sep 17 00:00:00 2001 From: Yuto Makino Date: Tue, 8 Aug 2023 17:12:51 +0900 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E8=A6=8F=E3=83=95=E3=82=A1=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E3=82=92=E3=82=A2=E3=83=83=E3=83=97=E3=83=AD=E3=83=BC?= =?UTF-8?q?=E3=83=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "CUDA\350\252\262\351\241\214/cfft.c" | 42 +++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 "CUDA\350\252\262\351\241\214/cfft.c" diff --git "a/CUDA\350\252\262\351\241\214/cfft.c" "b/CUDA\350\252\262\351\241\214/cfft.c" new file mode 100644 index 0000000..d04349e --- /dev/null +++ "b/CUDA\350\252\262\351\241\214/cfft.c" @@ -0,0 +1,42 @@ +#include +#include +#include +#define N 512 // FFTのサンプル数 + +int main( void ){ + + int i; + + fftw_complex *a, *b; + a = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N); + b = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N); + + fftw_plan plan; + plan = fftw_plan_dft_1d(N, a, b, FFTW_FORWARD, FFTW_ESTIMATE ); + + for (i = 0; i < N; i++) { + a[i] = i + 0.0 * I; + } + + // フーリエ変換実行 b[n]に計算結果が入る + fftw_execute(plan); + fftw_plan plan; + plan = fftw_plan_dft_1d(N, a, b, FFTW_FORWARD, FFTW_ESTIMATE ); + + for (i = 0; i < N; i++) { + a[i] = i + 0.0 * I; + } + + // フーリエ変換実行 b[n]に計算結果が入る + fftw_execute(plan); + + for( i=0; i