ipopt-hs-0.4.0.1: haskell binding to ipopt and nlopt including automatic differentiation

Safe HaskellNone

Nlopt.Raw

Contents

Synopsis

converting haskell functions

NLOpt has three different types for functions FunPtrFunc FunPtrMFunc and FunPtrPrecond.

AD
means derivatives are calculated, and the haskell function does no IO.
G
mean you are providing the derivatives
M
means m functions are calculated at a time

toPrecondAD :: (forall a. AnyRFCxt a => Vector a -> a) -> PrecondSource

an exact hessian calculated with AD. See toPrecondG XXX BFGS approx could also be done...

toPrecondGSource

Arguments

:: (Vector vec Double, v ~ vec Double) 
=> (v -> v -> IO v)

given x,v calculate H(x)v where H the hessian

-> Precond 

toFuncMG :: (Vector n Double, Vector n (m Double), n ~ m) => (n Double -> IO (m Double)) -> (n Double -> IO (n (m Double))) -> MFuncSource

n and m type variables indicate the vector size as number of inputs and number of outputs respectively

toFuncMAD :: (forall a. AnyRFCxt a => Vector a -> Vector a) -> MFuncSource

toFuncAD :: (forall a. AnyRFCxt a => Vector a -> a) -> FuncSource

where the gradient happens via AD

toFuncGSource

Arguments

:: Vector v Double 
=> (v Double -> IO Double)
f
-> (v Double -> IO (v Double))
grad(f)
-> Func 

type family UnFunPtr a Source

newtype NLOpt Source

Constructors

NLOpt (ForeignPtr NLOpt) 

withNLOpt :: NLOpt -> (Ptr NLOpt -> IO b) -> IO bSource

nloptDestroy :: Ptr () -> IO ()Source

should not need to be called manually

constraints

stopping criteria

more algorithm-specific parameters

utils for ffi

much is copied from Ipopt.Raw

withNLOpt_ :: NLOpt -> (Ptr b1 -> IO b) -> IO bSource

copyInto :: (Integral n, Vector v Double) => n -> Ptr CDouble -> v Double -> IO ()Source

toCInt :: (Enum a, Num b) => a -> bSource

fromCInt :: (Enum a, Integral a1) => a1 -> aSource

peekInt :: (Integral a, Num b, Storable a) => Ptr a -> IO bSource

mkNloptFinalizer :: (Ptr () -> IO ()) -> IO (FunPtr (Ptr () -> IO ()))Source

withFunc :: Func -> (FunPtr Func -> IO b) -> IO bSource

withNull :: (Ptr a -> t) -> tSource

peekDouble :: Ptr CDouble -> IO DoubleSource

c2hs generates CDouble peek a Double instead

mXv :: Num a => Vector (Vector a) -> Vector a -> Vector aSource

naive matrix × vector

c2hs-generated

nloptCopy'_ :: Ptr () -> IO (Ptr ())Source