casadi-bindings-1.8.2.1: Casadi/Wrappers/Classes/MXFunction.hs
{-# OPTIONS_GHC -Wall #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# Language ForeignFunctionInterface #-}
{-# Language FlexibleInstances #-}
{-# Language MultiParamTypeClasses #-}
module Casadi.Wrappers.Classes.MXFunction
(
MXFunction,
MXFunctionClass(..),
mxFunction,
mxFunction',
mxFunction_checkNode,
mxFunction_countNodes,
mxFunction_generateLiftingFunctions,
mxFunction_getAlgorithmSize,
mxFunction_getFree,
mxFunction_getWorkSize,
mxFunction_grad,
mxFunction_jac,
) where
import Prelude hiding ( Functor )
import Data.Vector ( Vector )
import Foreign.C.Types
import Foreign.Ptr ( Ptr )
import Foreign.ForeignPtr ( newForeignPtr )
import System.IO.Unsafe ( unsafePerformIO ) -- for show instances
import Casadi.Wrappers.Classes.PrintableObject
import Casadi.Wrappers.CToolsInstances ( )
import Casadi.Wrappers.Data
import Casadi.Wrappers.Enums
import Casadi.MarshalTypes ( CppVec, StdString' ) -- StdOstream'
import Casadi.Marshal ( Marshal(..), withMarshal )
import Casadi.WrapReturn ( WrapReturn(..) )
instance Show MXFunction where
show = unsafePerformIO . printableObject_getDescription
-- direct wrapper
foreign import ccall unsafe "CasADi__MXFunction__getAlgorithmSize" c_CasADi__MXFunction__getAlgorithmSize
:: Ptr MXFunction' -> IO CInt
casADi__MXFunction__getAlgorithmSize
:: MXFunction -> IO Int
casADi__MXFunction__getAlgorithmSize x0 =
withMarshal x0 $ \x0' ->
c_CasADi__MXFunction__getAlgorithmSize x0' >>= wrapReturn
-- classy wrapper
{-|
>Get the number of atomic operations.
-}
mxFunction_getAlgorithmSize :: MXFunctionClass a => a -> IO Int
mxFunction_getAlgorithmSize x = casADi__MXFunction__getAlgorithmSize (castMXFunction x)
-- direct wrapper
foreign import ccall unsafe "CasADi__MXFunction__getWorkSize" c_CasADi__MXFunction__getWorkSize
:: Ptr MXFunction' -> IO CInt
casADi__MXFunction__getWorkSize
:: MXFunction -> IO Int
casADi__MXFunction__getWorkSize x0 =
withMarshal x0 $ \x0' ->
c_CasADi__MXFunction__getWorkSize x0' >>= wrapReturn
-- classy wrapper
{-|
>Get the length of the work vector.
-}
mxFunction_getWorkSize :: MXFunctionClass a => a -> IO Int
mxFunction_getWorkSize x = casADi__MXFunction__getWorkSize (castMXFunction x)
-- direct wrapper
foreign import ccall unsafe "CasADi__MXFunction__countNodes" c_CasADi__MXFunction__countNodes
:: Ptr MXFunction' -> IO CInt
casADi__MXFunction__countNodes
:: MXFunction -> IO Int
casADi__MXFunction__countNodes x0 =
withMarshal x0 $ \x0' ->
c_CasADi__MXFunction__countNodes x0' >>= wrapReturn
-- classy wrapper
{-|
>Number of nodes in the algorithm.
-}
mxFunction_countNodes :: MXFunctionClass a => a -> IO Int
mxFunction_countNodes x = casADi__MXFunction__countNodes (castMXFunction x)
-- direct wrapper
foreign import ccall unsafe "CasADi__MXFunction__checkNode" c_CasADi__MXFunction__checkNode
:: Ptr MXFunction' -> IO CInt
casADi__MXFunction__checkNode
:: MXFunction -> IO Bool
casADi__MXFunction__checkNode x0 =
withMarshal x0 $ \x0' ->
c_CasADi__MXFunction__checkNode x0' >>= wrapReturn
-- classy wrapper
{-|
>Check if the node is pointing to the right type of object.
-}
mxFunction_checkNode :: MXFunctionClass a => a -> IO Bool
mxFunction_checkNode x = casADi__MXFunction__checkNode (castMXFunction x)
-- direct wrapper
foreign import ccall unsafe "CasADi__MXFunction__jac" c_CasADi__MXFunction__jac
:: Ptr MXFunction' -> CInt -> CInt -> CInt -> CInt -> IO (Ptr MX')
casADi__MXFunction__jac
:: MXFunction -> Int -> Int -> Bool -> Bool -> IO MX
casADi__MXFunction__jac x0 x1 x2 x3 x4 =
withMarshal x0 $ \x0' ->
withMarshal x1 $ \x1' ->
withMarshal x2 $ \x2' ->
withMarshal x3 $ \x3' ->
withMarshal x4 $ \x4' ->
c_CasADi__MXFunction__jac x0' x1' x2' x3' x4' >>= wrapReturn
-- classy wrapper
{-|
>Jacobian via source code transformation.
-}
mxFunction_jac :: MXFunctionClass a => a -> Int -> Int -> Bool -> Bool -> IO MX
mxFunction_jac x = casADi__MXFunction__jac (castMXFunction x)
-- direct wrapper
foreign import ccall unsafe "CasADi__MXFunction__grad" c_CasADi__MXFunction__grad
:: Ptr MXFunction' -> CInt -> CInt -> IO (Ptr MX')
casADi__MXFunction__grad
:: MXFunction -> Int -> Int -> IO MX
casADi__MXFunction__grad x0 x1 x2 =
withMarshal x0 $ \x0' ->
withMarshal x1 $ \x1' ->
withMarshal x2 $ \x2' ->
c_CasADi__MXFunction__grad x0' x1' x2' >>= wrapReturn
-- classy wrapper
{-|
>Gradient via source code transformation.
-}
mxFunction_grad :: MXFunctionClass a => a -> Int -> Int -> IO MX
mxFunction_grad x = casADi__MXFunction__grad (castMXFunction x)
-- direct wrapper
foreign import ccall unsafe "CasADi__MXFunction__getFree" c_CasADi__MXFunction__getFree
:: Ptr MXFunction' -> IO (Ptr (CppVec (Ptr MX')))
casADi__MXFunction__getFree
:: MXFunction -> IO (Vector MX)
casADi__MXFunction__getFree x0 =
withMarshal x0 $ \x0' ->
c_CasADi__MXFunction__getFree x0' >>= wrapReturn
-- classy wrapper
{-|
>Get all the free variables of the function.
-}
mxFunction_getFree :: MXFunctionClass a => a -> IO (Vector MX)
mxFunction_getFree x = casADi__MXFunction__getFree (castMXFunction x)
-- direct wrapper
foreign import ccall unsafe "CasADi__MXFunction__generateLiftingFunctions" c_CasADi__MXFunction__generateLiftingFunctions
:: Ptr MXFunction' -> Ptr MXFunction' -> Ptr MXFunction' -> IO ()
casADi__MXFunction__generateLiftingFunctions
:: MXFunction -> MXFunction -> MXFunction -> IO ()
casADi__MXFunction__generateLiftingFunctions x0 x1 x2 =
withMarshal x0 $ \x0' ->
withMarshal x1 $ \x1' ->
withMarshal x2 $ \x2' ->
c_CasADi__MXFunction__generateLiftingFunctions x0' x1' x2' >>= wrapReturn
-- classy wrapper
{-|
>Extract the functions needed for the Lifted Newton method.
-}
mxFunction_generateLiftingFunctions :: MXFunctionClass a => a -> MXFunction -> MXFunction -> IO ()
mxFunction_generateLiftingFunctions x = casADi__MXFunction__generateLiftingFunctions (castMXFunction x)
-- direct wrapper
foreign import ccall unsafe "CasADi__MXFunction__MXFunction_TIC" c_CasADi__MXFunction__MXFunction_TIC
:: Ptr FX' -> IO (Ptr MXFunction')
casADi__MXFunction__MXFunction'
:: FX -> IO MXFunction
casADi__MXFunction__MXFunction' x0 =
withMarshal x0 $ \x0' ->
c_CasADi__MXFunction__MXFunction_TIC x0' >>= wrapReturn
-- classy wrapper
mxFunction' :: FX -> IO MXFunction
mxFunction' = casADi__MXFunction__MXFunction'
-- direct wrapper
foreign import ccall unsafe "CasADi__MXFunction__MXFunction" c_CasADi__MXFunction__MXFunction
:: Ptr (CppVec (Ptr MX')) -> Ptr (CppVec (Ptr MX')) -> IO (Ptr MXFunction')
casADi__MXFunction__MXFunction
:: Vector MX -> Vector MX -> IO MXFunction
casADi__MXFunction__MXFunction x0 x1 =
withMarshal x0 $ \x0' ->
withMarshal x1 $ \x1' ->
c_CasADi__MXFunction__MXFunction x0' x1' >>= wrapReturn
-- classy wrapper
{-|
>> CasADi::MXFunction::MXFunction()
>------------------------------------------------------------------------
>
>Default constructor.
>
>> CasADi::MXFunction::MXFunction(const FX &fx)
>------------------------------------------------------------------------
>
>Attempt to form an MXFunction out of an FX.
>
>> CasADi::MXFunction::MXFunction(const MX &input, const MX &output)
>------------------------------------------------------------------------
>
>Single input, single output.
>
>> CasADi::MXFunction::MXFunction(const MX &input, const std::vector< MX > &output)
>------------------------------------------------------------------------
>
>Single input, multiple output.
>
>> CasADi::MXFunction::MXFunction(const std::vector< MX > &input, const MX &output)
>------------------------------------------------------------------------
>
>Multiple input, single output.
>
>> CasADi::MXFunction::MXFunction(const std::vector< MX > &input, const std::vector< MX > &output)
>
>> CasADi::MXFunction::MXFunction(const std::vector< MX > &input, const IOSchemeVector< MX > &output)
>
>> CasADi::MXFunction::MXFunction(const IOSchemeVector< MX > &input, const std::vector< MX > &output)
>
>> CasADi::MXFunction::MXFunction(const IOSchemeVector< MX > &input, const IOSchemeVector< MX > &output)
>------------------------------------------------------------------------
>
>Multiple input, multiple output.
-}
mxFunction :: Vector MX -> Vector MX -> IO MXFunction
mxFunction = casADi__MXFunction__MXFunction