com.nativelibs4java.opencl.util.fft.AbstractDFT Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javacl Show documentation
Show all versions of javacl Show documentation
JavaCL is an Object-Oriented API that makes the C OpenCL API available to Java in a very natural way.
It hides away the complexity of cross-platform C bindings, has a clean OO design (with generics, Java enums, NIO buffers, fully typed exceptions...), provides high-level features (OpenGL-interop, array reductions) and comes with samples and demos.
For more info, please visit http://code.google.com/p/nativelibs4java/wiki/OpenCL.
package com.nativelibs4java.opencl.util.fft;
import com.nativelibs4java.opencl.*;
import com.nativelibs4java.opencl.util.Transformer.AbstractTransformer;
import java.io.IOException;
import java.nio.Buffer;
abstract class AbstractDFT extends AbstractTransformer {
// package-private constructor
AbstractDFT(CLContext context, Class primitiveClass) throws IOException, CLException {
super(context, primitiveClass);
}
protected abstract CLEvent dft(CLQueue queue, CLBuffer inBuf, CLBuffer outBuf, int length, int sign, int[] dims, CLEvent... events) throws CLException;
@Override
public CLEvent transform(CLQueue queue, CLBuffer inBuf, CLBuffer outBuf, boolean inverse, CLEvent... eventsToWaitFor) throws CLException {
int length = (int)inBuf.getElementCount() / 2;
return dft(queue, inBuf, outBuf, length, inverse ? -1 : 1, new int[]{length}, eventsToWaitFor);
}
}