-- GENERATED by C->Haskell Compiler, version 0.28.8 Switcheroo, 25 November 2017 (Haskell)
-- Edit the ORIGNAL .chs file instead!


{-# LINE 1 "./QuantLib/Process.chs" #-}
{-# LANGUAGE FlexibleInstances #-}
module QuantLib.Process
  (
    -- * Types
    -- ** Process hierarchy
    GenStochasticProcess
  , StochasticProcess
  , GenStochasticProcess1D
  , StochasticProcess1D
  , GenGeneralizedBlackScholesProcess
  , GeneralizedBlackScholesProcess
  , BlackProcess
  , ExtOUWithJumpsProcess
  , ExtendedOrnsteinUhlenbeckProcess
  , GJRGARCHProcess
  , GenHestonProcess
  , HestonProcess
  , HestonSLVProcess
  , BatesProcess
  , G2Process
  , G2ForwardProcess
  , HybridHestonHullWhiteProcess
  , KlugeExtOUProcess
  , LiborForwardModelProcess
  , StochasticProcessArray
  , VarianceGammaProcess
  , Merton76Process
  , HullWhiteProcess
  , HullWhiteForwardProcess

    -- ** Discretization schemes
  , ProcessDiscretization(..)
  , ExtendedBlackScholesMertonProcessDiscretization(..)
  , ExtendedOrnsteinUhlenbeckProcessDiscretization(..)
  , HestonProcessDiscretization(..)
  , GJRGARCHProcessDiscretization(..)
  , HybridHestonHullWhiteProcessDiscretization(..)

    -- * Constructors
    -- ** Hierarchy conversion
  , asStochasticProcess
  , asStochasticProcess1D
  , asGeneralizedBlackScholesProcess
  , asHestonProcess

    -- ** Black-Scholes processes
  , blackProcess
  , blackScholesMertonProcess
  , blackScholesProcess
  , extendedBlackScholesMertonProcess
  , garmanKohlhagenProcess
  , generalizedBlackScholesProcess
  , squareRootProcess
  , vegaStressedBlackScholesProcess

    -- ** Other processes
  , batesProcess
  , extOuWithJumpsProcess
  , g2ForwardProcess
  , g2Process
  , gemanRoncoroniProcess
  , geometricBrownianMotionProcess
  , gjrGarchProcess
  , hestonProcess
  , hestonSlvProcess
  , hullWhiteForwardProcess
  , hullWhiteProcess
  , hybridHestonHullWhiteProcess
  , klugeExtOuProcess
  , withExtendedOrnsteinUhlenbeckProcess
  , linearSeasonalOrnsteinUhlenbeckProcess
  , liborForwardModelProcess
  , merton76Process
  , ornsteinUhlenbeckProcess
  , varianceGammaProcess
  , stochasticProcessArray

    -- * Mutators
  , HasForwardMeasureTime(..)

    -- * Inspectors
    -- ** Process dynamics
  , apply
  , covariance
  , diffusion
  , drift
  , evolve
  , expectation
  , stdDeviation
  , pdf
  , discountBond
    -- ** Process state
  , factors
  , initialValues
  , fixingDates
  , fixingTimes
  , cashFlows
  , index
  , accrualTimes
    -- ** Short-rate and forward-measure quantities
  , HasPhi(..)
  , HasShortRate(..)
  , HasAlpha(..)
  , bFunction
  , mFunction
  , numeraire

  , thetaAt
  ) where
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.ForeignPtr as C2HSImp
import qualified Foreign.Marshal.Utils as C2HSImp
import qualified Foreign.Ptr as C2HSImp
import qualified System.IO.Unsafe as C2HSImp







import QuantLib.Internal
import QuantLib.Internal.Type
import Data.List.NonEmpty(NonEmpty, toList)
import Foreign.Ptr(FunPtr)

data ProcessDiscretization = EulerDiscretization
                           | EndEulerDiscretization
  deriving (Int -> ProcessDiscretization -> ShowS
[ProcessDiscretization] -> ShowS
ProcessDiscretization -> String
(Int -> ProcessDiscretization -> ShowS)
-> (ProcessDiscretization -> String)
-> ([ProcessDiscretization] -> ShowS)
-> Show ProcessDiscretization
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ProcessDiscretization -> ShowS
showsPrec :: Int -> ProcessDiscretization -> ShowS
$cshow :: ProcessDiscretization -> String
show :: ProcessDiscretization -> String
$cshowList :: [ProcessDiscretization] -> ShowS
showList :: [ProcessDiscretization] -> ShowS
Show,ProcessDiscretization -> ProcessDiscretization -> Bool
(ProcessDiscretization -> ProcessDiscretization -> Bool)
-> (ProcessDiscretization -> ProcessDiscretization -> Bool)
-> Eq ProcessDiscretization
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ProcessDiscretization -> ProcessDiscretization -> Bool
== :: ProcessDiscretization -> ProcessDiscretization -> Bool
$c/= :: ProcessDiscretization -> ProcessDiscretization -> Bool
/= :: ProcessDiscretization -> ProcessDiscretization -> Bool
Eq,ReadPrec [ProcessDiscretization]
ReadPrec ProcessDiscretization
Int -> ReadS ProcessDiscretization
ReadS [ProcessDiscretization]
(Int -> ReadS ProcessDiscretization)
-> ReadS [ProcessDiscretization]
-> ReadPrec ProcessDiscretization
-> ReadPrec [ProcessDiscretization]
-> Read ProcessDiscretization
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS ProcessDiscretization
readsPrec :: Int -> ReadS ProcessDiscretization
$creadList :: ReadS [ProcessDiscretization]
readList :: ReadS [ProcessDiscretization]
$creadPrec :: ReadPrec ProcessDiscretization
readPrec :: ReadPrec ProcessDiscretization
$creadListPrec :: ReadPrec [ProcessDiscretization]
readListPrec :: ReadPrec [ProcessDiscretization]
Read)
instance Enum ProcessDiscretization where
  succ :: ProcessDiscretization -> ProcessDiscretization
succ ProcessDiscretization
EulerDiscretization = ProcessDiscretization
EndEulerDiscretization
  succ ProcessDiscretization
EndEulerDiscretization = String -> ProcessDiscretization
forall a. HasCallStack => String -> a
error String
"ProcessDiscretization.succ: EndEulerDiscretization has no successor"

  pred :: ProcessDiscretization -> ProcessDiscretization
pred ProcessDiscretization
EndEulerDiscretization = ProcessDiscretization
EulerDiscretization
  pred ProcessDiscretization
EulerDiscretization = String -> ProcessDiscretization
forall a. HasCallStack => String -> a
error String
"ProcessDiscretization.pred: EulerDiscretization has no predecessor"

  enumFromTo :: ProcessDiscretization
-> ProcessDiscretization -> [ProcessDiscretization]
enumFromTo ProcessDiscretization
from ProcessDiscretization
to = ProcessDiscretization -> [ProcessDiscretization]
forall {t}. Enum t => t -> [t]
go ProcessDiscretization
from
    where
      end :: Int
end = ProcessDiscretization -> Int
forall a. Enum a => a -> Int
fromEnum ProcessDiscretization
to
      go :: t -> [t]
go t
v = case Int -> Int -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (t -> Int
forall a. Enum a => a -> Int
fromEnum t
v) Int
end of
                 Ordering
LT -> t
v t -> [t] -> [t]
forall a. a -> [a] -> [a]
: t -> [t]
go (t -> t
forall a. Enum a => a -> a
succ t
v)
                 Ordering
EQ -> [t
v]
                 Ordering
GT -> []

  enumFrom :: ProcessDiscretization -> [ProcessDiscretization]
enumFrom ProcessDiscretization
from = ProcessDiscretization
-> ProcessDiscretization -> [ProcessDiscretization]
forall a. Enum a => a -> a -> [a]
enumFromTo ProcessDiscretization
from ProcessDiscretization
EndEulerDiscretization

  fromEnum :: ProcessDiscretization -> Int
fromEnum ProcessDiscretization
EulerDiscretization = Int
0
  fromEnum ProcessDiscretization
EndEulerDiscretization = Int
1

  toEnum :: Int -> ProcessDiscretization
toEnum Int
0 = ProcessDiscretization
EulerDiscretization
  toEnum Int
1 = ProcessDiscretization
EndEulerDiscretization
  toEnum Int
unmatched = String -> ProcessDiscretization
forall a. HasCallStack => String -> a
error (String
"ProcessDiscretization.toEnum: Cannot match " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
unmatched)

{-# LINE 120 "./QuantLib/Process.chs" #-}

data ExtendedBlackScholesMertonProcessDiscretization = ExtendedBSMEuler
                                                     | Milstein
                                                     | PredictorCorrector
  deriving (Enum,Show,Eq,Read)

{-# LINE 121 "./QuantLib/Process.chs" #-}

data ExtendedOrnsteinUhlenbeckProcessDiscretization = MidPoint
                                                    | Trapezodial
                                                    | GaussLobatto
  deriving (Enum,Show,Eq,Read)

{-# LINE 122 "./QuantLib/Process.chs" #-}

data HestonProcessDiscretization = HestonPartialTruncation
                                 | HestonFullTruncation
                                 | HestonReflection
                                 | NonCentralChiSquareVariance
                                 | QuadraticExponential
                                 | QuadraticExponentialMartingale
                                 | BroadieKayaExactSchemeLobatto
                                 | BroadieKayaExactSchemeLaguerre
                                 | BroadieKayaExactSchemeTrapezoidal
  deriving (Enum,Show,Eq,Read)

{-# LINE 123 "./QuantLib/Process.chs" #-}

data GJRGARCHProcessDiscretization = GJRGARCHPartialTruncation
                                   | GJRGARCHFullTruncation
                                   | GJRGARCHReflection
  deriving (Enum,Show,Eq,Read)

{-# LINE 124 "./QuantLib/Process.chs" #-}

data HybridHestonHullWhiteProcessDiscretization = HybridHestonHullWhiteEuler
                                                | BSMHullWhite
  deriving (Enum,Show,Eq,Read)

{-# LINE 125 "./QuantLib/Process.chs" #-}



{-# LINE 127 "./QuantLib/Process.chs" #-}


{-# LINE 128 "./QuantLib/Process.chs" #-}


{-# LINE 129 "./QuantLib/Process.chs" #-}


{-# LINE 130 "./QuantLib/Process.chs" #-}


{-# LINE 131 "./QuantLib/Process.chs" #-}


{-# LINE 132 "./QuantLib/Process.chs" #-}


{-# LINE 133 "./QuantLib/Process.chs" #-}


{-# LINE 134 "./QuantLib/Process.chs" #-}


{-# LINE 135 "./QuantLib/Process.chs" #-}


{-# LINE 136 "./QuantLib/Process.chs" #-}


{-# LINE 137 "./QuantLib/Process.chs" #-}


{-# LINE 138 "./QuantLib/Process.chs" #-}


{-# LINE 139 "./QuantLib/Process.chs" #-}


{-# LINE 140 "./QuantLib/Process.chs" #-}


{-# LINE 141 "./QuantLib/Process.chs" #-}


{-# LINE 142 "./QuantLib/Process.chs" #-}


{-# LINE 143 "./QuantLib/Process.chs" #-}


{-# LINE 144 "./QuantLib/Process.chs" #-}


{-# LINE 145 "./QuantLib/Process.chs" #-}


{-# LINE 146 "./QuantLib/Process.chs" #-}


{-# LINE 147 "./QuantLib/Process.chs" #-}


{-# LINE 148 "./QuantLib/Process.chs" #-}


{-# LINE 149 "./QuantLib/Process.chs" #-}


{-# LINE 150 "./QuantLib/Process.chs" #-}


{-# LINE 151 "./QuantLib/Process.chs" #-}


{-# LINE 152 "./QuantLib/Process.chs" #-}


-- |Black (1976) process for a forward or futures contract: d(ln S) = -sigma^2\/2 dt + sigma dW.
blackProcess :: (GenQuote q) -- ^x0
 -> (GenYieldTermStructure y) -- ^riskFreeTS
 -> (GenBlackVolTermStructure bv) -- ^blackVolTS
 -> (ProcessDiscretization) -> (Bool) -- ^forceDiscretization
 -> IO ((BlackProcess))
blackProcess :: forall q y bv.
GenQuote q
-> GenYieldTermStructure y
-> GenBlackVolTermStructure bv
-> ProcessDiscretization
-> Bool
-> IO BlackProcess
blackProcess GenQuote q
a1 GenYieldTermStructure y
a2 GenBlackVolTermStructure bv
a3 ProcessDiscretization
a4 Bool
a5 =
  GenQuote q -> (Ptr CQuote' -> IO BlackProcess) -> IO BlackProcess
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q
a1 ((Ptr CQuote' -> IO BlackProcess) -> IO BlackProcess)
-> (Ptr CQuote' -> IO BlackProcess) -> IO BlackProcess
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a1' -> 
  GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO BlackProcess) -> IO BlackProcess
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y
a2 ((Ptr CYieldTermStructure' -> IO BlackProcess) -> IO BlackProcess)
-> (Ptr CYieldTermStructure' -> IO BlackProcess) -> IO BlackProcess
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a2' -> 
  GenBlackVolTermStructure bv
-> (Ptr CBlackVolTermStructure' -> IO BlackProcess)
-> IO BlackProcess
forall bv b.
GenBlackVolTermStructure bv
-> (Ptr CBlackVolTermStructure' -> IO b) -> IO b
withBlackVolTermStructure GenBlackVolTermStructure bv
a3 ((Ptr CBlackVolTermStructure' -> IO BlackProcess)
 -> IO BlackProcess)
-> (Ptr CBlackVolTermStructure' -> IO BlackProcess)
-> IO BlackProcess
forall a b. (a -> b) -> a -> b
$ \Ptr CBlackVolTermStructure'
a3' -> 
  let {a4' :: CInt
a4' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt)
-> (ProcessDiscretization -> Int) -> ProcessDiscretization -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ProcessDiscretization -> Int
forall a. Enum a => a -> Int
fromEnum) ProcessDiscretization
a4} in 
  let {a5' :: CInt
a5' = Bool -> CInt
forall a. Num a => Bool -> a
C2HSImp.fromBool Bool
a5} in 
  (Ptr (Ptr CChar) -> IO BlackProcess) -> IO BlackProcess
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO BlackProcess) -> IO BlackProcess)
-> (Ptr (Ptr CChar) -> IO BlackProcess) -> IO BlackProcess
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a6' -> 
  Ptr CQuote'
-> Ptr CYieldTermStructure'
-> Ptr CBlackVolTermStructure'
-> CInt
-> CInt
-> Ptr (Ptr CChar)
-> IO (Ptr CBlackProcess')
blackProcess'_ Ptr CQuote'
a1' Ptr CYieldTermStructure'
a2' Ptr CBlackVolTermStructure'
a3' CInt
a4' CInt
a5' Ptr (Ptr CChar)
a6' IO (Ptr CBlackProcess')
-> (Ptr CBlackProcess' -> IO BlackProcess) -> IO BlackProcess
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CBlackProcess'
res ->
  Ptr CBlackProcess' -> IO BlackProcess
peekBlackProcess Ptr CBlackProcess'
res IO BlackProcess
-> (BlackProcess -> IO BlackProcess) -> IO BlackProcess
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \BlackProcess
res' ->
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a6'IO () -> IO BlackProcess -> IO BlackProcess
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  BlackProcess -> IO BlackProcess
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (BlackProcess
res')

{-# LINE 160 "./QuantLib/Process.chs" #-}


-- |Merton (1973) extension of Black-Scholes for a continuous-dividend-paying stock:
-- d(ln S) = (r - q - sigma^2\/2) dt + sigma dW.
blackScholesMertonProcess :: (GenQuote q) -- ^x0
 -> (GenYieldTermStructure y1) -- ^dividendTS
 -> (GenYieldTermStructure y2) -- ^riskFreeTS
 -> (GenBlackVolTermStructure bv) -- ^blackVolTS
 -> (ProcessDiscretization) -> (Bool) -- ^forceDiscretization
 -> IO ((GeneralizedBlackScholesProcess))
blackScholesMertonProcess a1 a2 a3 a4 a5 a6 =
  withQuote a1 $ \a1' -> 
  withYieldTermStructure a2 $ \a2' -> 
  withYieldTermStructure a3 $ \a3' -> 
  withBlackVolTermStructure a4 $ \a4' -> 
  let {a5' = (fromIntegral . fromEnum) a5} in 
  let {a6' = C2HSImp.fromBool a6} in 
  preErrorCheck $ \a7' -> 
  blackScholesMertonProcess'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
  peekGeneralizedBlackScholesProcess res >>= \res' ->
  errorCheck  a7'>>
  return (res')

{-# LINE 170 "./QuantLib/Process.chs" #-}


-- |Black-Scholes (1973) process for a stock: d(ln S) = (r - sigma^2\/2) dt + sigma dW.
blackScholesProcess :: (GenQuote q) -- ^x0
 -> (GenYieldTermStructure y) -- ^riskFreeTS
 -> (GenBlackVolTermStructure bv) -- ^blackVolTS
 -> (ProcessDiscretization) -> (Bool) -- ^forceDiscretization
 -> IO ((GeneralizedBlackScholesProcess))
blackScholesProcess a1 a2 a3 a4 a5 =
  withQuote a1 $ \a1' -> 
  withYieldTermStructure a2 $ \a2' -> 
  withBlackVolTermStructure a3 $ \a3' -> 
  let {a4' = (fromIntegral . fromEnum) a4} in 
  let {a5' = C2HSImp.fromBool a5} in 
  preErrorCheck $ \a6' -> 
  blackScholesProcess'_ a1' a2' a3' a4' a5' a6' >>= \res ->
  peekGeneralizedBlackScholesProcess res >>= \res' ->
  errorCheck  a6'>>
  return (res')

{-# LINE 178 "./QuantLib/Process.chs" #-}


-- |'blackScholesMertonProcess' with a choice of evolution scheme (Euler\/Milstein\/predictor-corrector)
-- on top of the discretization argument.
extendedBlackScholesMertonProcess :: (GenQuote q) -- ^x0
 -> (GenYieldTermStructure y1) -- ^dividendTS
 -> (GenYieldTermStructure y2) -- ^riskFreeTS
 -> (GenBlackVolTermStructure bv) -- ^blackVolTS
 -> (ProcessDiscretization) -> (ExtendedBlackScholesMertonProcessDiscretization) -> IO ((GeneralizedBlackScholesProcess))
extendedBlackScholesMertonProcess a1 a2 a3 a4 a5 a6 =
  withQuote a1 $ \a1' -> 
  withYieldTermStructure a2 $ \a2' -> 
  withYieldTermStructure a3 $ \a3' -> 
  withBlackVolTermStructure a4 $ \a4' -> 
  let {a5' = (fromIntegral . fromEnum) a5} in 
  let {a6' = (fromIntegral . fromEnum) a6} in 
  preErrorCheck $ \a7' -> 
  extendedBlackScholesMertonProcess'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
  peekGeneralizedBlackScholesProcess res >>= \res' ->
  errorCheck  a7'>>
  return (res')

{-# LINE 186 "./QuantLib/Process.chs" #-}


-- |Garman-Kohlhagen (1983) process for an exchange rate: d(ln S) = (r - r_f - sigma^2\/2) dt + sigma dW.
garmanKohlhagenProcess :: (GenQuote q) -- ^x0
 -> (GenYieldTermStructure y1) -- ^foreignRiskFreeTS
 -> (GenYieldTermStructure y2) -- ^domesticRiskFreeTS
 -> (GenBlackVolTermStructure bv) -- ^blackVolTS
 -> (ProcessDiscretization) -> (Bool) -- ^forceDiscretization
 -> IO ((GeneralizedBlackScholesProcess))
garmanKohlhagenProcess a1 a2 a3 a4 a5 a6 =
  withQuote a1 $ \a1' -> 
  withYieldTermStructure a2 $ \a2' -> 
  withYieldTermStructure a3 $ \a3' -> 
  withBlackVolTermStructure a4 $ \a4' -> 
  let {a5' = (fromIntegral . fromEnum) a5} in 
  let {a6' = C2HSImp.fromBool a6} in 
  preErrorCheck $ \a7' -> 
  garmanKohlhagenProcess'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
  peekGeneralizedBlackScholesProcess res >>= \res' ->
  errorCheck  a7'>>
  return (res')

{-# LINE 195 "./QuantLib/Process.chs" #-}


-- |Generalized Black-Scholes process with separate dividend and risk-free curves:
-- d(ln S) = (r - q - sigma^2\/2) dt + sigma dW.
generalizedBlackScholesProcess :: (GenQuote q) -- ^x0
 -> (GenYieldTermStructure y1) -- ^dividendTS
 -> (GenYieldTermStructure y2) -- ^riskFreeTS
 -> (GenBlackVolTermStructure bv) -- ^blackVolTS
 -> (ProcessDiscretization) -> (Bool) -- ^forceDiscretization
 -> IO ((GeneralizedBlackScholesProcess))
generalizedBlackScholesProcess a1 a2 a3 a4 a5 a6 =
  withQuote a1 $ \a1' -> 
  withYieldTermStructure a2 $ \a2' -> 
  withYieldTermStructure a3 $ \a3' -> 
  withBlackVolTermStructure a4 $ \a4' -> 
  let {a5' = (fromIntegral . fromEnum) a5} in 
  let {a6' = C2HSImp.fromBool a6} in 
  preErrorCheck $ \a7' -> 
  generalizedBlackScholesProcess'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
  peekGeneralizedBlackScholesProcess res >>= \res' ->
  errorCheck  a7'>>
  return (res')

{-# LINE 205 "./QuantLib/Process.chs" #-}


-- |square-root process: dx = a (b - x) dt + sigma sqrt(x) dW.
squareRootProcess :: (Double) -- ^b
 -> (Double) -- ^a
 -> (Double) -- ^sigma
 -> (Double) -- ^x0
 -> (ProcessDiscretization) -> IO ((StochasticProcess1D))
squareRootProcess a1 a2 a3 a4 a5 =
  let {a1' = realToFrac a1} in 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  let {a4' = realToFrac a4} in 
  let {a5' = (fromIntegral . fromEnum) a5} in 
  preErrorCheck $ \a6' -> 
  squareRootProcess'_ a1' a2' a3' a4' a5' a6' >>= \res ->
  peekStochasticProcess1D res >>= \res' ->
  errorCheck  a6'>>
  return (res')

{-# LINE 212 "./QuantLib/Process.chs" #-}


-- |'blackScholesMertonProcess' variant supporting local vega stress tests over a given
-- time\/asset border and stress level.
vegaStressedBlackScholesProcess :: (GenQuote q) -- ^x0
 -> (GenYieldTermStructure y1) -- ^dividendTS
 -> (GenYieldTermStructure y2) -- ^riskFreeTS
 -> (GenBlackVolTermStructure bv) -- ^blackVolTS
 -> (Double) -- ^lowerTimeBorderForStressTest
 -> (Double) -- ^upperTimeBorderForStressTest
 -> (Double) -- ^lowerAssetBorderForStressTest
 -> (Double) -- ^upperAssetBorderForStressTest
 -> (Double) -- ^stressLevel
 -> (ProcessDiscretization) -> IO ((GeneralizedBlackScholesProcess))
vegaStressedBlackScholesProcess :: forall q y1 y2 bv.
GenQuote q
-> GenYieldTermStructure y1
-> GenYieldTermStructure y2
-> GenBlackVolTermStructure bv
-> Double
-> Double
-> Double
-> Double
-> Double
-> ProcessDiscretization
-> IO GeneralizedBlackScholesProcess
vegaStressedBlackScholesProcess GenQuote q
a1 GenYieldTermStructure y1
a2 GenYieldTermStructure y2
a3 GenBlackVolTermStructure bv
a4 Double
a5 Double
a6 Double
a7 Double
a8 Double
a9 ProcessDiscretization
a10 =
  GenQuote q
-> (Ptr CQuote' -> IO GeneralizedBlackScholesProcess)
-> IO GeneralizedBlackScholesProcess
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q
a1 ((Ptr CQuote' -> IO GeneralizedBlackScholesProcess)
 -> IO GeneralizedBlackScholesProcess)
-> (Ptr CQuote' -> IO GeneralizedBlackScholesProcess)
-> IO GeneralizedBlackScholesProcess
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a1' -> 
  GenYieldTermStructure y1
-> (Ptr CYieldTermStructure' -> IO GeneralizedBlackScholesProcess)
-> IO GeneralizedBlackScholesProcess
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y1
a2 ((Ptr CYieldTermStructure' -> IO GeneralizedBlackScholesProcess)
 -> IO GeneralizedBlackScholesProcess)
-> (Ptr CYieldTermStructure' -> IO GeneralizedBlackScholesProcess)
-> IO GeneralizedBlackScholesProcess
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a2' -> 
  GenYieldTermStructure y2
-> (Ptr CYieldTermStructure' -> IO GeneralizedBlackScholesProcess)
-> IO GeneralizedBlackScholesProcess
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y2
a3 ((Ptr CYieldTermStructure' -> IO GeneralizedBlackScholesProcess)
 -> IO GeneralizedBlackScholesProcess)
-> (Ptr CYieldTermStructure' -> IO GeneralizedBlackScholesProcess)
-> IO GeneralizedBlackScholesProcess
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a3' -> 
  GenBlackVolTermStructure bv
-> (Ptr CBlackVolTermStructure'
    -> IO GeneralizedBlackScholesProcess)
-> IO GeneralizedBlackScholesProcess
forall bv b.
GenBlackVolTermStructure bv
-> (Ptr CBlackVolTermStructure' -> IO b) -> IO b
withBlackVolTermStructure GenBlackVolTermStructure bv
a4 ((Ptr CBlackVolTermStructure' -> IO GeneralizedBlackScholesProcess)
 -> IO GeneralizedBlackScholesProcess)
-> (Ptr CBlackVolTermStructure'
    -> IO GeneralizedBlackScholesProcess)
-> IO GeneralizedBlackScholesProcess
forall a b. (a -> b) -> a -> b
$ \Ptr CBlackVolTermStructure'
a4' -> 
  let {a5' :: CDouble
a5' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a5} in 
  let {a6' :: CDouble
a6' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a6} in 
  let {a7' :: CDouble
a7' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a7} in 
  let {a8' :: CDouble
a8' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a8} in 
  let {a9' :: CDouble
a9' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a9} in 
  let {a10' :: CInt
a10' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt)
-> (ProcessDiscretization -> Int) -> ProcessDiscretization -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ProcessDiscretization -> Int
forall a. Enum a => a -> Int
fromEnum) ProcessDiscretization
a10} in 
  (Ptr (Ptr CChar) -> IO GeneralizedBlackScholesProcess)
-> IO GeneralizedBlackScholesProcess
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO GeneralizedBlackScholesProcess)
 -> IO GeneralizedBlackScholesProcess)
-> (Ptr (Ptr CChar) -> IO GeneralizedBlackScholesProcess)
-> IO GeneralizedBlackScholesProcess
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a11' -> 
  Ptr CQuote'
-> Ptr CYieldTermStructure'
-> Ptr CYieldTermStructure'
-> Ptr CBlackVolTermStructure'
-> CDouble
-> CDouble
-> CDouble
-> CDouble
-> CDouble
-> CInt
-> Ptr (Ptr CChar)
-> IO (Ptr CGeneralizedBlackScholesProcess')
vegaStressedBlackScholesProcess'_ Ptr CQuote'
a1' Ptr CYieldTermStructure'
a2' Ptr CYieldTermStructure'
a3' Ptr CBlackVolTermStructure'
a4' CDouble
a5' CDouble
a6' CDouble
a7' CDouble
a8' CDouble
a9' CInt
a10' Ptr (Ptr CChar)
a11' IO (Ptr CGeneralizedBlackScholesProcess')
-> (Ptr CGeneralizedBlackScholesProcess'
    -> IO GeneralizedBlackScholesProcess)
-> IO GeneralizedBlackScholesProcess
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CGeneralizedBlackScholesProcess'
res ->
  Ptr CGeneralizedBlackScholesProcess'
-> IO GeneralizedBlackScholesProcess
peekGeneralizedBlackScholesProcess Ptr CGeneralizedBlackScholesProcess'
res IO GeneralizedBlackScholesProcess
-> (GeneralizedBlackScholesProcess
    -> IO GeneralizedBlackScholesProcess)
-> IO GeneralizedBlackScholesProcess
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \GeneralizedBlackScholesProcess
res' ->
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a11'IO ()
-> IO GeneralizedBlackScholesProcess
-> IO GeneralizedBlackScholesProcess
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  GeneralizedBlackScholesProcess -> IO GeneralizedBlackScholesProcess
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (GeneralizedBlackScholesProcess
res')

{-# LINE 225 "./QuantLib/Process.chs" #-}


-- |square-root stochastic-volatility Bates process: a Heston process plus a compound Poisson
-- jump component with log-normally distributed jump size.
batesProcess :: (GenYieldTermStructure y1) -- ^riskFreeTS
 -> (GenYieldTermStructure y2) -- ^dividendYield
 -> (GenQuote q) -- ^s0
 -> (Double) -- ^v0
 -> (Double) -- ^kappa
 -> (Double) -- ^theta
 -> (Double) -- ^sigma
 -> (Double) -- ^rho
 -> (Double) -- ^lambda
 -> (Double) -- ^nu
 -> (Double) -- ^delta
 -> (HestonProcessDiscretization) -> IO ((BatesProcess))
batesProcess a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 =
  withYieldTermStructure a1 $ \a1' -> 
  withYieldTermStructure a2 $ \a2' -> 
  withQuote a3 $ \a3' -> 
  let {a4' = realToFrac a4} in 
  let {a5' = realToFrac a5} in 
  let {a6' = realToFrac a6} in 
  let {a7' = realToFrac a7} in 
  let {a8' = realToFrac a8} in 
  let {a9' = realToFrac a9} in 
  let {a10' = realToFrac a10} in 
  let {a11' = realToFrac a11} in 
  let {a12' = (fromIntegral . fromEnum) a12} in 
  preErrorCheck $ \a13' -> 
  batesProcess'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' >>= \res ->
  peekBatesProcess res >>= \res' ->
  errorCheck  a13'>>
  return (res')

{-# LINE 240 "./QuantLib/Process.chs" #-}


qlExtendedOrnsteinUhlenbeckProcess :: (Double) -- ^speed
 -> (Double) -- ^sigma (volatility)
 -> (Double) -- ^x0
 -> (FunPtr PayoffFun) -> (ExtendedOrnsteinUhlenbeckProcessDiscretization) -> (Double) -- ^intEps
 -> IO ((ExtendedOrnsteinUhlenbeckProcess))
qlExtendedOrnsteinUhlenbeckProcess a1 a2 a3 a4 a5 a6 =
  let {a1' = realToFrac a1} in 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  let {a4' = id a4} in 
  let {a5' = (fromIntegral . fromEnum) a5} in 
  let {a6' = realToFrac a6} in 
  preErrorCheck $ \a7' -> 
  qlExtendedOrnsteinUhlenbeckProcess'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
  peekExtendedOrnsteinUhlenbeckProcess res >>= \res' ->
  errorCheck  a7'>>
  return (res')

{-# LINE 249 "./QuantLib/Process.chs" #-}


-- |An extended Ornstein-Uhlenbeck process @dx = speed*(b(t) - x)dt + sigma*dW@ with an arbitrary
-- deterministic mean-reversion level @b@, usable with 'QuantLib.Method.pathGenerator'. The
-- 'FunPtr' backing @b@ is kept alive only for the continuation's duration. The process and any
-- dependent process must not escape it (same rule as 'QuantLib.Quote.withDerivedQuote').
withExtendedOrnsteinUhlenbeckProcess :: Double -- ^speed
  -> Double -- ^sigma
  -> Double -- ^x0
  -> (Double -> Double) -- ^b(t)
  -> ExtendedOrnsteinUhlenbeckProcessDiscretization
  -> Double -- ^intEps
  -> (ExtendedOrnsteinUhlenbeckProcess -> IO a) -> IO a
withExtendedOrnsteinUhlenbeckProcess :: forall a.
Double
-> Double
-> Double
-> (Double -> Double)
-> ExtendedOrnsteinUhlenbeckProcessDiscretization
-> Double
-> (ExtendedOrnsteinUhlenbeckProcess -> IO a)
-> IO a
withExtendedOrnsteinUhlenbeckProcess Double
speed Double
sigma Double
x0 Double -> Double
b ExtendedOrnsteinUhlenbeckProcessDiscretization
d Double
intEps ExtendedOrnsteinUhlenbeckProcess -> IO a
k =
  (Double -> Double) -> (FunPtr PayoffFun -> IO a) -> IO a
forall b. (Double -> Double) -> (FunPtr PayoffFun -> IO b) -> IO b
withPayoffFun Double -> Double
b (\FunPtr PayoffFun
fp -> Double
-> Double
-> Double
-> FunPtr PayoffFun
-> ExtendedOrnsteinUhlenbeckProcessDiscretization
-> Double
-> IO ExtendedOrnsteinUhlenbeckProcess
qlExtendedOrnsteinUhlenbeckProcess Double
speed Double
sigma Double
x0 FunPtr PayoffFun
fp ExtendedOrnsteinUhlenbeckProcessDiscretization
d Double
intEps IO ExtendedOrnsteinUhlenbeckProcess
-> (ExtendedOrnsteinUhlenbeckProcess -> IO a) -> IO a
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ExtendedOrnsteinUhlenbeckProcess -> IO a
k)

-- |An extended Ornstein-Uhlenbeck process with the Lucia-Schwartz-style level
-- @b(t) = a + k*t + c*sin(2*pi*t + phase)@, computed natively. Setting @k = c = 0@ gives a
-- constant level and @c = 0@ gives a linear trend.
linearSeasonalOrnsteinUhlenbeckProcess :: (Double) -- ^speed
 -> (Double) -- ^sigma (volatility)
 -> (Double) -- ^x0
 -> (Double) -- ^a
 -> (Double) -- ^k (linear trend)
 -> (Double) -- ^c (seasonal amplitude)
 -> (Double) -- ^phase
 -> (ExtendedOrnsteinUhlenbeckProcessDiscretization) -> (Double) -- ^intEps
 -> IO ((ExtendedOrnsteinUhlenbeckProcess))
linearSeasonalOrnsteinUhlenbeckProcess :: Double
-> Double
-> Double
-> Double
-> Double
-> Double
-> Double
-> ExtendedOrnsteinUhlenbeckProcessDiscretization
-> Double
-> IO ExtendedOrnsteinUhlenbeckProcess
linearSeasonalOrnsteinUhlenbeckProcess Double
a1 Double
a2 Double
a3 Double
a4 Double
a5 Double
a6 Double
a7 ExtendedOrnsteinUhlenbeckProcessDiscretization
a8 Double
a9 =
  let {a1' :: CDouble
a1' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a1} in 
  let {a2' :: CDouble
a2' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a2} in 
  let {a3' :: CDouble
a3' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a3} in 
  let {a4' :: CDouble
a4' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a4} in 
  let {a5' :: CDouble
a5' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a5} in 
  let {a6' :: CDouble
a6' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a6} in 
  let {a7' :: CDouble
a7' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a7} in 
  let {a8' :: CInt
a8' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt)
-> (ExtendedOrnsteinUhlenbeckProcessDiscretization -> Int)
-> ExtendedOrnsteinUhlenbeckProcessDiscretization
-> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ExtendedOrnsteinUhlenbeckProcessDiscretization -> Int
forall a. Enum a => a -> Int
fromEnum) ExtendedOrnsteinUhlenbeckProcessDiscretization
a8} in 
  let {a9' :: CDouble
a9' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a9} in 
  (Ptr (Ptr CChar) -> IO ExtendedOrnsteinUhlenbeckProcess)
-> IO ExtendedOrnsteinUhlenbeckProcess
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO ExtendedOrnsteinUhlenbeckProcess)
 -> IO ExtendedOrnsteinUhlenbeckProcess)
-> (Ptr (Ptr CChar) -> IO ExtendedOrnsteinUhlenbeckProcess)
-> IO ExtendedOrnsteinUhlenbeckProcess
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a10' -> 
  CDouble
-> CDouble
-> CDouble
-> CDouble
-> CDouble
-> CDouble
-> CDouble
-> CInt
-> CDouble
-> Ptr (Ptr CChar)
-> IO (Ptr CExtendedOrnsteinUhlenbeckProcess')
linearSeasonalOrnsteinUhlenbeckProcess'_ CDouble
a1' CDouble
a2' CDouble
a3' CDouble
a4' CDouble
a5' CDouble
a6' CDouble
a7' CInt
a8' CDouble
a9' Ptr (Ptr CChar)
a10' IO (Ptr CExtendedOrnsteinUhlenbeckProcess')
-> (Ptr CExtendedOrnsteinUhlenbeckProcess'
    -> IO ExtendedOrnsteinUhlenbeckProcess)
-> IO ExtendedOrnsteinUhlenbeckProcess
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CExtendedOrnsteinUhlenbeckProcess'
res ->
  peekExtendedOrnsteinUhlenbeckProcess res >>= \res' ->
  errorCheck  a10'>>
  return (res')

{-# LINE 278 "./QuantLib/Process.chs" #-}


-- |Kluge model: an extended Ornstein-Uhlenbeck process plus an exponential-jump component,
-- S = exp(X + Y) with dX = alpha (mu(t) - X) dt + sigma dW and dY = -beta Y dt + J dN. When the
-- extended process is callback-backed, this result must remain inside the same continuation.
extOuWithJumpsProcess :: (ExtendedOrnsteinUhlenbeckProcess) -> (Double) -- ^Y0
 -> (Double) -- ^beta
 -> (Double) -- ^jumpIntensity
 -> (Double) -- ^eta
 -> IO ((ExtOUWithJumpsProcess))
extOuWithJumpsProcess a1 a2 a3 a4 a5 =
  withGenStochasticProcess1D a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  let {a4' = realToFrac a4} in 
  let {a5' = realToFrac a5} in 
  preErrorCheck $ \a6' -> 
  extOuWithJumpsProcess'_ a1' a2' a3' a4' a5' a6' >>= \res ->
  peekExtOUWithJumpsProcess res >>= \res' ->
  errorCheck  a6'>>
  return (res')

{-# LINE 287 "./QuantLib/Process.chs" #-}


-- |T-forward-measure counterpart of 'g2Process': the two-factor G2++ short-rate model, with
-- the simulated state again shifted so its components sum to the short rate.
g2ForwardProcess :: (Double) -- ^a
 -> (Double) -- ^sigma
 -> (Double) -- ^b
 -> (Double) -- ^eta
 -> (Double) -- ^rho
 -> (Maybe (GenYieldTermStructure y)) -- ^termStructure
 -> IO ((G2ForwardProcess))
g2ForwardProcess a1 a2 a3 a4 a5 a6 =
  let {a1' = realToFrac a1} in 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  let {a4' = realToFrac a4} in 
  let {a5' = realToFrac a5} in 
  withMaybeYieldTermStructure a6 $ \a6' -> 
  preErrorCheck $ \a7' -> 
  g2ForwardProcess'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
  peekG2ForwardProcess res >>= \res' ->
  errorCheck  a7'>>
  return (res')

{-# LINE 297 "./QuantLib/Process.chs" #-}


-- |two-factor G2++ short-rate process, state shifted so its two OU components sum to the
-- short rate; degenerates to a pair of zero-mean OU processes if no term structure is given.
g2Process :: (Double) -- ^a
 -> (Double) -- ^sigma
 -> (Double) -- ^b
 -> (Double) -- ^eta
 -> (Double) -- ^rho
 -> (Maybe (GenYieldTermStructure y)) -- ^termStructure
 -> IO ((G2Process))
g2Process a1 a2 a3 a4 a5 a6 =
  let {a1' = realToFrac a1} in 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  let {a4' = realToFrac a4} in 
  let {a5' = realToFrac a5} in 
  withMaybeYieldTermStructure a6 $ \a6' -> 
  preErrorCheck $ \a7' -> 
  g2Process'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
  peekG2Process res >>= \res' ->
  errorCheck  a7'>>
  return (res')

{-# LINE 307 "./QuantLib/Process.chs" #-}


-- |the deterministic offset phi(t) that fits 'g2Process''s initial term structure -- throws if
-- the process was constructed with no term structure.
qlG2ProcessPhi :: (G2Process) -> (Double) -- ^t
 -> IO ((Double))
qlG2ProcessPhi a1 a2 =
  withGenStochasticProcess a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  preErrorCheck $ \a3' -> 
  qlG2ProcessPhi'_ a1' a2' a3' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a3'>>
  return (res')

{-# LINE 312 "./QuantLib/Process.chs" #-}


-- |the short rate implied by a simulated 'g2Process' state @(z1, z2)@ at time /t/: just
-- @z1 + z2@, since 'phi''s offset is already baked into the first simulated component.
qlG2ProcessShortRate :: (G2Process) -> (Double) -- ^t
 -> (Double) -- ^z1
 -> (Double) -- ^z2
 -> (Double)
qlG2ProcessShortRate a1 a2 a3 a4 =
  C2HSImp.unsafePerformIO $
  withGenStochasticProcess a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  let {a4' = realToFrac a4} in 
  qlG2ProcessShortRate'_ a1' a2' a3' a4' >>= \res ->
  let {res' = realToFrac res} in
  return (res')

{-# LINE 319 "./QuantLib/Process.chs" #-}


-- |the deterministic offset phi(t) that fits 'g2ForwardProcess''s initial term structure --
-- throws if the process was constructed with no term structure.
qlG2ForwardProcessPhi :: (G2ForwardProcess) -> (Double) -- ^t
 -> IO ((Double))
qlG2ForwardProcessPhi a1 a2 =
  withGenStochasticProcess a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  preErrorCheck $ \a3' -> 
  qlG2ForwardProcessPhi'_ a1' a2' a3' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a3'>>
  return (res')

{-# LINE 324 "./QuantLib/Process.chs" #-}


-- |the short rate implied by a simulated 'g2ForwardProcess' state @(z1, z2)@ at time /t/: just
-- @z1 + z2@, since 'phi''s offset is already baked into the first simulated component.
qlG2ForwardProcessShortRate :: (G2ForwardProcess) -> (Double) -- ^t
 -> (Double) -- ^z1
 -> (Double) -- ^z2
 -> (Double)
qlG2ForwardProcessShortRate a1 a2 a3 a4 =
  C2HSImp.unsafePerformIO $
  withGenStochasticProcess a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  let {a4' = realToFrac a4} in 
  qlG2ForwardProcessShortRate'_ a1' a2' a3' a4' >>= \res ->
  let {res' = realToFrac res} in
  return (res')

{-# LINE 331 "./QuantLib/Process.chs" #-}


-- |Two-factor short-rate processes with the same deterministic curve-fitting offset.
class HasPhi a where
  phi :: a -> Double -> IO Double
instance HasPhi G2Process where
  phi = qlG2ProcessPhi
instance HasPhi G2ForwardProcess where
  phi = qlG2ForwardProcessPhi

-- |Two-factor processes whose simulated state maps to the short rate in the same way.
class HasShortRate a where
  shortRate :: a -> Double -> Double -> Double -> Double
instance HasShortRate G2Process where
  shortRate :: G2Process -> Double -> Double -> Double -> Double
shortRate = G2Process -> Double -> Double -> Double -> Double
qlG2ProcessShortRate
instance HasShortRate G2ForwardProcess where
  shortRate :: G2ForwardProcess -> Double -> Double -> Double -> Double
shortRate = G2ForwardProcess -> Double -> Double -> Double -> Double
qlG2ForwardProcessShortRate

-- |Forward-measure processes that require a maturity time before simulation.
class HasForwardMeasureTime a where
  setForwardMeasureTime :: a -> Double -> IO ()
instance HasForwardMeasureTime HullWhiteForwardProcess where
  setForwardMeasureTime :: HullWhiteForwardProcess -> Double -> IO ()
setForwardMeasureTime = HullWhiteForwardProcess -> Double -> IO ()
qlHullWhiteForwardProcessSetForwardMeasureTime
instance HasForwardMeasureTime G2ForwardProcess where
  setForwardMeasureTime :: G2ForwardProcess -> Double -> IO ()
setForwardMeasureTime = G2ForwardProcess -> Double -> IO ()
qlG2ForwardProcessSetForwardMeasureTime

-- |Hull--White processes exposing the deterministic curve-fitting offset.
class HasAlpha a where
  alpha :: a -> Double -> IO Double
instance HasAlpha HullWhiteProcess where
  alpha :: HullWhiteProcess -> Double -> IO Double
alpha = HullWhiteProcess -> Double -> IO Double
qlHullWhiteProcessAlpha
instance HasAlpha HullWhiteForwardProcess where
  alpha :: HullWhiteForwardProcess -> Double -> IO Double
alpha = HullWhiteForwardProcess -> Double -> IO Double
qlHullWhiteForwardProcessAlpha

-- |the number of independent Brownian factors driving a stochastic process -- e.g. 2 for
-- 'g2Process', matching its state size; used to size a 'QuantLib.Method.pathGenerator''s
-- underlying sequence generator (@process->factors() * steps@, mirroring upstream's own usage).
factors :: (GenStochasticProcess p) -> IO ((Word))
factors :: forall p. GenStochasticProcess p -> IO Word
factors GenStochasticProcess p
a1 =
  GenStochasticProcess p
-> (Ptr CStochasticProcess' -> IO Word) -> IO Word
forall p b.
GenStochasticProcess p -> (Ptr CStochasticProcess' -> IO b) -> IO b
withStochasticProcess GenStochasticProcess p
a1 ((Ptr CStochasticProcess' -> IO Word) -> IO Word)
-> (Ptr CStochasticProcess' -> IO Word) -> IO Word
forall a b. (a -> b) -> a -> b
$ \Ptr CStochasticProcess'
a1' -> 
  (Ptr (Ptr CChar) -> IO Word) -> IO Word
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO Word) -> IO Word)
-> (Ptr (Ptr CChar) -> IO Word) -> IO Word
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a2' -> 
  Ptr CStochasticProcess' -> Ptr (Ptr CChar) -> IO CUInt
factors'_ Ptr CStochasticProcess'
a1' Ptr (Ptr CChar)
a2' IO CUInt -> (CUInt -> IO Word) -> IO Word
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CUInt
res ->
  let {res' :: Word
res' = CUInt -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral CUInt
res} in
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a2'IO () -> IO Word -> IO Word
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  Word -> IO Word
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Word
res')

{-# LINE 368 "./QuantLib/Process.chs" #-}


-- |the process's state at time 0, e.g. @(0, 0)@ for a curveless 'g2Process' or
-- @(phi(0), 0)@ once a term structure is given.
initialValues :: (GenStochasticProcess p) -> IO (([Double]))
initialValues a1 =
  withStochasticProcess a1 $ \a1' -> 
  preArray $ \(a2'1, a2'2) -> 
  preErrorCheck $ \a3' -> 
  initialValues'_ a1' a2'1  a2'2 a3' >>
  peekDoubleArray  a2'1  a2'2>>= \a2'' -> 
  errorCheck  a3'>>
  return (a2'')

{-# LINE 372 "./QuantLib/Process.chs" #-}


-- |the drift part of the process's SDE at state /x/ and time /t/, i.e. @mu(t, x_t)@ in
-- @dx_t = mu(t, x_t) dt + sigma(t, x_t) dW_t@.
drift :: (GenStochasticProcess p) -> (Double) -- ^t
 -> ([Double]) -- ^x
 -> IO (([Double]))
drift a1 a2 a3 =
  withStochasticProcess a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  withDoubleArray a3 $ \(a3'1, a3'2) -> 
  preArray $ \(a4'1, a4'2) -> 
  preErrorCheck $ \a5' -> 
  drift'_ a1' a2' a3'1  a3'2 a4'1  a4'2 a5' >>
  peekDoubleArray  a4'1  a4'2>>= \a4'' -> 
  errorCheck  a5'>>
  return (a4'')

{-# LINE 380 "./QuantLib/Process.chs" #-}


toMatrixDouble :: (Word, Word, [Double]) -> Matrix Double
toMatrixDouble (r, c, d) = Matrix r c d

-- |the diffusion part of the process's SDE at state /x/ and time /t/, i.e. @sigma(t, x_t)@ in
-- @dx_t = mu(t, x_t) dt + sigma(t, x_t) dW_t@.
diffusion :: GenStochasticProcess p -> Double -> [Double] -> IO (Matrix Double)
diffusion p t x = toMatrixDouble <$> qlStochasticProcessDiffusion p t x
qlStochasticProcessDiffusion :: (GenStochasticProcess p) -> (Double) -- ^t
 -> ([Double]) -- ^x
 -> IO ((Word), (Word), ([Double]))
qlStochasticProcessDiffusion :: forall p.
GenStochasticProcess p
-> Double -> [Double] -> IO (Word, Word, [Double])
qlStochasticProcessDiffusion GenStochasticProcess p
a1 Double
a2 [Double]
a3 =
  GenStochasticProcess p
-> (Ptr CStochasticProcess' -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall p b.
GenStochasticProcess p -> (Ptr CStochasticProcess' -> IO b) -> IO b
withStochasticProcess GenStochasticProcess p
a1 ((Ptr CStochasticProcess' -> IO (Word, Word, [Double]))
 -> IO (Word, Word, [Double]))
-> (Ptr CStochasticProcess' -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. (a -> b) -> a -> b
$ \Ptr CStochasticProcess'
a1' -> 
  let {a2' :: CDouble
a2' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a2} in 
  [Double]
-> ((CUInt, Ptr CDouble) -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a3 (((CUInt, Ptr CDouble) -> IO (Word, Word, [Double]))
 -> IO (Word, Word, [Double]))
-> ((CUInt, Ptr CDouble) -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. (a -> b) -> a -> b
$ \(CUInt
a3'1, Ptr CDouble
a3'2) -> 
  (Ptr CUInt -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. Storable a => (Ptr a -> IO b) -> IO b
prePtr ((Ptr CUInt -> IO (Word, Word, [Double]))
 -> IO (Word, Word, [Double]))
-> (Ptr CUInt -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. (a -> b) -> a -> b
$ \Ptr CUInt
a4' -> 
  (Ptr CUInt -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. Storable a => (Ptr a -> IO b) -> IO b
prePtr ((Ptr CUInt -> IO (Word, Word, [Double]))
 -> IO (Word, Word, [Double]))
-> (Ptr CUInt -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. (a -> b) -> a -> b
$ \Ptr CUInt
a5' -> 
  ((Ptr CUInt, Ptr (Ptr CDouble)) -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. ((Ptr CUInt, Ptr (Ptr a)) -> IO b) -> IO b
preArray (((Ptr CUInt, Ptr (Ptr CDouble)) -> IO (Word, Word, [Double]))
 -> IO (Word, Word, [Double]))
-> ((Ptr CUInt, Ptr (Ptr CDouble)) -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. (a -> b) -> a -> b
$ \(Ptr CUInt
a6'1, Ptr (Ptr CDouble)
a6'2) -> 
  (Ptr (Ptr CChar) -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO (Word, Word, [Double]))
 -> IO (Word, Word, [Double]))
-> (Ptr (Ptr CChar) -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a7' -> 
  Ptr CStochasticProcess'
-> CDouble
-> CUInt
-> Ptr CDouble
-> Ptr CUInt
-> Ptr CUInt
-> Ptr CUInt
-> Ptr (Ptr CDouble)
-> Ptr (Ptr CChar)
-> IO ()
qlStochasticProcessDiffusion'_ Ptr CStochasticProcess'
a1' CDouble
a2' CUInt
a3'1  Ptr CDouble
a3'2 Ptr CUInt
a4' Ptr CUInt
a5' Ptr CUInt
a6'1  Ptr (Ptr CDouble)
a6'2 Ptr (Ptr CChar)
a7' IO () -> IO Word -> IO Word
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  Ptr CUInt -> IO Word
peekWord  Ptr CUInt
a4'IO Word
-> (Word -> IO (Word, Word, [Double])) -> IO (Word, Word, [Double])
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Word
a4'' -> 
  Ptr CUInt -> IO Word
peekWord  Ptr CUInt
a5'IO Word
-> (Word -> IO (Word, Word, [Double])) -> IO (Word, Word, [Double])
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Word
a5'' -> 
  Ptr CUInt -> Ptr (Ptr CDouble) -> IO [Double]
peekDoubleArray  Ptr CUInt
a6'1  Ptr (Ptr CDouble)
a6'2IO [Double]
-> ([Double] -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \[Double]
a6'' -> 
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a7'IO () -> IO (Word, Word, [Double]) -> IO (Word, Word, [Double])
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  (Word, Word, [Double]) -> IO (Word, Word, [Double])
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Word
a4'', Word
a5'', [Double]
a6'')

{-# LINE 393 "./QuantLib/Process.chs" #-}


-- |E[x_(t0+dt) | x_t0 = x0], the expected state at /t0+dt/ given state /x0/ at time /t0/.
expectation :: (GenStochasticProcess p) -> (Double) -- ^t0
 -> ([Double]) -- ^x0
 -> (Double) -- ^dt
 -> IO (([Double]))
expectation a1 a2 a3 a4 =
  withStochasticProcess a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  withDoubleArray a3 $ \(a3'1, a3'2) -> 
  let {a4' = realToFrac a4} in 
  preArray $ \(a5'1, a5'2) -> 
  preErrorCheck $ \a6' -> 
  expectation'_ a1' a2' a3'1  a3'2 a4' a5'1  a5'2 a6' >>
  peekDoubleArray  a5'1  a5'2>>= \a5'' -> 
  errorCheck  a6'>>
  return (a5'')

{-# LINE 401 "./QuantLib/Process.chs" #-}


-- |the standard deviation matrix of the process over /dt/ given state /x0/ at time /t0/, i.e.
-- a square root of 'covariance' -- the factor a simulated normal draw is multiplied by in one
-- exact-scheme step. Pairs with 'expectation': @x_(t0+dt) = expectation + stdDeviation \* dw@
-- for a process whose discretization is exact in that sense.
stdDeviation :: GenStochasticProcess p -> Double -> [Double] -> Double -> IO (Matrix Double)
stdDeviation p t0 x0 dt = toMatrixDouble <$> qlStochasticProcessStdDeviation p t0 x0 dt
qlStochasticProcessStdDeviation :: (GenStochasticProcess p) -> (Double) -- ^t0
 -> ([Double]) -- ^x0
 -> (Double) -- ^dt
 -> IO ((Word), (Word), ([Double]))
qlStochasticProcessStdDeviation :: forall p.
GenStochasticProcess p
-> Double -> [Double] -> Double -> IO (Word, Word, [Double])
qlStochasticProcessStdDeviation GenStochasticProcess p
a1 Double
a2 [Double]
a3 Double
a4 =
  GenStochasticProcess p
-> (Ptr CStochasticProcess' -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall p b.
GenStochasticProcess p -> (Ptr CStochasticProcess' -> IO b) -> IO b
withStochasticProcess GenStochasticProcess p
a1 ((Ptr CStochasticProcess' -> IO (Word, Word, [Double]))
 -> IO (Word, Word, [Double]))
-> (Ptr CStochasticProcess' -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. (a -> b) -> a -> b
$ \Ptr CStochasticProcess'
a1' -> 
  let {a2' :: CDouble
a2' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a2} in 
  [Double]
-> ((CUInt, Ptr CDouble) -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a3 (((CUInt, Ptr CDouble) -> IO (Word, Word, [Double]))
 -> IO (Word, Word, [Double]))
-> ((CUInt, Ptr CDouble) -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. (a -> b) -> a -> b
$ \(CUInt
a3'1, Ptr CDouble
a3'2) -> 
  let {a4' :: CDouble
a4' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a4} in 
  (Ptr CUInt -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. Storable a => (Ptr a -> IO b) -> IO b
prePtr ((Ptr CUInt -> IO (Word, Word, [Double]))
 -> IO (Word, Word, [Double]))
-> (Ptr CUInt -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. (a -> b) -> a -> b
$ \Ptr CUInt
a5' -> 
  (Ptr CUInt -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. Storable a => (Ptr a -> IO b) -> IO b
prePtr ((Ptr CUInt -> IO (Word, Word, [Double]))
 -> IO (Word, Word, [Double]))
-> (Ptr CUInt -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. (a -> b) -> a -> b
$ \Ptr CUInt
a6' -> 
  ((Ptr CUInt, Ptr (Ptr CDouble)) -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. ((Ptr CUInt, Ptr (Ptr a)) -> IO b) -> IO b
preArray (((Ptr CUInt, Ptr (Ptr CDouble)) -> IO (Word, Word, [Double]))
 -> IO (Word, Word, [Double]))
-> ((Ptr CUInt, Ptr (Ptr CDouble)) -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. (a -> b) -> a -> b
$ \(Ptr CUInt
a7'1, Ptr (Ptr CDouble)
a7'2) -> 
  (Ptr (Ptr CChar) -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO (Word, Word, [Double]))
 -> IO (Word, Word, [Double]))
-> (Ptr (Ptr CChar) -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a8' -> 
  Ptr CStochasticProcess'
-> CDouble
-> CUInt
-> Ptr CDouble
-> CDouble
-> Ptr CUInt
-> Ptr CUInt
-> Ptr CUInt
-> Ptr (Ptr CDouble)
-> Ptr (Ptr CChar)
-> IO ()
qlStochasticProcessStdDeviation'_ Ptr CStochasticProcess'
a1' CDouble
a2' CUInt
a3'1  Ptr CDouble
a3'2 CDouble
a4' Ptr CUInt
a5' Ptr CUInt
a6' Ptr CUInt
a7'1  Ptr (Ptr CDouble)
a7'2 Ptr (Ptr CChar)
a8' IO () -> IO Word -> IO Word
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  Ptr CUInt -> IO Word
peekWord  Ptr CUInt
a5'IO Word
-> (Word -> IO (Word, Word, [Double])) -> IO (Word, Word, [Double])
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Word
a5'' -> 
  Ptr CUInt -> IO Word
peekWord  Ptr CUInt
a6'IO Word
-> (Word -> IO (Word, Word, [Double])) -> IO (Word, Word, [Double])
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Word
a6'' -> 
  Ptr CUInt -> Ptr (Ptr CDouble) -> IO [Double]
peekDoubleArray  Ptr CUInt
a7'1  Ptr (Ptr CDouble)
a7'2IO [Double]
-> ([Double] -> IO (Word, Word, [Double]))
-> IO (Word, Word, [Double])
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \[Double]
a7'' -> 
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a8'IO () -> IO (Word, Word, [Double]) -> IO (Word, Word, [Double])
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  (Word, Word, [Double]) -> IO (Word, Word, [Double])
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Word
a5'', Word
a6'', [Double]
a7'')

{-# LINE 414 "./QuantLib/Process.chs" #-}


-- |the covariance matrix of the process over /dt/ given state /x0/ at time /t0/; equals
-- @stdDeviation \* transpose stdDeviation@.
covariance :: GenStochasticProcess p -> Double -> [Double] -> Double -> IO (Matrix Double)
covariance p t0 x0 dt = toMatrixDouble <$> qlStochasticProcessCovariance p t0 x0 dt
qlStochasticProcessCovariance :: (GenStochasticProcess p) -> (Double) -- ^t0
 -> ([Double]) -- ^x0
 -> (Double) -- ^dt
 -> IO ((Word), (Word), ([Double]))
qlStochasticProcessCovariance a1 a2 a3 a4 =
  withStochasticProcess a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  withDoubleArray a3 $ \(a3'1, a3'2) -> 
  let {a4' = realToFrac a4} in 
  prePtr $ \a5' -> 
  prePtr $ \a6' -> 
  preArray $ \(a7'1, a7'2) -> 
  preErrorCheck $ \a8' -> 
  qlStochasticProcessCovariance'_ a1' a2' a3'1  a3'2 a4' a5' a6' a7'1  a7'2 a8' >>
  peekWord  a5'>>= \a5'' -> 
  peekWord  a6'>>= \a6'' -> 
  peekDoubleArray  a7'1  a7'2>>= \a7'' -> 
  errorCheck  a8'>>
  return (a5'', a6'', a7'')

{-# LINE 425 "./QuantLib/Process.chs" #-}


-- |applies an increment /dx/ to a state /x0/ in the process's own state space -- not always
-- plain addition (a log-variable process exponentiates, for instance), which is why it is a
-- method rather than a caller-side @zipWith (+)@.
apply :: (GenStochasticProcess p) -> ([Double]) -- ^x0
 -> ([Double]) -- ^dx
 -> IO (([Double]))
apply a1 a2 a3 =
  withStochasticProcess a1 $ \a1' -> 
  withDoubleArray a2 $ \(a2'1, a2'2) -> 
  withDoubleArray a3 $ \(a3'1, a3'2) -> 
  preArray $ \(a4'1, a4'2) -> 
  preErrorCheck $ \a5' -> 
  apply'_ a1' a2'1  a2'2 a3'1  a3'2 a4'1  a4'2 a5' >>
  peekDoubleArray  a4'1  a4'2>>= \a4'' -> 
  errorCheck  a5'>>
  return (a4'')

{-# LINE 434 "./QuantLib/Process.chs" #-}


-- |one discretized step of the process: the state at /t0+dt/ given state /x0/ at /t0/ and the
-- standard-normal draws /dw/ (one per 'factors').
--
-- This crosses the FFI boundary once per timestep, so it is not the way to generate many paths --
-- use 'QuantLib.Method.pathGenerator' for that, which drives the same @evolve@ entirely inside
-- QuantLib. Reach for this when Haskell has to own the path logic (path-dependent state,
-- early termination, a custom draw source via 'QuantLib.Method.gaussianRsg') while QuantLib
-- keeps owning the process's discretization scheme.
evolve :: (GenStochasticProcess p) -> (Double) -- ^t0
 -> ([Double]) -- ^x0
 -> (Double) -- ^dt
 -> ([Double]) -- ^dw
 -> IO (([Double]))
evolve :: forall p.
GenStochasticProcess p
-> Double -> [Double] -> Double -> [Double] -> IO [Double]
evolve GenStochasticProcess p
a1 Double
a2 [Double]
a3 Double
a4 [Double]
a5 =
  GenStochasticProcess p
-> (Ptr CStochasticProcess' -> IO [Double]) -> IO [Double]
forall p b.
GenStochasticProcess p -> (Ptr CStochasticProcess' -> IO b) -> IO b
withStochasticProcess GenStochasticProcess p
a1 ((Ptr CStochasticProcess' -> IO [Double]) -> IO [Double])
-> (Ptr CStochasticProcess' -> IO [Double]) -> IO [Double]
forall a b. (a -> b) -> a -> b
$ \Ptr CStochasticProcess'
a1' -> 
  let {a2' :: CDouble
a2' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a2} in 
  [Double] -> ((CUInt, Ptr CDouble) -> IO [Double]) -> IO [Double]
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a3 (((CUInt, Ptr CDouble) -> IO [Double]) -> IO [Double])
-> ((CUInt, Ptr CDouble) -> IO [Double]) -> IO [Double]
forall a b. (a -> b) -> a -> b
$ \(CUInt
a3'1, Ptr CDouble
a3'2) -> 
  let {a4' :: CDouble
a4' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a4} in 
  [Double] -> ((CUInt, Ptr CDouble) -> IO [Double]) -> IO [Double]
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a5 (((CUInt, Ptr CDouble) -> IO [Double]) -> IO [Double])
-> ((CUInt, Ptr CDouble) -> IO [Double]) -> IO [Double]
forall a b. (a -> b) -> a -> b
$ \(CUInt
a5'1, Ptr CDouble
a5'2) -> 
  ((Ptr CUInt, Ptr (Ptr CDouble)) -> IO [Double]) -> IO [Double]
forall a b. ((Ptr CUInt, Ptr (Ptr a)) -> IO b) -> IO b
preArray (((Ptr CUInt, Ptr (Ptr CDouble)) -> IO [Double]) -> IO [Double])
-> ((Ptr CUInt, Ptr (Ptr CDouble)) -> IO [Double]) -> IO [Double]
forall a b. (a -> b) -> a -> b
$ \(Ptr CUInt
a6'1, Ptr (Ptr CDouble)
a6'2) -> 
  (Ptr (Ptr CChar) -> IO [Double]) -> IO [Double]
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO [Double]) -> IO [Double])
-> (Ptr (Ptr CChar) -> IO [Double]) -> IO [Double]
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a7' -> 
  Ptr CStochasticProcess'
-> CDouble
-> CUInt
-> Ptr CDouble
-> CDouble
-> CUInt
-> Ptr CDouble
-> Ptr CUInt
-> Ptr (Ptr CDouble)
-> Ptr (Ptr CChar)
-> IO ()
evolve'_ Ptr CStochasticProcess'
a1' CDouble
a2' CUInt
a3'1  Ptr CDouble
a3'2 CDouble
a4' CUInt
a5'1  Ptr CDouble
a5'2 Ptr CUInt
a6'1  Ptr (Ptr CDouble)
a6'2 Ptr (Ptr CChar)
a7' IO () -> IO [Double] -> IO [Double]
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  Ptr CUInt -> Ptr (Ptr CDouble) -> IO [Double]
peekDoubleArray  Ptr CUInt
a6'1  Ptr (Ptr CDouble)
a6'2IO [Double] -> ([Double] -> IO [Double]) -> IO [Double]
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \[Double]
a6'' -> 
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a7'IO () -> IO [Double] -> IO [Double]
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  [Double] -> IO [Double]
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ([Double]
a6'')

{-# LINE 450 "./QuantLib/Process.chs" #-}


-- |Geman-Roncoroni process, a mean-reverting jump-diffusion model for electricity spot prices
-- with a seasonal deterministic mean and an asymmetric jump term.
gemanRoncoroniProcess :: (Double) -- ^x0
 -> (Double) -- ^alpha
 -> (Double) -- ^beta
 -> (Double) -- ^gamma
 -> (Double) -- ^delta
 -> (Double) -- ^eps
 -> (Double) -- ^zeta
 -> (Double) -- ^d
 -> (Double) -- ^k
 -> (Double) -- ^tau
 -> (Double) -- ^sig2
 -> (Double) -- ^a
 -> (Double) -- ^b
 -> (Double) -- ^theta1
 -> (Double) -- ^theta2
 -> (Double) -- ^theta3
 -> (Double) -- ^psi
 -> IO ((StochasticProcess1D))
gemanRoncoroniProcess :: Double
-> Double
-> Double
-> Double
-> Double
-> Double
-> Double
-> Double
-> Double
-> Double
-> Double
-> Double
-> Double
-> Double
-> Double
-> Double
-> Double
-> IO StochasticProcess1D
gemanRoncoroniProcess Double
a1 Double
a2 Double
a3 Double
a4 Double
a5 Double
a6 Double
a7 Double
a8 Double
a9 Double
a10 Double
a11 Double
a12 Double
a13 Double
a14 Double
a15 Double
a16 Double
a17 =
  let {a1' :: CDouble
a1' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a1} in 
  let {a2' :: CDouble
a2' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a2} in 
  let {a3' :: CDouble
a3' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a3} in 
  let {a4' :: CDouble
a4' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a4} in 
  let {a5' :: CDouble
a5' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a5} in 
  let {a6' :: CDouble
a6' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a6} in 
  let {a7' :: CDouble
a7' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a7} in 
  let {a2' :: CDouble
a8' :: CDouble
a8' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a8 :: Double
a2 :: Double
a8} in 
  let {a3' :: CDouble
a9' :: CDouble
a9' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a9 :: Double
a3 :: Double
a9} in 
  let {a10' = realToFrac a10} in 
  let {a11' = realToFrac a11} in 
  let {a12' = realToFrac a12} in 
  let {a13' = realToFrac a13} in 
  let {a14' = realToFrac a14} in 
  let {a15' = realToFrac a15} in 
  let {a16' = realToFrac a16} in 
  let {a17' = realToFrac a17} in 
  preErrorCheck $ \a18' -> 
  gemanRoncoroniProcess'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' a13' a14' a15' a16' a17' a18' >>= \res ->
  peekStochasticProcess1D res >>= \res' ->
  errorCheck  a18'>>
  return (res')

{-# LINE 471 "./QuantLib/Process.chs" #-}


-- |geometric Brownian motion process: dS = mue S dt + sigma S dW.
geometricBrownianMotionProcess :: (Double) -- ^initialValue
 -> (Double) -- ^mue
 -> (Double) -- ^sigma
 -> IO ((StochasticProcess1D))
geometricBrownianMotionProcess a1 a2 a3 =
  let {a1' = realToFrac a1} in 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  preErrorCheck $ \a4' -> 
  geometricBrownianMotionProcess'_ a1' a2' a3' a4' >>= \res ->
  peekStochasticProcess1D res >>= \res' ->
  errorCheck  a4'>>
  return (res')

{-# LINE 477 "./QuantLib/Process.chs" #-}


-- |stochastic-volatility GJR-GARCH(1,1) process; parameters are supplied as daily constants
-- and annualized internally via daysPerYear.
gjrGarchProcess :: (GenYieldTermStructure y1) -- ^riskFreeRate
 -> (GenYieldTermStructure y2) -- ^dividendYield
 -> (GenQuote q) -- ^s0
 -> (Double) -- ^v0
 -> (Double) -- ^omega
 -> (Double) -- ^alpha
 -> (Double) -- ^beta
 -> (Double) -- ^gamma
 -> (Double) -- ^lambda
 -> (Double) -- ^daysPerYear
 -> (GJRGARCHProcessDiscretization) -> IO ((GJRGARCHProcess))
gjrGarchProcess a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 =
  withYieldTermStructure a1 $ \a1' -> 
  withYieldTermStructure a2 $ \a2' -> 
  withQuote a3 $ \a3' -> 
  let {a4' = realToFrac a4} in 
  let {a5' = realToFrac a5} in 
  let {a6' = realToFrac a6} in 
  let {a7' = realToFrac a7} in 
  let {a8' = realToFrac a8} in 
  let {a9' = realToFrac a9} in 
  let {a10' = realToFrac a10} in 
  let {a11' = (fromIntegral . fromEnum) a11} in 
  preErrorCheck $ \a12' -> 
  gjrGarchProcess'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' a11' a12' >>= \res ->
  peekGJRGARCHProcess res >>= \res' ->
  errorCheck  a12'>>
  return (res')

{-# LINE 491 "./QuantLib/Process.chs" #-}


-- |/dividendYield/ may be 'Nothing' (an empty term-structure handle) -- required e.g. by
-- 'QuantLib.PricingEngine.integralHestonVarianceOptionEngine', which rejects a process with a
-- non-empty dividend handle.
hestonProcess :: (GenYieldTermStructure y1) -- ^riskFreeRate
 -> (Maybe (GenYieldTermStructure y2)) -- ^dividendYield
 -> (GenQuote q) -- ^s0
 -> (Double) -- ^v0
 -> (Double) -- ^kappa
 -> (Double) -- ^theta
 -> (Double) -- ^sigma
 -> (Double) -- ^rho
 -> (HestonProcessDiscretization) -> IO ((HestonProcess))
hestonProcess a1 a2 a3 a4 a5 a6 a7 a8 a9 =
  withYieldTermStructure a1 $ \a1' -> 
  withMaybeYieldTermStructure a2 $ \a2' -> 
  withQuote a3 $ \a3' -> 
  let {a4' = realToFrac a4} in 
  let {a5' = realToFrac a5} in 
  let {a6' = realToFrac a6} in 
  let {a7' = realToFrac a7} in 
  let {a8' = realToFrac a8} in 
  let {a9' = (fromIntegral . fromEnum) a9} in 
  preErrorCheck $ \a10' -> 
  hestonProcess'_ a1' a2' a3' a4' a5' a6' a7' a8' a9' a10' >>= \res ->
  peekHestonProcess res >>= \res' ->
  errorCheck  a10'>>
  return (res')

{-# LINE 504 "./QuantLib/Process.chs" #-}


-- |Probability density of @(x = ln S, v)@ at time /t/, evaluated via the Heston
-- characteristic-function inversion (the same machinery as 'QuantLib.PricingEngine.analyticPDFHestonEngine').
-- /eps/ is the requested integration accuracy.
pdf :: (GenHestonProcess hp) -- ^process
 -> (Double) -- ^x
 -> (Double) -- ^v
 -> (Double) -- ^t
 -> (Double) -- ^eps
 -> IO ((Double))
pdf a1 a2 a3 a4 a5 =
  withHestonProcess a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  let {a4' = realToFrac a4} in 
  let {a5' = realToFrac a5} in 
  preErrorCheck $ \a6' -> 
  pdf'_ a1' a2' a3' a4' a5' a6' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a6'>>
  return (res')

{-# LINE 514 "./QuantLib/Process.chs" #-}


-- |Two-factor Heston stochastic-local-volatility process using the supplied calibrated leverage
-- function. It is a generic 'StochasticProcess', so it composes with path generators and the
-- existing drift/diffusion operations.
hestonSlvProcess :: (GenHestonProcess hp) -- ^hestonProcess
 -> (GenLocalVolTermStructure lv) -- ^leverageFct
 -> (Double) -- ^mixingFactor
 -> IO ((HestonSLVProcess))
hestonSlvProcess a1 a2 a3 =
  withHestonProcess a1 $ \a1' -> 
  withGenLocalVolTermStructure a2 $ \a2' -> 
  let {a3' = realToFrac a3} in 
  preErrorCheck $ \a4' -> 
  hestonSlvProcess'_ a1' a2' a3' a4' >>= \res ->
  peekHestonSLVProcess res >>= \res' ->
  errorCheck  a4'>>
  return (res')

{-# LINE 522 "./QuantLib/Process.chs" #-}


-- |T-forward-measure counterpart of 'hullWhiteProcess'.
hullWhiteForwardProcess :: (GenYieldTermStructure y) -- ^h
 -> (Double) -- ^y
 -> (Double) -- ^sigma
 -> IO ((HullWhiteForwardProcess))
hullWhiteForwardProcess a1 a2 a3 =
  withYieldTermStructure a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  preErrorCheck $ \a4' -> 
  hullWhiteForwardProcess'_ a1' a2' a3' a4' >>= \res ->
  peekHullWhiteForwardProcess res >>= \res' ->
  errorCheck  a4'>>
  return (res')

{-# LINE 528 "./QuantLib/Process.chs" #-}


-- |sets the T-forward measure's maturity time: a required post-construction call before a
-- 'hullWhiteForwardProcess' can be used for forward-measure pricing. Call it as soon as the
-- pricing horizon is known and, when the process is the short-rate leg of a
-- 'hybridHestonHullWhiteProcess', /before/ that process is constructed -- the joint process
-- reads this time once, at construction, and a later change does not reach it.
qlHullWhiteForwardProcessSetForwardMeasureTime :: (HullWhiteForwardProcess) -> (Double) -- ^t
 -> IO ()
qlHullWhiteForwardProcessSetForwardMeasureTime a1 a2 =
  withGenStochasticProcess1D a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  preErrorCheck $ \a3' -> 
  qlHullWhiteForwardProcessSetForwardMeasureTime'_ a1' a2' a3' >>
  errorCheck  a3'>>
  return ()

{-# LINE 536 "./QuantLib/Process.chs" #-}


-- |the T-forward-measure time /T/ of a 'g2ForwardProcess', the multi-factor counterpart of
-- 'setForwardMeasureTime'.
--
-- Mandatory before the process is simulated or its 'drift' read: @G2ForwardProcess@'s
-- constructor leaves the inherited /T/ default-initialized, and 'drift' (hence 'evolve' and
-- 'expectation') adds a measure correction computed from it, so without this call those read
-- an indeterminate value. 'phi' and 'shortRate' do not depend on /T/ and are
-- unaffected.
qlG2ForwardProcessSetForwardMeasureTime :: (G2ForwardProcess) -> (Double) -- ^t
 -> IO ()
qlG2ForwardProcessSetForwardMeasureTime :: G2ForwardProcess -> Double -> IO ()
qlG2ForwardProcessSetForwardMeasureTime G2ForwardProcess
a1 Double
a2 =
  G2ForwardProcess -> (Ptr CG2ForwardProcess' -> IO ()) -> IO ()
forall p b.
GenStochasticProcess (ForeignPtr p) -> (Ptr p -> IO b) -> IO b
withGenStochasticProcess G2ForwardProcess
a1 ((Ptr CG2ForwardProcess' -> IO ()) -> IO ())
-> (Ptr CG2ForwardProcess' -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr CG2ForwardProcess'
a1' -> 
  let {a2' :: CDouble
a2' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a2} in 
  (Ptr (Ptr CChar) -> IO ()) -> IO ()
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO ()) -> IO ())
-> (Ptr (Ptr CChar) -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a3' -> 
  Ptr CG2ForwardProcess' -> CDouble -> Ptr (Ptr CChar) -> IO ()
qlG2ForwardProcessSetForwardMeasureTime'_ Ptr CG2ForwardProcess'
a1' CDouble
a2' Ptr (Ptr CChar)
a3' IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a3'IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

{-# LINE 547 "./QuantLib/Process.chs" #-}


-- |the deterministic drift offset alpha(t) that fits 'hullWhiteProcess''s initial term
-- structure; the simulated state /x/ is the short rate itself, so this is the piece to
-- subtract to recover the zero-mean OU factor.
qlHullWhiteProcessAlpha :: (HullWhiteProcess) -> (Double) -- ^t
 -> IO ((Double))
qlHullWhiteProcessAlpha a1 a2 =
  withGenStochasticProcess1D a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  preErrorCheck $ \a3' -> 
  qlHullWhiteProcessAlpha'_ a1' a2' a3' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a3'>>
  return (res')

{-# LINE 553 "./QuantLib/Process.chs" #-}


-- |'alpha' for a 'hullWhiteForwardProcess', i.e. under its T-forward measure.
qlHullWhiteForwardProcessAlpha :: (HullWhiteForwardProcess) -> (Double) -- ^t
 -> IO ((Double))
qlHullWhiteForwardProcessAlpha a1 a2 =
  withGenStochasticProcess1D a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  preErrorCheck $ \a3' -> 
  qlHullWhiteForwardProcessAlpha'_ a1' a2' a3' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a3'>>
  return (res')

{-# LINE 557 "./QuantLib/Process.chs" #-}


-- |the Hull-White B(t, T) = (1 - exp(-a (T - t))) \/ a factor of the affine discount-bond
-- formula P(t, T) = A(t, T) exp(-B(t, T) r_t).
bFunction :: (HullWhiteForwardProcess) -> (Double) -- ^t
 -> (Double) -- ^T
 -> IO ((Double))
bFunction a1 a2 a3 =
  withGenStochasticProcess1D a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  preErrorCheck $ \a4' -> 
  bFunction'_ a1' a2' a3' a4' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a4'>>
  return (res')

{-# LINE 563 "./QuantLib/Process.chs" #-}


-- |the T-forward-measure drift adjustment M_T(s, t, T) the process applies between /s/ and
-- /t/ when the numeraire is the /T/-maturity zero bond.
mFunction :: (HullWhiteForwardProcess) -> (Double) -- ^s
 -> (Double) -- ^t
 -> (Double) -- ^T
 -> IO ((Double))
mFunction a1 a2 a3 a4 =
  withGenStochasticProcess1D a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  let {a4' = realToFrac a4} in 
  preErrorCheck $ \a5' -> 
  mFunction'_ a1' a2' a3' a4' a5' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a5'>>
  return (res')

{-# LINE 570 "./QuantLib/Process.chs" #-}


-- |the T-forward-measure numeraire of a 'hybridHestonHullWhiteProcess' at time /t/ in state
-- /x/: @P(t, T, x!!2) \/ P(0, T)@, where /T/ is the process's forward-measure time and P is
-- the Hull-White discount bond implied by the simulated short-rate factor.
--
-- The state is @[S, v, r]@ -- spot, variance and the Hull-White factor, in the order
-- 'initialValues' returns -- and only @x!!2@ is read. This is /not/ a bank account: to turn a
-- simulated time-/t/ payoff into a present value, divide it by this numeraire and multiply by
-- the curve's own @discount ts T@.
--
-- /T/ is captured when the hybrid process is /constructed/, from the
-- 'hullWhiteForwardProcess''s forward-measure time -- so 'setForwardMeasureTime' must be
-- called on that process /before/ 'hybridHestonHullWhiteProcess', not after.
numeraire :: (HybridHestonHullWhiteProcess) -> (Double) -- ^t
 -> ([Double]) -- ^x
 -> IO ((Double))
numeraire :: HybridHestonHullWhiteProcess -> Double -> [Double] -> IO Double
numeraire HybridHestonHullWhiteProcess
a1 Double
a2 [Double]
a3 =
  HybridHestonHullWhiteProcess
-> (Ptr CHybridHestonHullWhiteProcess' -> IO Double) -> IO Double
forall p b.
GenStochasticProcess (ForeignPtr p) -> (Ptr p -> IO b) -> IO b
withGenStochasticProcess HybridHestonHullWhiteProcess
a1 ((Ptr CHybridHestonHullWhiteProcess' -> IO Double) -> IO Double)
-> (Ptr CHybridHestonHullWhiteProcess' -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr CHybridHestonHullWhiteProcess'
a1' -> 
  let {a2' :: CDouble
a2' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a2} in 
  [Double] -> ((CUInt, Ptr CDouble) -> IO Double) -> IO Double
forall b. [Double] -> ((CUInt, Ptr CDouble) -> IO b) -> IO b
withDoubleArray [Double]
a3 (((CUInt, Ptr CDouble) -> IO Double) -> IO Double)
-> ((CUInt, Ptr CDouble) -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \(CUInt
a3'1, Ptr CDouble
a3'2) -> 
  (Ptr (Ptr CChar) -> IO Double) -> IO Double
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO Double) -> IO Double)
-> (Ptr (Ptr CChar) -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a4' -> 
  Ptr CHybridHestonHullWhiteProcess'
-> CDouble -> CUInt -> Ptr CDouble -> Ptr (Ptr CChar) -> IO CDouble
numeraire'_ Ptr CHybridHestonHullWhiteProcess'
a1' CDouble
a2' CUInt
a3'1  Ptr CDouble
a3'2 Ptr (Ptr CChar)
a4' IO CDouble -> (CDouble -> IO Double) -> IO Double
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \CDouble
res ->
  let {res' :: Double
res' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
res} in
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a4'IO () -> IO Double -> IO Double
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  Double -> IO Double
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
res')

{-# LINE 587 "./QuantLib/Process.chs" #-}


-- |Hull-White one-factor short-rate process, fitted to the given initial term structure.
hullWhiteProcess :: (GenYieldTermStructure y) -- ^h
 -> (Double) -- ^y
 -> (Double) -- ^sigma
 -> IO ((HullWhiteProcess))
hullWhiteProcess a1 a2 a3 =
  withYieldTermStructure a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  preErrorCheck $ \a4' -> 
  hullWhiteProcess'_ a1' a2' a3' a4' >>= \res ->
  peekHullWhiteProcess res >>= \res' ->
  errorCheck  a4'>>
  return (res')

{-# LINE 593 "./QuantLib/Process.chs" #-}


-- |three-factor hybrid model combining a Heston equity process with a Hull-White short-rate
-- process, correlated via corrEquityShortRate.
hybridHestonHullWhiteProcess :: (GenHestonProcess hp) -> (HullWhiteForwardProcess) -> (Double) -- ^corrEquityShortRate
 -> (HybridHestonHullWhiteProcessDiscretization) -> IO ((HybridHestonHullWhiteProcess))
hybridHestonHullWhiteProcess a1 a2 a3 a4 =
  withHestonProcess a1 $ \a1' -> 
  withGenStochasticProcess1D a2 $ \a2' -> 
  let {a3' = realToFrac a3} in 
  let {a4' = (fromIntegral . fromEnum) a4} in 
  preErrorCheck $ \a5' -> 
  hybridHestonHullWhiteProcess'_ a1' a2' a3' a4' a5' >>= \res ->
  peekHybridHestonHullWhiteProcess res >>= \res' ->
  errorCheck  a5'>>
  return (res')

{-# LINE 599 "./QuantLib/Process.chs" #-}


-- |Joint correlated Kluge ('extOuWithJumpsProcess') and extended Ornstein-Uhlenbeck process. When
-- either input retains a Haskell callback, this result must remain inside that callback's scope.
klugeExtOuProcess :: (Double) -- ^rho
 -> (ExtOUWithJumpsProcess) -> (ExtendedOrnsteinUhlenbeckProcess) -> IO ((KlugeExtOUProcess))
klugeExtOuProcess a1 a2 a3 =
  let {a1' = realToFrac a1} in 
  withGenStochasticProcess a2 $ \a2' -> 
  withGenStochasticProcess1D a3 $ \a3' -> 
  preErrorCheck $ \a4' -> 
  klugeExtOuProcess'_ a1' a2' a3' a4' >>= \res ->
  peekKlugeExtOUProcess res >>= \res' ->
  errorCheck  a4'>>
  return (res')

{-# LINE 604 "./QuantLib/Process.chs" #-}


-- |Libor market model process, evolving /size/ forward rates of /index/ under the rolling
-- forward measure with a predictor-corrector step.
liborForwardModelProcess :: (Word) -- ^size
 -> (GenIborIndex ibor) -> IO ((LiborForwardModelProcess))
liborForwardModelProcess a1 a2 =
  let {a1' = fromIntegral a1} in 
  withIborIndex a2 $ \a2' -> 
  preErrorCheck $ \a3' -> 
  liborForwardModelProcess'_ a1' a2' a3' >>= \res ->
  peekLiborForwardModelProcess res >>= \res' ->
  errorCheck  a3'>>
  return (res')

{-# LINE 609 "./QuantLib/Process.chs" #-}


-- |the reset (fixing) dates of the forward rates this process evolves
fixingDates :: (LiborForwardModelProcess) -> IO (([Day]))
fixingDates a1 =
  withGenStochasticProcess a1 $ \a1' -> 
  preArray $ \(a2'1, a2'2) -> 
  preErrorCheck $ \a3' -> 
  fixingDates'_ a1' a2'1  a2'2 a3' >>
  peekDayArray  a2'1  a2'2>>= \a2'' -> 
  errorCheck  a3'>>
  return (a2'')

{-# LINE 613 "./QuantLib/Process.chs" #-}


-- |the reset (fixing) times of the forward rates this process evolves, in the process's own
-- day count fraction from the evaluation date
fixingTimes :: (LiborForwardModelProcess) -> IO (([Double]))
fixingTimes a1 =
  withGenStochasticProcess a1 $ \a1' -> 
  preArray $ \(a2'1, a2'2) -> 
  preErrorCheck $ \a3' -> 
  fixingTimes'_ a1' a2'1  a2'2 a3' >>
  peekDoubleArray  a2'1  a2'2>>= \a2'' -> 
  errorCheck  a3'>>
  return (a2'')

{-# LINE 618 "./QuantLib/Process.chs" #-}


-- |the leg of Ibor coupons (notional @amount@ each) this process's forward rates reset -- used
-- e.g. to build the 'QuantLib.Instrument.CapFloor.cap' this process prices via 'liborForwardModel'
cashFlows :: (LiborForwardModelProcess) -> (Double) -- ^amount
 -> IO ((Leg))
cashFlows a1 a2 =
  withGenStochasticProcess a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  preErrorCheck $ \a3' -> 
  cashFlows'_ a1' a2' a3' >>= \res ->
  peekLeg res >>= \res' ->
  errorCheck  a3'>>
  return (res')

{-# LINE 624 "./QuantLib/Process.chs" #-}


-- |the underlying 'IborIndex' this process was constructed with
index :: (LiborForwardModelProcess) -> IO ((IborIndex))
index a1 =
  withGenStochasticProcess a1 $ \a1' -> 
  preErrorCheck $ \a2' -> 
  index'_ a1' a2' >>= \res ->
  peekIborIndex res >>= \res' ->
  errorCheck  a2'>>
  return (res')

{-# LINE 628 "./QuantLib/Process.chs" #-}


-- |the /cumulative/ discount factors implied by one simulated vector of forward rates: element
-- /i/ discounts from the end of accrual period /i/ back to the process's start, i.e.
-- @scanl1 (*) [1 \/ (1 + r_i tau_i)]@ over 'accrualTimes' -- not the
-- individual one-period factors.
discountBond :: (LiborForwardModelProcess) -> ([Double]) -- ^rates
 -> IO (([Double]))
discountBond a1 a2 =
  withGenStochasticProcess a1 $ \a1' -> 
  withDoubleArray a2 $ \(a2'1, a2'2) -> 
  preArray $ \(a3'1, a3'2) -> 
  preErrorCheck $ \a4' -> 
  discountBond'_ a1' a2'1  a2'2 a3'1  a3'2 a4' >>
  peekDoubleArray  a3'1  a3'2>>= \a3'' -> 
  errorCheck  a4'>>
  return (a3'')

{-# LINE 637 "./QuantLib/Process.chs" #-}


-- |the @(start, end)@ accrual times of the forward rates this process evolves, in its own day
-- count fraction from the evaluation date; their difference is the accrual period a caplet
-- payoff is scaled by.
accrualTimes :: LiborForwardModelProcess -> IO [(Double, Double)]
accrualTimes p = uncurry zip <$> qlLiborForwardModelProcessAccrualTimes p
qlLiborForwardModelProcessAccrualTimes :: (LiborForwardModelProcess) -> IO (([Double]), ([Double]))
qlLiborForwardModelProcessAccrualTimes a1 =
  withGenStochasticProcess a1 $ \a1' -> 
  preArray $ \(a2'1, a2'2) -> 
  preArray $ \(a3'1, a3'2) -> 
  preErrorCheck $ \a4' -> 
  qlLiborForwardModelProcessAccrualTimes'_ a1' a2'1  a2'2 a3'1  a3'2 a4' >>
  peekDoubleArray  a2'1  a2'2>>= \a2'' -> 
  peekDoubleArray  a3'1  a3'2>>= \a3'' -> 
  errorCheck  a4'>>
  return (a2'', a3'')

{-# LINE 647 "./QuantLib/Process.chs" #-}


-- |Merton (1976) jump-diffusion process: a Black-Scholes process plus a log-normal jump
-- component with Poisson jump intensity jumpInt.
merton76Process :: (GenQuote q1) -- ^stateVariable
 -> (GenYieldTermStructure y1) -- ^dividendTS
 -> (GenYieldTermStructure y2) -- ^riskFreeTS
 -> (GenBlackVolTermStructure bv) -- ^blackVolTS
 -> (GenQuote q2) -- ^jumpInt
 -> (GenQuote q3) -- ^logJMean
 -> (GenQuote q4) -- ^logJVol
 -> (ProcessDiscretization) -> IO ((Merton76Process))
merton76Process :: forall q1 y1 y2 bv q2 q3 q4.
GenQuote q1
-> GenYieldTermStructure y1
-> GenYieldTermStructure y2
-> GenBlackVolTermStructure bv
-> GenQuote q2
-> GenQuote q3
-> GenQuote q4
-> ProcessDiscretization
-> IO Merton76Process
merton76Process GenQuote q1
a1 GenYieldTermStructure y1
a2 GenYieldTermStructure y2
a3 GenBlackVolTermStructure bv
a4 GenQuote q2
a5 GenQuote q3
a6 GenQuote q4
a7 ProcessDiscretization
a8 =
  GenQuote q1
-> (Ptr CQuote' -> IO Merton76Process) -> IO Merton76Process
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q1
a1 ((Ptr CQuote' -> IO Merton76Process) -> IO Merton76Process)
-> (Ptr CQuote' -> IO Merton76Process) -> IO Merton76Process
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a1' -> 
  GenYieldTermStructure y1
-> (Ptr CYieldTermStructure' -> IO Merton76Process)
-> IO Merton76Process
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y1
a2 ((Ptr CYieldTermStructure' -> IO Merton76Process)
 -> IO Merton76Process)
-> (Ptr CYieldTermStructure' -> IO Merton76Process)
-> IO Merton76Process
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a2' -> 
  GenYieldTermStructure y2
-> (Ptr CYieldTermStructure' -> IO Merton76Process)
-> IO Merton76Process
forall y b.
GenYieldTermStructure y
-> (Ptr CYieldTermStructure' -> IO b) -> IO b
withYieldTermStructure GenYieldTermStructure y2
a3 ((Ptr CYieldTermStructure' -> IO Merton76Process)
 -> IO Merton76Process)
-> (Ptr CYieldTermStructure' -> IO Merton76Process)
-> IO Merton76Process
forall a b. (a -> b) -> a -> b
$ \Ptr CYieldTermStructure'
a3' -> 
  GenBlackVolTermStructure bv
-> (Ptr CBlackVolTermStructure' -> IO Merton76Process)
-> IO Merton76Process
forall bv b.
GenBlackVolTermStructure bv
-> (Ptr CBlackVolTermStructure' -> IO b) -> IO b
withBlackVolTermStructure GenBlackVolTermStructure bv
a4 ((Ptr CBlackVolTermStructure' -> IO Merton76Process)
 -> IO Merton76Process)
-> (Ptr CBlackVolTermStructure' -> IO Merton76Process)
-> IO Merton76Process
forall a b. (a -> b) -> a -> b
$ \Ptr CBlackVolTermStructure'
a4' -> 
  GenQuote q2
-> (Ptr CQuote' -> IO Merton76Process) -> IO Merton76Process
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q2
a5 ((Ptr CQuote' -> IO Merton76Process) -> IO Merton76Process)
-> (Ptr CQuote' -> IO Merton76Process) -> IO Merton76Process
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a5' -> 
  GenQuote q3
-> (Ptr CQuote' -> IO Merton76Process) -> IO Merton76Process
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q3
a6 ((Ptr CQuote' -> IO Merton76Process) -> IO Merton76Process)
-> (Ptr CQuote' -> IO Merton76Process) -> IO Merton76Process
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a6' -> 
  GenQuote q4
-> (Ptr CQuote' -> IO Merton76Process) -> IO Merton76Process
forall q b. GenQuote q -> (Ptr CQuote' -> IO b) -> IO b
withQuote GenQuote q4
a7 ((Ptr CQuote' -> IO Merton76Process) -> IO Merton76Process)
-> (Ptr CQuote' -> IO Merton76Process) -> IO Merton76Process
forall a b. (a -> b) -> a -> b
$ \Ptr CQuote'
a7' -> 
  let {a8' :: CInt
a8' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt)
-> (ProcessDiscretization -> Int) -> ProcessDiscretization -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ProcessDiscretization -> Int
forall a. Enum a => a -> Int
fromEnum) ProcessDiscretization
a8} in 
  (Ptr (Ptr CChar) -> IO Merton76Process) -> IO Merton76Process
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO Merton76Process) -> IO Merton76Process)
-> (Ptr (Ptr CChar) -> IO Merton76Process) -> IO Merton76Process
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a9' -> 
  Ptr CQuote'
-> Ptr CYieldTermStructure'
-> Ptr CYieldTermStructure'
-> Ptr CBlackVolTermStructure'
-> Ptr CQuote'
-> Ptr CQuote'
-> Ptr CQuote'
-> CInt
-> Ptr (Ptr CChar)
-> IO (Ptr CMerton76Process')
merton76Process'_ Ptr CQuote'
a1' Ptr CYieldTermStructure'
a2' Ptr CYieldTermStructure'
a3' Ptr CBlackVolTermStructure'
a4' Ptr CQuote'
a5' Ptr CQuote'
a6' Ptr CQuote'
a7' CInt
a8' Ptr (Ptr CChar)
a9' IO (Ptr CMerton76Process')
-> (Ptr CMerton76Process' -> IO Merton76Process)
-> IO Merton76Process
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr CMerton76Process'
res ->
  Ptr CMerton76Process' -> IO Merton76Process
peekMerton76Process Ptr CMerton76Process'
res IO Merton76Process
-> (Merton76Process -> IO Merton76Process) -> IO Merton76Process
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Merton76Process
res' ->
  Ptr (Ptr CChar) -> IO ()
errorCheck  Ptr (Ptr CChar)
a9'IO () -> IO Merton76Process -> IO Merton76Process
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  Merton76Process -> IO Merton76Process
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Merton76Process
res')

{-# LINE 658 "./QuantLib/Process.chs" #-}


-- |Ornstein-Uhlenbeck process: dx = a (level - x) dt + sigma dW.
ornsteinUhlenbeckProcess :: (Double) -- ^speed
 -> (Double) -- ^vol
 -> (Double) -- ^x0
 -> (Double) -- ^level
 -> IO ((StochasticProcess1D))
ornsteinUhlenbeckProcess a1 a2 a3 a4 =
  let {a1' = realToFrac a1} in 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  let {a4' = realToFrac a4} in 
  preErrorCheck $ \a5' -> 
  ornsteinUhlenbeckProcess'_ a1' a2' a3' a4' a5' >>= \res ->
  peekStochasticProcess1D res >>= \res' ->
  errorCheck  a5'>>
  return (res')

{-# LINE 665 "./QuantLib/Process.chs" #-}


-- |Variance Gamma process: a Brownian motion db = theta dt + sigma dW time-changed by an
-- independent Gamma process with mean 1 and variance rate nu.
varianceGammaProcess :: (GenQuote q) -- ^s0
 -> (GenYieldTermStructure y1) -- ^dividendYield
 -> (GenYieldTermStructure y2) -- ^riskFreeRate
 -> (Double) -- ^sigma
 -> (Double) -- ^nu
 -> (Double) -- ^theta
 -> IO ((VarianceGammaProcess))
varianceGammaProcess a1 a2 a3 a4 a5 a6 =
  withQuote a1 $ \a1' -> 
  withYieldTermStructure a2 $ \a2' -> 
  withYieldTermStructure a3 $ \a3' -> 
  let {a4' = realToFrac a4} in 
  let {a5' = realToFrac a5} in 
  let {a6' = realToFrac a6} in 
  preErrorCheck $ \a7' -> 
  varianceGammaProcess'_ a1' a2' a3' a4' a5' a6' a7' >>= \res ->
  peekVarianceGammaProcess res >>= \res' ->
  errorCheck  a7'>>
  return (res')

{-# LINE 675 "./QuantLib/Process.chs" #-}


-- |array of correlated 1-D stochastic processes, driven by a joint correlation matrix.
stochasticProcessArray :: NonEmpty (GenStochasticProcess1D p1d) -> Matrix Double -- ^correlation
  -> IO StochasticProcessArray
stochasticProcessArray a (Matrix mr mc md) = qlStochasticProcessArray (toList a) mr mc md
qlStochasticProcessArray :: ([GenStochasticProcess1D p1d]) -> (Word) -> (Word) -> ([Double]) -> IO ((StochasticProcessArray))
qlStochasticProcessArray a1 a2 a3 a4 =
  withStochasticProcess1DArray a1 $ \(a1'1, a1'2) -> 
  let {a2' = fromIntegral a2} in 
  let {a3' = fromIntegral a3} in 
  withDoubleArrayRaw a4 $ \a4' -> 
  preErrorCheck $ \a5' -> 
  qlStochasticProcessArray'_ a1'1  a1'2 a2' a3' a4' a5' >>= \res ->
  peekStochasticProcessArray res >>= \res' ->
  errorCheck  a5'>>
  return (res')

{-# LINE 681 "./QuantLib/Process.chs" #-}


-- |default theta calculation for Black-Scholes options
thetaAt :: (GeneralizedBlackScholesProcess) -> (Double) -- ^value
 -> (Double) -- ^delta
 -> (Double) -- ^gamma
 -> IO ((Double))
thetaAt a1 a2 a3 a4 =
  withGeneralizedBlackScholesProcess a1 $ \a1' -> 
  let {a2' = realToFrac a2} in 
  let {a3' = realToFrac a3} in 
  let {a4' = realToFrac a4} in 
  preErrorCheck $ \a5' -> 
  thetaAt'_ a1' a2' a3' a4' a5' >>= \res ->
  let {res' = realToFrac res} in
  errorCheck  a5'>>
  return (res')

{-# LINE 687 "./QuantLib/Process.chs" #-}


-- vim: set ff=unix ts=8 sts=2 sw=2 et:

foreign import ccall safe "QuantLib/Process.chs.h qlBlackProcess"
  blackProcess'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CBlackProcess')))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlBlackScholesMertonProcess"
  blackScholesMertonProcess'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CGeneralizedBlackScholesProcess'))))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlBlackScholesProcess"
  blackScholesProcess'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CGeneralizedBlackScholesProcess')))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlExtendedBlackScholesMertonProcess"
  extendedBlackScholesMertonProcess'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CGeneralizedBlackScholesProcess'))))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlGarmanKohlhagenProcess"
  garmanKohlhagenProcess'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CGeneralizedBlackScholesProcess'))))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlGeneralizedBlackScholesProcess"
  generalizedBlackScholesProcess'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CGeneralizedBlackScholesProcess'))))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlSquareRootProcess"
  squareRootProcess'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CStochasticProcess1D')))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlVegaStressedBlackScholesProcess"
  vegaStressedBlackScholesProcess'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CGeneralizedBlackScholesProcess'))))))))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlBatesProcess"
  batesProcess'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CBatesProcess'))))))))))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlExtendedOrnsteinUhlenbeckProcess"
  qlExtendedOrnsteinUhlenbeckProcess'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.FunPtr (C2HSImp.CDouble -> (IO C2HSImp.CDouble))) -> (C2HSImp.CInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CExtendedOrnsteinUhlenbeckProcess'))))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlLinearSeasonalOrnsteinUhlenbeckProcess"
  linearSeasonalOrnsteinUhlenbeckProcess'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CExtendedOrnsteinUhlenbeckProcess')))))))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlExtOUWithJumpsProcess"
  extOuWithJumpsProcess'_ :: ((C2HSImp.Ptr (CExtendedOrnsteinUhlenbeckProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CExtOUWithJumpsProcess')))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlG2ForwardProcess"
  g2ForwardProcess'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CG2ForwardProcess'))))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlG2Process"
  g2Process'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CG2Process'))))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlG2ProcessPhi"
  qlG2ProcessPhi'_ :: ((C2HSImp.Ptr (CG2Process')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))

foreign import ccall safe "QuantLib/Process.chs.h qlG2ProcessShortRate"
  qlG2ProcessShortRate'_ :: ((C2HSImp.Ptr (CG2Process')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (IO C2HSImp.CDouble)))))

foreign import ccall safe "QuantLib/Process.chs.h qlG2ForwardProcessPhi"
  qlG2ForwardProcessPhi'_ :: ((C2HSImp.Ptr (CG2ForwardProcess')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))

foreign import ccall safe "QuantLib/Process.chs.h qlG2ForwardProcessShortRate"
  qlG2ForwardProcessShortRate'_ :: ((C2HSImp.Ptr (CG2ForwardProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (IO C2HSImp.CDouble)))))

foreign import ccall safe "QuantLib/Process.chs.h qlStochasticProcessFactors"
  factors'_ :: ((C2HSImp.Ptr (CStochasticProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CUInt)))

foreign import ccall safe "QuantLib/Process.chs.h qlStochasticProcessInitialValues"
  initialValues'_ :: ((C2HSImp.Ptr (CStochasticProcess')) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))

foreign import ccall safe "QuantLib/Process.chs.h qlStochasticProcessDrift"
  drift'_ :: ((C2HSImp.Ptr (CStochasticProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlStochasticProcessDiffusion"
  qlStochasticProcessDiffusion'_ :: ((C2HSImp.Ptr (CStochasticProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlStochasticProcessExpectation"
  expectation'_ :: ((C2HSImp.Ptr (CStochasticProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlStochasticProcessStdDeviation"
  qlStochasticProcessStdDeviation'_ :: ((C2HSImp.Ptr (CStochasticProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlStochasticProcessCovariance"
  qlStochasticProcessCovariance'_ :: ((C2HSImp.Ptr (CStochasticProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlStochasticProcessApply"
  apply'_ :: ((C2HSImp.Ptr (CStochasticProcess')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlStochasticProcessEvolve"
  evolve'_ :: ((C2HSImp.Ptr (CStochasticProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlGemanRoncoroniProcess"
  gemanRoncoroniProcess'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CStochasticProcess1D')))))))))))))))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlGeometricBrownianMotionProcess"
  geometricBrownianMotionProcess'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CStochasticProcess1D')))))))

foreign import ccall safe "QuantLib/Process.chs.h qlGJRGARCHProcess"
  gjrGarchProcess'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CGJRGARCHProcess')))))))))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlHestonProcess"
  hestonProcess'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CHestonProcess')))))))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlHestonProcessPdf"
  pdf'_ :: ((C2HSImp.Ptr (CHestonProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))))

foreign import ccall safe "QuantLib/Process.chs.h qlHestonSLVProcess"
  hestonSlvProcess'_ :: ((C2HSImp.Ptr (CHestonProcess')) -> ((C2HSImp.Ptr (CLocalVolTermStructure')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CHestonSLVProcess')))))))

foreign import ccall safe "QuantLib/Process.chs.h qlHullWhiteForwardProcess"
  hullWhiteForwardProcess'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CHullWhiteForwardProcess')))))))

foreign import ccall safe "QuantLib/Process.chs.h qlHullWhiteForwardProcessSetForwardMeasureTime"
  qlHullWhiteForwardProcessSetForwardMeasureTime'_ :: ((C2HSImp.Ptr (CHullWhiteForwardProcess')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))

foreign import ccall safe "QuantLib/Process.chs.h qlG2ForwardProcessSetForwardMeasureTime"
  qlG2ForwardProcessSetForwardMeasureTime'_ :: ((C2HSImp.Ptr (CG2ForwardProcess')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))

foreign import ccall safe "QuantLib/Process.chs.h qlHullWhiteProcessAlpha"
  qlHullWhiteProcessAlpha'_ :: ((C2HSImp.Ptr (CHullWhiteProcess')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))

foreign import ccall safe "QuantLib/Process.chs.h qlHullWhiteForwardProcessAlpha"
  qlHullWhiteForwardProcessAlpha'_ :: ((C2HSImp.Ptr (CHullWhiteForwardProcess')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))

foreign import ccall safe "QuantLib/Process.chs.h qlHullWhiteForwardProcessB"
  bFunction'_ :: ((C2HSImp.Ptr (CHullWhiteForwardProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))

foreign import ccall safe "QuantLib/Process.chs.h qlHullWhiteForwardProcessMT"
  mFunction'_ :: ((C2HSImp.Ptr (CHullWhiteForwardProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))))

foreign import ccall safe "QuantLib/Process.chs.h qlHybridHestonHullWhiteProcessNumeraire"
  numeraire'_ :: ((C2HSImp.Ptr (CHybridHestonHullWhiteProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))))

foreign import ccall safe "QuantLib/Process.chs.h qlHullWhiteProcess"
  hullWhiteProcess'_ :: ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CHullWhiteProcess')))))))

foreign import ccall safe "QuantLib/Process.chs.h qlHybridHestonHullWhiteProcess"
  hybridHestonHullWhiteProcess'_ :: ((C2HSImp.Ptr (CHestonProcess')) -> ((C2HSImp.Ptr (CHullWhiteForwardProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CHybridHestonHullWhiteProcess'))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlKlugeExtOUProcess"
  klugeExtOuProcess'_ :: (C2HSImp.CDouble -> ((C2HSImp.Ptr (CExtOUWithJumpsProcess')) -> ((C2HSImp.Ptr (CExtendedOrnsteinUhlenbeckProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CKlugeExtOUProcess')))))))

foreign import ccall safe "QuantLib/Process.chs.h qlLiborForwardModelProcess"
  liborForwardModelProcess'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (CIborIndex')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CLiborForwardModelProcess'))))))

foreign import ccall safe "QuantLib/Process.chs.h qlLiborForwardModelProcessFixingDates"
  fixingDates'_ :: ((C2HSImp.Ptr (CLiborForwardModelProcess')) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CInt)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))

foreign import ccall safe "QuantLib/Process.chs.h qlLiborForwardModelProcessFixingTimes"
  fixingTimes'_ :: ((C2HSImp.Ptr (CLiborForwardModelProcess')) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))

foreign import ccall safe "QuantLib/Process.chs.h qlLiborForwardModelProcessCashFlows"
  cashFlows'_ :: ((C2HSImp.Ptr (CLiborForwardModelProcess')) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CLeg'))))))

foreign import ccall safe "QuantLib/Process.chs.h qlLiborForwardModelProcessIndex"
  index'_ :: ((C2HSImp.Ptr (CLiborForwardModelProcess')) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CIborIndex')))))

foreign import ccall safe "QuantLib/Process.chs.h qlLiborForwardModelProcessDiscountBond"
  discountBond'_ :: ((C2HSImp.Ptr (CLiborForwardModelProcess')) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))))

foreign import ccall safe "QuantLib/Process.chs.h qlLiborForwardModelProcessAccrualTimes"
  qlLiborForwardModelProcessAccrualTimes'_ :: ((C2HSImp.Ptr (CLiborForwardModelProcess')) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))))

foreign import ccall safe "QuantLib/Process.chs.h qlMerton76Process"
  merton76Process'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CBlackVolTermStructure')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CQuote')) -> (C2HSImp.CInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CMerton76Process'))))))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlOrnsteinUhlenbeckProcess"
  ornsteinUhlenbeckProcess'_ :: (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CStochasticProcess1D'))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlVarianceGammaProcess"
  varianceGammaProcess'_ :: ((C2HSImp.Ptr (CQuote')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> ((C2HSImp.Ptr (CYieldTermStructure')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CVarianceGammaProcess'))))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlStochasticProcessArray"
  qlStochasticProcessArray'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr (CStochasticProcess1D'))) -> (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CStochasticProcessArray')))))))))

foreign import ccall safe "QuantLib/Process.chs.h qlQuantLibBlackScholesTheta"
  thetaAt'_ :: ((C2HSImp.Ptr (CGeneralizedBlackScholesProcess')) -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))))