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 * Slow OpenCL Fourier Transform that works in all cases (double precision floating point numbers)
010 */
011public class DoubleDFT extends AbstractDFT<Double, double[]> {
012
013    final DoubleDFTProgram program;
014
015    public DoubleDFT(CLContext context) throws IOException {
016        super(context, Double.class);
017        this.program = new DoubleDFTProgram(context);
018    }
019    public DoubleDFT() throws IOException {
020        this(JavaCL.createBestContext(DeviceFeature.DoubleSupport));
021    }
022
023    @Override
024    protected CLEvent dft(CLQueue queue, CLBuffer<Double> inBuf, CLBuffer<Double> outBuf, int length, int sign, int[] dims, CLEvent... events) throws CLException {
025        return program.dft(queue, (CLBuffer<Double>)inBuf, (CLBuffer<Double>)outBuf, length, sign, dims, null, events);
026    }
027 }