001package com.nativelibs4java.opencl.util;
002import com.nativelibs4java.opencl.CLAbstractUserProgram;
003import com.nativelibs4java.opencl.CLBuffer;
004import com.nativelibs4java.opencl.CLBuildException;
005import com.nativelibs4java.opencl.CLContext;
006import com.nativelibs4java.opencl.CLEvent;
007import com.nativelibs4java.opencl.CLKernel;
008import com.nativelibs4java.opencl.CLProgram;
009import com.nativelibs4java.opencl.CLQueue;
010import java.io.IOException;
011/** Wrapper around the OpenCL program LinearAlgebraKernels */
012public class LinearAlgebraKernels extends CLAbstractUserProgram {
013        public LinearAlgebraKernels(CLContext context) throws IOException {
014                super(context, readRawSourceForClass(LinearAlgebraKernels.class));
015        }
016        public LinearAlgebraKernels(CLProgram program) throws IOException {
017                super(program, readRawSourceForClass(LinearAlgebraKernels.class));
018        }
019        CLKernel mulMatDouble_kernel;
020        public synchronized CLEvent mulMatDouble(CLQueue commandQueue, CLBuffer<Double > a, int aColumns, CLBuffer<Double > b, int bColumns, CLBuffer<Double > c, int globalWorkSizes[], int localWorkSizes[], CLEvent... eventsToWaitFor) throws CLBuildException {
021                if ((mulMatDouble_kernel == null)) 
022                        mulMatDouble_kernel = createKernel("mulMatDouble");
023                mulMatDouble_kernel.setArgs(a, aColumns, b, bColumns, c);
024                return mulMatDouble_kernel.enqueueNDRange(commandQueue, globalWorkSizes, localWorkSizes, eventsToWaitFor);
025        }
026        CLKernel mulVecDouble_kernel;
027        public synchronized CLEvent mulVecDouble(CLQueue commandQueue, CLBuffer<Double > a, int aColumns, CLBuffer<Double > b, int bSize, CLBuffer<Double > c, int globalWorkSizes[], int localWorkSizes[], CLEvent... eventsToWaitFor) throws CLBuildException {
028                if ((mulVecDouble_kernel == null)) 
029                        mulVecDouble_kernel = createKernel("mulVecDouble");
030                mulVecDouble_kernel.setArgs(a, aColumns, b, bSize, c);
031                return mulVecDouble_kernel.enqueueNDRange(commandQueue, globalWorkSizes, localWorkSizes, eventsToWaitFor);
032        }
033        CLKernel transposeDouble_kernel;
034        public synchronized CLEvent transposeDouble(CLQueue commandQueue, CLBuffer<Double > a, int aRows, int aColumns, CLBuffer<Double > out, int globalWorkSizes[], int localWorkSizes[], CLEvent... eventsToWaitFor) throws CLBuildException {
035                if ((transposeDouble_kernel == null)) 
036                        transposeDouble_kernel = createKernel("transposeDouble");
037                transposeDouble_kernel.setArgs(a, aRows, aColumns, out);
038                return transposeDouble_kernel.enqueueNDRange(commandQueue, globalWorkSizes, localWorkSizes, eventsToWaitFor);
039        }
040        CLKernel mulMatFloat_kernel;
041        public synchronized CLEvent mulMatFloat(CLQueue commandQueue, CLBuffer<Float > a, int aColumns, CLBuffer<Float > b, int bColumns, CLBuffer<Float > c, int globalWorkSizes[], int localWorkSizes[], CLEvent... eventsToWaitFor) throws CLBuildException {
042                if ((mulMatFloat_kernel == null)) 
043                        mulMatFloat_kernel = createKernel("mulMatFloat");
044                mulMatFloat_kernel.setArgs(a, aColumns, b, bColumns, c);
045                return mulMatFloat_kernel.enqueueNDRange(commandQueue, globalWorkSizes, localWorkSizes, eventsToWaitFor);
046        }
047        CLKernel mulVecFloat_kernel;
048        public synchronized CLEvent mulVecFloat(CLQueue commandQueue, CLBuffer<Float > a, int aColumns, CLBuffer<Float > b, int bSize, CLBuffer<Float > c, int globalWorkSizes[], int localWorkSizes[], CLEvent... eventsToWaitFor) throws CLBuildException {
049                if ((mulVecFloat_kernel == null)) 
050                        mulVecFloat_kernel = createKernel("mulVecFloat");
051                mulVecFloat_kernel.setArgs(a, aColumns, b, bSize, c);
052                return mulVecFloat_kernel.enqueueNDRange(commandQueue, globalWorkSizes, localWorkSizes, eventsToWaitFor);
053        }
054        CLKernel transposeFloat_kernel;
055        public synchronized CLEvent transposeFloat(CLQueue commandQueue, CLBuffer<Float > a, int aRows, int aColumns, CLBuffer<Float > out, int globalWorkSizes[], int localWorkSizes[], CLEvent... eventsToWaitFor) throws CLBuildException {
056                if ((transposeFloat_kernel == null)) 
057                        transposeFloat_kernel = createKernel("transposeFloat");
058                transposeFloat_kernel.setArgs(a, aRows, aColumns, out);
059                return transposeFloat_kernel.enqueueNDRange(commandQueue, globalWorkSizes, localWorkSizes, eventsToWaitFor);
060        }
061}