001package com.nativelibs4java.opencl.util.fft; 002 003import com.nativelibs4java.opencl.*; 004import com.nativelibs4java.opencl.CLPlatform.DeviceFeature; 005import java.io.IOException; 006import java.nio.DoubleBuffer; 007 008/** 009 * OpenCL Fast Fourier Transform for array sizes that are powers of two (double precision floating point numbers) 010 */ 011public class DoubleFFTPow2 extends AbstractFFTPow2<Double, double[]> { 012 013 final DoubleFFTProgram program; 014 015 public DoubleFFTPow2(CLContext context) throws IOException, CLException { 016 super(context, Double.class); 017 this.program = new DoubleFFTProgram(context); 018 program.getProgram().setFastRelaxedMath(); 019 } 020 public DoubleFFTPow2() throws IOException { 021 this(JavaCL.createBestContext(DeviceFeature.DoubleSupport)); 022 } 023 024 protected CLEvent cooleyTukeyFFTTwiddleFactors(CLQueue queue, int N, CLBuffer<Double> buf, CLEvent... evts) throws CLException { 025 return program.cooleyTukeyFFTTwiddleFactors(queue, N, buf, new int[] { N / 2 }, null, evts); 026 } 027 protected CLEvent cooleyTukeyFFTCopy(CLQueue queue, CLBuffer<Double> inBuf, CLBuffer<Double> outBuf, int length, CLBuffer<Integer> offsetsBuf, boolean inverse, CLEvent... evts) throws CLException { 028 return program.cooleyTukeyFFTCopy(queue, inBuf, outBuf, length, offsetsBuf, inverse ? 1.0 / length : 1, new int[] { length }, null, evts); 029 } 030 protected CLEvent cooleyTukeyFFT(CLQueue queue, CLBuffer<Double> Y, int N, CLBuffer<Double> twiddleFactors, int inverse, int[] dims, CLEvent... evts) throws CLException { 031 return program.cooleyTukeyFFT(queue, Y, N, twiddleFactors, inverse, dims, null, evts); 032 } 033 } 034