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

Safe HaskellNone
LanguageHaskell2010

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 => V.Vector a -> a) -> Precond Source

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

toPrecondG Source

Arguments

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

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

-> Precond 

toFuncMG :: (VG.Vector n Double, VG.Vector n (m Double), n ~ m) => (n Double -> IO (m Double)) -> (n Double -> IO (n (m Double))) -> MFunc Source

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

toFuncMAD :: (forall a. AnyRFCxt a => V.Vector a -> V.Vector a) -> MFunc Source

toFuncAD :: (forall a. AnyRFCxt a => V.Vector a -> a) -> Func Source

where the gradient happens via AD

toFuncG Source

Arguments

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

type family UnFunPtr a Source

Instances

newtype NLOpt Source

nloptDestroy :: C2HSImp.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 -> (C2HSImp.Ptr b1 -> IO b) -> IO b Source

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

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

withNull :: (C2HSImp.Ptr a -> t) -> t Source

peekDouble :: C2HSImp.Ptr C2HSImp.CDouble -> IO Double Source

c2hs generates CDouble peek a Double instead

mXv :: Num a => V.Vector (V.Vector a) -> V.Vector a -> V.Vector a Source

naive matrix × vector

c2hs-generated