-- GENERATED by C->Haskell Compiler, version 0.28.2 Switcheroo, 1 April 2016 (Haskell)
-- Edit the ORIGNAL .chs file instead!


{-# LINE 1 "./Foreign/CUDA/FFT/Execute.chs" #-}
{-# LANGUAGE CPP                      #-}
{-# LANGUAGE ForeignFunctionInterface #-}

module Foreign.CUDA.FFT.Execute (
  execC2C,execZ2Z,
  execR2C,execD2Z,
  execC2R,execZ2D,
) where
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.Ptr as C2HSImp



-- Friends
import Foreign.CUDA.FFT.Error
import Foreign.CUDA.FFT.Plan
import Foreign.CUDA.FFT.Internal.C2HS

import Foreign.CUDA.Ptr

-- System
import Foreign
import Foreign.C



{-# LINE 22 "./Foreign/CUDA/FFT/Execute.chs" #-}


-- | Executes a single-precision complex-to-complex transform plan in the
-- transform direction specified by the fourth argument
--
execC2C :: Handle -> DevicePtr Float -> DevicePtr Float -> Int -> IO ()
execC2C ctx i o dir = nothingIfOk =<< cufftExecC2C ctx i o dir

cufftExecC2C :: (Handle) -> (DevicePtr Float) -> (DevicePtr Float) -> (Int) -> IO ((Result))
cufftExecC2C a1 a2 a3 a4 =
  let {a1' = useHandle a1} in 
  let {a2' = useDev a2} in 
  let {a3' = useDev a3} in 
  let {a4' = fromIntegral a4} in 
  cufftExecC2C'_ a1' a2' a3' a4' >>= \res ->
  let {res' = cToEnum res} in
  return (res')

{-# LINE 34 "./Foreign/CUDA/FFT/Execute.chs" #-}

  where
    useDev      = useDevicePtr . castDevPtr

-- | Executes a double-precision complex-to-complex transform plan in the
-- transform direction specified by the fourth argument
--
execZ2Z :: Handle -> DevicePtr Double -> DevicePtr Double -> Int -> IO ()
execZ2Z ctx i o dir = nothingIfOk =<< cufftExecZ2Z ctx i o dir

cufftExecZ2Z :: (Handle) -> (DevicePtr Double) -> (DevicePtr Double) -> (Int) -> IO ((Result))
cufftExecZ2Z a1 a2 a3 a4 =
  let {a1' = useHandle a1} in 
  let {a2' = useDev a2} in 
  let {a3' = useDev a3} in 
  let {a4' = fromIntegral a4} in 
  cufftExecZ2Z'_ a1' a2' a3' a4' >>= \res ->
  let {res' = cToEnum res} in
  return (res')

{-# LINE 48 "./Foreign/CUDA/FFT/Execute.chs" #-}

  where
    useDev      = useDevicePtr . castDevPtr

-- | Executes a single-precision real-to-complex (implicitly forward)
-- transform plan
--
execR2C :: Handle -> DevicePtr Float -> DevicePtr Float -> IO ()
execR2C ctx i o = nothingIfOk =<< cufftExecR2C ctx i o

cufftExecR2C :: (Handle) -> (DevicePtr Float) -> (DevicePtr Float) -> IO ((Result))
cufftExecR2C a1 a2 a3 =
  let {a1' = useHandle a1} in 
  let {a2' = useDev a2} in 
  let {a3' = useDev a3} in 
  cufftExecR2C'_ a1' a2' a3' >>= \res ->
  let {res' = cToEnum res} in
  return (res')

{-# LINE 61 "./Foreign/CUDA/FFT/Execute.chs" #-}

  where
    useDev      = useDevicePtr . castDevPtr

-- | Executes a double-precision real-to-complex (implicitly forward)
-- transform plan
--
execD2Z :: Handle -> DevicePtr Double -> DevicePtr Double -> IO ()
execD2Z ctx i o = nothingIfOk =<< cufftExecD2Z ctx i o

cufftExecD2Z :: (Handle) -> (DevicePtr Double) -> (DevicePtr Double) -> IO ((Result))
cufftExecD2Z a1 a2 a3 =
  let {a1' = useHandle a1} in 
  let {a2' = useDev a2} in 
  let {a3' = useDev a3} in 
  cufftExecD2Z'_ a1' a2' a3' >>= \res ->
  let {res' = cToEnum res} in
  return (res')

{-# LINE 74 "./Foreign/CUDA/FFT/Execute.chs" #-}

  where
    useDev      = useDevicePtr . castDevPtr

-- | Executes a single-precision complex-to-real (implicitly forward)
-- transform plan
--
execC2R :: Handle -> DevicePtr Float -> DevicePtr Float -> IO ()
execC2R ctx i o = nothingIfOk =<< cufftExecC2R ctx i o

cufftExecC2R :: (Handle) -> (DevicePtr Float) -> (DevicePtr Float) -> IO ((Result))
cufftExecC2R a1 a2 a3 =
  let {a1' = useHandle a1} in 
  let {a2' = useDev a2} in 
  let {a3' = useDev a3} in 
  cufftExecC2R'_ a1' a2' a3' >>= \res ->
  let {res' = cToEnum res} in
  return (res')

{-# LINE 87 "./Foreign/CUDA/FFT/Execute.chs" #-}

  where
    useDev      = useDevicePtr . castDevPtr

-- | Executes a double-precision complex-to-real (implicitly forward)
-- transform plan
--
execZ2D :: Handle -> DevicePtr Double -> DevicePtr Double -> IO ()
execZ2D ctx i o = nothingIfOk =<< cufftExecZ2D ctx i o

cufftExecZ2D :: (Handle) -> (DevicePtr Double) -> (DevicePtr Double) -> IO ((Result))
cufftExecZ2D a1 a2 a3 =
  let {a1' = useHandle a1} in 
  let {a2' = useDev a2} in 
  let {a3' = useDev a3} in 
  cufftExecZ2D'_ a1' a2' a3' >>= \res ->
  let {res' = cToEnum res} in
  return (res')

{-# LINE 100 "./Foreign/CUDA/FFT/Execute.chs" #-}

  where
    useDev      = useDevicePtr . castDevPtr
foreign import ccall unsafe "Foreign/CUDA/FFT/Execute.chs.h cufftExecC2C"
  cufftExecC2C'_ :: (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO C2HSImp.CInt)))))

foreign import ccall unsafe "Foreign/CUDA/FFT/Execute.chs.h cufftExecZ2Z"
  cufftExecZ2Z'_ :: (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO C2HSImp.CInt)))))

foreign import ccall unsafe "Foreign/CUDA/FFT/Execute.chs.h cufftExecR2C"
  cufftExecR2C'_ :: (C2HSImp.CInt -> ((C2HSImp.Ptr C2HSImp.CFloat) -> ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))))

foreign import ccall unsafe "Foreign/CUDA/FFT/Execute.chs.h cufftExecD2Z"
  cufftExecD2Z'_ :: (C2HSImp.CInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))))

foreign import ccall unsafe "Foreign/CUDA/FFT/Execute.chs.h cufftExecC2R"
  cufftExecC2R'_ :: (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr C2HSImp.CFloat) -> (IO C2HSImp.CInt))))

foreign import ccall unsafe "Foreign/CUDA/FFT/Execute.chs.h cufftExecZ2D"
  cufftExecZ2D'_ :: (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (IO C2HSImp.CInt))))