{-# LINE 1 "./QuantLib/Math.chs" #-}
module QuantLib.Math
(
Matrix
, RealMatrix
, RealVector
, NonEmptyVector
, TimeGrid
, RoundingType(..)
, Rounding(..)
, EndCriteriaType(..)
, EndCriteria(..)
, OptimizationMethod(..)
, Constraint(..)
, Interpolation(..)
, Interpolation2D(..)
, Approximation(..)
, PolynomialType(..)
, ComplexLogFormula(..)
, SalvagingAlgorithm(..)
, BinomialTree(..)
, HistogramAlgorithm(..)
, CmsMarketCalibrationType(..)
, RngTrait(..)
, StatisticsTrait(..)
, SobolDirectionIntegers(..)
, BoundaryConditionSide(..)
, FdmSchemeType(..)
, FdmScheme(..)
, boxedRealMatrix
, realMatrixFromVector
, objectMatrix
, singletonNonEmptyVector
, consNonEmptyVector
, nonEmptyVector
, timeGrid
, timeGridFromVector
, timeGridFromVectorWithSteps
, applyRounding
, optimize
, symmetricSchurDecomposition
, pseudoSqrt
, rankReducedSqrt
, choleskyDecomposition
, choleskySolveFor
, riskStatisticsMean
, riskStatisticsStandardDeviation
, riskStatisticsVariance
, riskStatisticsSkewness
, riskStatisticsKurtosis
, riskStatisticsMin
, riskStatisticsMax
, riskStatisticsSemiVariance
, riskStatisticsSemiDeviation
, riskStatisticsDownsideVariance
, riskStatisticsDownsideDeviation
, riskStatisticsPercentile
, riskStatisticsGaussianPercentile
, riskStatisticsValueAtRisk
, riskStatisticsGaussianValueAtRisk
, riskStatisticsExpectedShortfall
, riskStatisticsGaussianExpectedShortfall
, riskStatisticsPotentialUpside
, riskStatisticsGaussianPotentialUpside
, riskStatisticsRegret
, riskStatisticsShortfall
, riskStatisticsAverageShortfall
, matrixRows
, matrixColumns
, matrixData
, realMatrixRows
, realMatrixColumns
, realMatrixData
, nonEmptyVectorToVector
, timeAt
, size
, points
) 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.Common
import QuantLib.Internal.Type
import Foreign.Marshal.Alloc(alloca)
data EndCriteriaType = EndNone
| MaxIterations
| StationaryPoint
| StationaryFunctionValue
| StationaryFunctionAccuracy
| ZeroGradientNorm
| Unknown
deriving (Enum,Show,Eq,Read)
{-# LINE 112 "./QuantLib/Math.chs" #-}
data HistogramAlgorithm = HistogramNone
| Sturges
| FD
| Scott
deriving (Enum,Show,Eq,Read)
{-# LINE 113 "./QuantLib/Math.chs" #-}
data RngTrait = PseudoRandom
| PoissonPseudoRandom
| LowDiscrepancy
| Ziggurat
deriving (Show,Eq,Read)
instance Enum RngTrait where
succ PseudoRandom = PoissonPseudoRandom
succ PoissonPseudoRandom = LowDiscrepancy
succ LowDiscrepancy = Ziggurat
succ Ziggurat = error "RngTrait.succ: Ziggurat has no successor"
pred PoissonPseudoRandom = PseudoRandom
pred LowDiscrepancy = PoissonPseudoRandom
pred Ziggurat = LowDiscrepancy
pred PseudoRandom = error "RngTrait.pred: PseudoRandom has no predecessor"
enumFromTo :: RngTrait -> RngTrait -> [RngTrait]
enumFromTo RngTrait
from RngTrait
to = RngTrait -> [RngTrait]
forall {t}. Enum t => t -> [t]
go RngTrait
from
where
end :: Int
end = RngTrait -> Int
forall a. Enum a => a -> Int
fromEnum RngTrait
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)
EQ -> [v]
Ordering
GT -> []
enumFrom from = enumFromTo from Ziggurat
fromEnum PseudoRandom = 0
fromEnum PoissonPseudoRandom = 1
fromEnum LowDiscrepancy = 2
fromEnum Ziggurat = 3
toEnum 0 = PseudoRandom
toEnum 1 = PoissonPseudoRandom
toEnum 2 = LowDiscrepancy
toEnum 3 = Ziggurat
toEnum unmatched = error ("RngTrait.toEnum: Cannot match " ++ show unmatched)
{-# LINE 114 "./QuantLib/Math.chs" #-}
data StatisticsTrait = Statistics
| GaussianStatistics
| GeneralStatistics
| IncrementalStatistics
deriving (Show,Eq,Read)
instance Enum StatisticsTrait where
succ Statistics = GaussianStatistics
succ GaussianStatistics = GeneralStatistics
succ GeneralStatistics = IncrementalStatistics
succ IncrementalStatistics = error "StatisticsTrait.succ: IncrementalStatistics has no successor"
pred GaussianStatistics = Statistics
pred GeneralStatistics = GaussianStatistics
pred IncrementalStatistics = GeneralStatistics
pred Statistics = error "StatisticsTrait.pred: Statistics has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from IncrementalStatistics
fromEnum Statistics = 0
fromEnum GaussianStatistics = 1
fromEnum GeneralStatistics = 2
fromEnum IncrementalStatistics = 3
toEnum 0 = Statistics
toEnum 1 = GaussianStatistics
toEnum 2 = GeneralStatistics
toEnum 3 = IncrementalStatistics
toEnum unmatched = error ("StatisticsTrait.toEnum: Cannot match " ++ show unmatched)
{-# LINE 115 "./QuantLib/Math.chs" #-}
data BinomialTree = JarrowRudd
| CoxRossRubinstein
| AdditiveEQPBinomialTree
| Trigeorgis
| Tian
| LeisenReimer
| Joshi4
| ExtendedJarrowRudd
| ExtendedCoxRossRubinstein
| ExtendedAdditiveEQPBinomialTree
| ExtendedTrigeorgis
| ExtendedTian
| ExtendedLeisenReimer
| ExtendedJoshi4
deriving (Show,Eq,Read)
instance Enum BinomialTree where
succ JarrowRudd = CoxRossRubinstein
succ CoxRossRubinstein = AdditiveEQPBinomialTree
succ AdditiveEQPBinomialTree = Trigeorgis
succ Trigeorgis = Tian
succ Tian = LeisenReimer
succ LeisenReimer = Joshi4
succ Joshi4 = ExtendedJarrowRudd
succ ExtendedJarrowRudd = ExtendedCoxRossRubinstein
succ ExtendedCoxRossRubinstein = ExtendedAdditiveEQPBinomialTree
succ ExtendedAdditiveEQPBinomialTree = ExtendedTrigeorgis
succ ExtendedTrigeorgis = ExtendedTian
succ ExtendedTian = ExtendedLeisenReimer
succ ExtendedLeisenReimer = ExtendedJoshi4
succ ExtendedJoshi4 = error "BinomialTree.succ: ExtendedJoshi4 has no successor"
pred CoxRossRubinstein = JarrowRudd
pred AdditiveEQPBinomialTree = CoxRossRubinstein
pred Trigeorgis = AdditiveEQPBinomialTree
pred Tian = Trigeorgis
pred LeisenReimer = Tian
pred Joshi4 = LeisenReimer
pred ExtendedJarrowRudd = Joshi4
pred ExtendedCoxRossRubinstein = ExtendedJarrowRudd
pred ExtendedAdditiveEQPBinomialTree = ExtendedCoxRossRubinstein
pred ExtendedTrigeorgis = ExtendedAdditiveEQPBinomialTree
pred ExtendedTian = ExtendedTrigeorgis
pred ExtendedLeisenReimer = ExtendedTian
pred ExtendedJoshi4 = ExtendedLeisenReimer
pred JarrowRudd = error "BinomialTree.pred: JarrowRudd has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom from = enumFromTo from ExtendedJoshi4
fromEnum JarrowRudd = 0
fromEnum CoxRossRubinstein = 1
fromEnum AdditiveEQPBinomialTree = 2
fromEnum Trigeorgis = 3
fromEnum Tian = 4
fromEnum LeisenReimer = 5
fromEnum Joshi4 = 6
fromEnum ExtendedJarrowRudd = 7
fromEnum ExtendedCoxRossRubinstein = 8
fromEnum ExtendedAdditiveEQPBinomialTree = 9
fromEnum ExtendedTrigeorgis = 10
fromEnum ExtendedTian = 11
fromEnum ExtendedLeisenReimer = 12
fromEnum ExtendedJoshi4 = 13
toEnum 0 = JarrowRudd
toEnum 1 = CoxRossRubinstein
toEnum 2 = AdditiveEQPBinomialTree
toEnum 3 = Trigeorgis
toEnum 4 = Tian
toEnum 5 = LeisenReimer
toEnum 6 = Joshi4
toEnum 7 = ExtendedJarrowRudd
toEnum 8 = ExtendedCoxRossRubinstein
toEnum 9 = ExtendedAdditiveEQPBinomialTree
toEnum 10 = ExtendedTrigeorgis
toEnum 11 = ExtendedTian
toEnum 12 = ExtendedLeisenReimer
toEnum 13 = ExtendedJoshi4
toEnum unmatched = error ("BinomialTree.toEnum: Cannot match " ++ show unmatched)
{-# LINE 116 "./QuantLib/Math.chs" #-}
data BoundaryConditionSide = BoundaryNone
| Upper
| Lower
deriving (Enum,Show,Eq,Read)
{-# LINE 117 "./QuantLib/Math.chs" #-}
data PolynomialType = Monomial
| Laguerre
| Hermite
| Hyperbolic
| Legendre
| Chebyshev
| Chebyshev2nd
deriving (Enum,Show,Eq,Read)
{-# LINE 118 "./QuantLib/Math.chs" #-}
data ComplexLogFormula = Gatheral
| BranchCorrection
| AndersenPiterbarg
| AndersenPiterbargOptCV
| AsymptoticChF
| AngledContour
| AngledContourNoCV
| OptimalCV
deriving (Enum,Show,Eq,Read)
{-# LINE 121 "./QuantLib/Math.chs" #-}
data CmsMarketCalibrationType = OnSpread
| OnPrice
| OnForwardCmsPrice
deriving (Enum,Show,Eq,Read)
{-# LINE 122 "./QuantLib/Math.chs" #-}
data SobolDirectionIntegers = Unit
| Jaeckel
| SobolLevitan
| SobolLevitanLemieux
| JoeKuoD5
| JoeKuoD6
| JoeKuoD7
| Kuo
| Kuo2
| Kuo3
deriving (Enum,Show,Eq,Read)
{-# LINE 123 "./QuantLib/Math.chs" #-}
data SalvagingAlgorithm = SalvagingNone
| Spectral
| Hypersphere
| LowerDiagonal
| Higham
| Principal
deriving (Enum,Show,Eq,Read)
{-# LINE 127 "./QuantLib/Math.chs" #-}
{-# LINE 129 "./QuantLib/Math.chs" #-}
{-# LINE 130 "./QuantLib/Math.chs" #-}
{-# LINE 131 "./QuantLib/Math.chs" #-}
{-# LINE 132 "./QuantLib/Math.chs" #-}
{-# LINE 133 "./QuantLib/Math.chs" #-}
applyRounding :: (Rounding)
-> (Double)
-> (Double)
applyRounding a1 a2 =
C2HSImp.unsafePerformIO $
withRounding a1 $ \a1' ->
let {a2' = realToFrac a2} in
applyRounding'_ a1' a2' >>= \res ->
let {res' = realToFrac res} in
return (res')
{-# LINE 138 "./QuantLib/Math.chs" #-}
optimize :: (RealVector -> Double)
-> (RealVector)
-> (Maybe Constraint) -> (OptimizationMethod) -> (EndCriteria) -> IO ((RealVector), (Double), (EndCriteriaType))
optimize a1 a2 a3 a4 a5 =
withCostFunction a1 $ \a1' ->
withRealVector a2 $ \(a2'1, a2'2) ->
withMaybeConstraint a3 $ \a3' ->
withOptimizationMethod a4 $ \a4' ->
withEndCriteria a5 $ \a5' ->
preArray $ \(a6'1, a6'2) ->
alloca $ \a7' ->
alloca $ \a8' ->
preErrorCheck $ \a9' ->
optimize'_ a1' a2'1 a2'2 a3' a4' a5' a6'1 a6'2 a7' a8' a9' >>
peekRealVector a6'1 a6'2>>= \a6'' ->
peekDouble a7'>>= \a7'' ->
peekEnum a8'>>= \a8'' ->
errorCheck a9'>>
return (a6'', a7'', a8'')
{-# LINE 154 "./QuantLib/Math.chs" #-}
timeGrid :: (Double)
-> (Word)
-> IO ((TimeGrid))
timeGrid a1 a2 =
let {a1' = realToFrac a1} in
let {a2' = fromIntegral a2} in
preErrorCheck $ \a3' ->
timeGrid'_ a1' a2' a3' >>= \res ->
peekTimeGrid res >>= \res' ->
errorCheck a3'>>
return (res')
{-# LINE 159 "./QuantLib/Math.chs" #-}
timeGridFromVector :: (NonEmptyVector Double)
-> IO ((TimeGrid))
timeGridFromVector a1 =
withNonEmptyRealVector a1 $ \(a1'1, a1'2) ->
preErrorCheck $ \a2' ->
timeGridFromVector'_ a1'1 a1'2 a2' >>= \res ->
peekTimeGrid res >>= \res' ->
errorCheck a2'>>
return (res')
{-# LINE 164 "./QuantLib/Math.chs" #-}
timeGridFromVectorWithSteps :: (NonEmptyVector Double)
-> (Word)
-> IO ((TimeGrid))
timeGridFromVectorWithSteps a1 a2 =
withNonEmptyRealVector a1 $ \(a1'1, a1'2) ->
let {a2' = fromIntegral a2} in
preErrorCheck $ \a3' ->
timeGridFromVectorWithSteps'_ a1'1 a1'2 a2' a3' >>= \res ->
peekTimeGrid res >>= \res' ->
errorCheck a3'>>
return (res')
{-# LINE 170 "./QuantLib/Math.chs" #-}
size :: (TimeGrid) -> (Word)
size a1 =
C2HSImp.unsafePerformIO $
withTimeGrid a1 $ \a1' ->
size'_ a1' >>= \res ->
let {res' = fromIntegral res} in
return (res')
{-# LINE 173 "./QuantLib/Math.chs" #-}
timeAt :: (TimeGrid)
-> (Word)
-> IO ((Double))
timeAt a1 a2 =
withTimeGrid a1 $ \a1' ->
let {a2' = fromIntegral a2} in
preErrorCheck $ \a3' ->
timeAt'_ a1' a2' a3' >>= \res ->
let {res' = realToFrac res} in
errorCheck a3'>>
return (res')
{-# LINE 178 "./QuantLib/Math.chs" #-}
points :: (TimeGrid) -> IO ((RealVector))
points a1 =
withTimeGrid a1 $ \a1' ->
preArray $ \(a2'1, a2'2) ->
preErrorCheck $ \a3' ->
points'_ a1' a2'1 a2'2 a3' >>
peekRealVector a2'1 a2'2>>= \a2'' ->
errorCheck a3'>>
return (a2'')
{-# LINE 181 "./QuantLib/Math.chs" #-}
riskStatisticsMean :: (RealVector)
-> IO ((Double))
riskStatisticsMean a1 =
withRealVector a1 $ \(a1'1, a1'2) ->
preErrorCheck $ \a2' ->
riskStatisticsMean'_ a1'1 a1'2 a2' >>= \res ->
let {res' = realToFrac res} in
errorCheck a2'>>
return (res')
{-# LINE 185 "./QuantLib/Math.chs" #-}
riskStatisticsStandardDeviation :: (RealVector)
-> IO ((Double))
riskStatisticsStandardDeviation a1 =
withRealVector a1 $ \(a1'1, a1'2) ->
preErrorCheck $ \a2' ->
riskStatisticsStandardDeviation'_ a1'1 a1'2 a2' >>= \res ->
let {res' = realToFrac res} in
errorCheck a2'>>
return (res')
{-# LINE 189 "./QuantLib/Math.chs" #-}
riskStatisticsVariance :: (RealVector)
-> IO ((Double))
riskStatisticsVariance a1 =
withRealVector a1 $ \(a1'1, a1'2) ->
preErrorCheck $ \a2' ->
riskStatisticsVariance'_ a1'1 a1'2 a2' >>= \res ->
let {res' = realToFrac res} in
errorCheck a2'>>
return (res')
{-# LINE 193 "./QuantLib/Math.chs" #-}
riskStatisticsSkewness :: (RealVector)
-> IO ((Double))
riskStatisticsSkewness a1 =
withRealVector a1 $ \(a1'1, a1'2) ->
preErrorCheck $ \a2' ->
riskStatisticsSkewness'_ a1'1 a1'2 a2' >>= \res ->
let {res' = realToFrac res} in
errorCheck a2'>>
return (res')
{-# LINE 197 "./QuantLib/Math.chs" #-}
riskStatisticsKurtosis :: (RealVector)
-> IO ((Double))
riskStatisticsKurtosis a1 =
withRealVector a1 $ \(a1'1, a1'2) ->
preErrorCheck $ \a2' ->
riskStatisticsKurtosis'_ a1'1 a1'2 a2' >>= \res ->
let {res' = realToFrac res} in
errorCheck a2'>>
return (res')
{-# LINE 201 "./QuantLib/Math.chs" #-}
riskStatisticsMin :: (RealVector)
-> IO ((Double))
riskStatisticsMin a1 =
withRealVector a1 $ \(a1'1, a1'2) ->
preErrorCheck $ \a2' ->
riskStatisticsMin'_ a1'1 a1'2 a2' >>= \res ->
let {res' = realToFrac res} in
errorCheck a2'>>
return (res')
{-# LINE 205 "./QuantLib/Math.chs" #-}
riskStatisticsMax :: (RealVector)
-> IO ((Double))
riskStatisticsMax a1 =
withRealVector a1 $ \(a1'1, a1'2) ->
preErrorCheck $ \a2' ->
riskStatisticsMax'_ a1'1 a1'2 a2' >>= \res ->
let {res' = realToFrac res} in
errorCheck a2'>>
return (res')
{-# LINE 209 "./QuantLib/Math.chs" #-}
riskStatisticsSemiVariance :: (RealVector)
-> IO ((Double))
riskStatisticsSemiVariance a1 =
withRealVector a1 $ \(a1'1, a1'2) ->
preErrorCheck $ \a2' ->
riskStatisticsSemiVariance'_ a1'1 a1'2 a2' >>= \res ->
let {res' = realToFrac res} in
errorCheck a2'>>
return (res')
{-# LINE 214 "./QuantLib/Math.chs" #-}
riskStatisticsSemiDeviation :: (RealVector)
-> IO ((Double))
riskStatisticsSemiDeviation a1 =
withRealVector a1 $ \(a1'1, a1'2) ->
preErrorCheck $ \a2' ->
riskStatisticsSemiDeviation'_ a1'1 a1'2 a2' >>= \res ->
let {res' = realToFrac res} in
errorCheck a2'>>
return (res')
{-# LINE 218 "./QuantLib/Math.chs" #-}
riskStatisticsDownsideVariance :: (RealVector)
-> IO ((Double))
riskStatisticsDownsideVariance a1 =
withRealVector a1 $ \(a1'1, a1'2) ->
preErrorCheck $ \a2' ->
riskStatisticsDownsideVariance'_ a1'1 a1'2 a2' >>= \res ->
let {res' = realToFrac res} in
errorCheck a2'>>
return (res')
{-# LINE 223 "./QuantLib/Math.chs" #-}
riskStatisticsDownsideDeviation :: (RealVector)
-> IO ((Double))
riskStatisticsDownsideDeviation a1 =
withRealVector a1 $ \(a1'1, a1'2) ->
preErrorCheck $ \a2' ->
riskStatisticsDownsideDeviation'_ a1'1 a1'2 a2' >>= \res ->
let {res' = realToFrac res} in
errorCheck a2'>>
return (res')
{-# LINE 227 "./QuantLib/Math.chs" #-}
riskStatisticsPercentile :: (RealVector)
-> (Double)
-> IO ((Double))
riskStatisticsPercentile a1 a2 =
withRealVector a1 $ \(a1'1, a1'2) ->
let {a2' = realToFrac a2} in
preErrorCheck $ \a3' ->
riskStatisticsPercentile'_ a1'1 a1'2 a2' a3' >>= \res ->
let {res' = realToFrac res} in
errorCheck a3'>>
return (res')
{-# LINE 232 "./QuantLib/Math.chs" #-}
riskStatisticsGaussianPercentile :: (RealVector)
-> (Double)
-> IO ((Double))
riskStatisticsGaussianPercentile a1 a2 =
withRealVector a1 $ \(a1'1, a1'2) ->
let {a2' = realToFrac a2} in
preErrorCheck $ \a3' ->
riskStatisticsGaussianPercentile'_ a1'1 a1'2 a2' a3' >>= \res ->
let {res' = realToFrac res} in
errorCheck a3'>>
return (res')
{-# LINE 238 "./QuantLib/Math.chs" #-}
riskStatisticsValueAtRisk :: (RealVector)
-> (Double)
-> IO ((Double))
riskStatisticsValueAtRisk a1 a2 =
withRealVector a1 $ \(a1'1, a1'2) ->
let {a2' = realToFrac a2} in
preErrorCheck $ \a3' ->
riskStatisticsValueAtRisk'_ a1'1 a1'2 a2' a3' >>= \res ->
let {res' = realToFrac res} in
errorCheck a3'>>
return (res')
{-# LINE 244 "./QuantLib/Math.chs" #-}
riskStatisticsGaussianValueAtRisk :: (RealVector)
-> (Double)
-> IO ((Double))
riskStatisticsGaussianValueAtRisk a1 a2 =
withRealVector a1 $ \(a1'1, a1'2) ->
let {a2' = realToFrac a2} in
preErrorCheck $ \a3' ->
riskStatisticsGaussianValueAtRisk'_ a1'1 a1'2 a2' a3' >>= \res ->
let {res' = realToFrac res} in
errorCheck a3'>>
return (res')
{-# LINE 250 "./QuantLib/Math.chs" #-}
riskStatisticsExpectedShortfall :: (RealVector)
-> (Double)
-> IO ((Double))
riskStatisticsExpectedShortfall a1 a2 =
withRealVector a1 $ \(a1'1, a1'2) ->
let {a2' = realToFrac a2} in
preErrorCheck $ \a3' ->
riskStatisticsExpectedShortfall'_ a1'1 a1'2 a2' a3' >>= \res ->
let {res' = realToFrac res} in
errorCheck a3'>>
return (res')
{-# LINE 257 "./QuantLib/Math.chs" #-}
riskStatisticsGaussianExpectedShortfall :: (RealVector)
-> (Double)
-> IO ((Double))
riskStatisticsGaussianExpectedShortfall a1 a2 =
withRealVector a1 $ \(a1'1, a1'2) ->
let {a2' = realToFrac a2} in
preErrorCheck $ \a3' ->
riskStatisticsGaussianExpectedShortfall'_ a1'1 a1'2 a2' a3' >>= \res ->
let {res' = realToFrac res} in
errorCheck a3'>>
return (res')
{-# LINE 263 "./QuantLib/Math.chs" #-}
riskStatisticsPotentialUpside :: (RealVector)
-> (Double)
-> IO ((Double))
riskStatisticsPotentialUpside a1 a2 =
withRealVector a1 $ \(a1'1, a1'2) ->
let {a2' = realToFrac a2} in
preErrorCheck $ \a3' ->
riskStatisticsPotentialUpside'_ a1'1 a1'2 a2' a3' >>= \res ->
let {res' = realToFrac res} in
errorCheck a3'>>
return (res')
{-# LINE 269 "./QuantLib/Math.chs" #-}
riskStatisticsGaussianPotentialUpside :: (RealVector)
-> (Double)
-> IO ((Double))
riskStatisticsGaussianPotentialUpside a1 a2 =
withRealVector a1 $ \(a1'1, a1'2) ->
let {a2' = realToFrac a2} in
preErrorCheck $ \a3' ->
riskStatisticsGaussianPotentialUpside'_ a1'1 a1'2 a2' a3' >>= \res ->
let {res' = realToFrac res} in
errorCheck a3'>>
return (res')
{-# LINE 275 "./QuantLib/Math.chs" #-}
riskStatisticsRegret :: (RealVector)
-> (Double)
-> IO ((Double))
riskStatisticsRegret a1 a2 =
withRealVector a1 $ \(a1'1, a1'2) ->
let {a2' = realToFrac a2} in
preErrorCheck $ \a3' ->
riskStatisticsRegret'_ a1'1 a1'2 a2' a3' >>= \res ->
let {res' = realToFrac res} in
errorCheck a3'>>
return (res')
{-# LINE 281 "./QuantLib/Math.chs" #-}
riskStatisticsShortfall :: (RealVector)
-> (Double)
-> IO ((Double))
riskStatisticsShortfall a1 a2 =
withRealVector a1 $ \(a1'1, a1'2) ->
let {a2' = realToFrac a2} in
preErrorCheck $ \a3' ->
riskStatisticsShortfall'_ a1'1 a1'2 a2' a3' >>= \res ->
let {res' = realToFrac res} in
errorCheck a3'>>
return (res')
{-# LINE 287 "./QuantLib/Math.chs" #-}
riskStatisticsAverageShortfall :: (RealVector)
-> (Double)
-> IO ((Double))
riskStatisticsAverageShortfall a1 a2 =
withRealVector a1 $ \(a1'1, a1'2) ->
let {a2' = realToFrac a2} in
preErrorCheck $ \a3' ->
riskStatisticsAverageShortfall'_ a1'1 a1'2 a2' a3' >>= \res ->
let {res' = realToFrac res} in
errorCheck a3'>>
return (res')
{-# LINE 293 "./QuantLib/Math.chs" #-}
toMatrixDouble :: (Word, Word, [Double]) -> Matrix Double
toMatrixDouble (r, c, d) = Matrix r c d
symmetricSchurDecomposition :: Matrix Double
-> IO ([Double], Matrix Double)
symmetricSchurDecomposition (Matrix mr mc md) = do
(values, r, c, vectors) <- qlSymmetricSchurDecomposition mr mc md
pure (values, Matrix r c vectors)
qlSymmetricSchurDecomposition :: (Word) -> (Word) -> ([Double]) -> IO (([Double]), (Word), (Word), ([Double]))
qlSymmetricSchurDecomposition :: Word -> Word -> [Double] -> IO ([Double], Word, Word, [Double])
qlSymmetricSchurDecomposition Word
a1 Word
a2 [Double]
a3 =
let {a1' :: CUInt
a1' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a1} in
let {a2' :: CUInt
a2' = Word -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
a2} in
[Double]
-> (Ptr CDouble -> IO ([Double], Word, Word, [Double]))
-> IO ([Double], Word, Word, [Double])
forall b. [Double] -> (Ptr CDouble -> IO b) -> IO b
withDoubleArrayRaw [Double]
a3 ((Ptr CDouble -> IO ([Double], Word, Word, [Double]))
-> IO ([Double], Word, Word, [Double]))
-> (Ptr CDouble -> IO ([Double], Word, Word, [Double]))
-> IO ([Double], Word, Word, [Double])
forall a b. (a -> b) -> a -> b
$ \Ptr CDouble
a3' ->
((Ptr CUInt, Ptr (Ptr CDouble))
-> IO ([Double], Word, Word, [Double]))
-> IO ([Double], Word, Word, [Double])
forall a b. ((Ptr CUInt, Ptr (Ptr a)) -> IO b) -> IO b
preArray (((Ptr CUInt, Ptr (Ptr CDouble))
-> IO ([Double], Word, Word, [Double]))
-> IO ([Double], Word, Word, [Double]))
-> ((Ptr CUInt, Ptr (Ptr CDouble))
-> IO ([Double], Word, Word, [Double]))
-> IO ([Double], Word, Word, [Double])
forall a b. (a -> b) -> a -> b
$ \(Ptr CUInt
a4'1, Ptr (Ptr CDouble)
a4'2) ->
(Ptr CUInt -> IO ([Double], Word, Word, [Double]))
-> IO ([Double], Word, Word, [Double])
forall a b. Storable a => (Ptr a -> IO b) -> IO b
prePtr ((Ptr CUInt -> IO ([Double], Word, Word, [Double]))
-> IO ([Double], Word, Word, [Double]))
-> (Ptr CUInt -> IO ([Double], Word, Word, [Double]))
-> IO ([Double], Word, Word, [Double])
forall a b. (a -> b) -> a -> b
$ \Ptr CUInt
a5' ->
(Ptr CUInt -> IO ([Double], Word, Word, [Double]))
-> IO ([Double], Word, Word, [Double])
forall a b. Storable a => (Ptr a -> IO b) -> IO b
prePtr ((Ptr CUInt -> IO ([Double], Word, Word, [Double]))
-> IO ([Double], Word, Word, [Double]))
-> (Ptr CUInt -> IO ([Double], Word, Word, [Double]))
-> IO ([Double], Word, Word, [Double])
forall a b. (a -> b) -> a -> b
$ \Ptr CUInt
a6' ->
((Ptr CUInt, Ptr (Ptr CDouble))
-> IO ([Double], Word, Word, [Double]))
-> IO ([Double], Word, Word, [Double])
forall a b. ((Ptr CUInt, Ptr (Ptr a)) -> IO b) -> IO b
preArray (((Ptr CUInt, Ptr (Ptr CDouble))
-> IO ([Double], Word, Word, [Double]))
-> IO ([Double], Word, Word, [Double]))
-> ((Ptr CUInt, Ptr (Ptr CDouble))
-> IO ([Double], Word, Word, [Double]))
-> IO ([Double], Word, Word, [Double])
forall a b. (a -> b) -> a -> b
$ \(Ptr CUInt
a7'1, Ptr (Ptr CDouble)
a7'2) ->
(Ptr (Ptr CChar) -> IO ([Double], Word, Word, [Double]))
-> IO ([Double], Word, Word, [Double])
forall a b. (Ptr (Ptr a) -> IO b) -> IO b
preErrorCheck ((Ptr (Ptr CChar) -> IO ([Double], Word, Word, [Double]))
-> IO ([Double], Word, Word, [Double]))
-> (Ptr (Ptr CChar) -> IO ([Double], Word, Word, [Double]))
-> IO ([Double], Word, Word, [Double])
forall a b. (a -> b) -> a -> b
$ \Ptr (Ptr CChar)
a8' ->
qlSymmetricSchurDecomposition'_ a1' a2' a3' a4'1 a4'2 a5' a6' a7'1 a7'2 a8' >>
peekDoubleArray a4'1 a4'2IO [Double]
-> ([Double] -> IO ([Double], Word, Word, [Double]))
-> IO ([Double], 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]
a4'' ->
peekWord a5'>>= \a5'' ->
peekWord a6'>>= \a6'' ->
peekDoubleArray a7'1 a7'2>>= \a7'' ->
errorCheck a8'>>
return (a4'', a5'', a6'', a7'')
{-# LINE 309 "./QuantLib/Math.chs" #-}
pseudoSqrt :: Matrix Double
-> SalvagingAlgorithm
-> IO (Matrix Double)
pseudoSqrt (Matrix mr mc md) salvaging = toMatrixDouble <$> qlPseudoSqrt mr mc md salvaging
qlPseudoSqrt :: (Word) -> (Word) -> ([Double]) -> (SalvagingAlgorithm) -> IO ((Word), (Word), ([Double]))
qlPseudoSqrt a1 a2 a3 a4 =
let {a1' = fromIntegral a1} in
let {a2' = fromIntegral a2} in
withDoubleArrayRaw a3 $ \a3' ->
let {a4' = fromEnumC a4} in
prePtr $ \a5' ->
prePtr $ \a6' ->
preArray $ \(a7'1, a7'2) ->
preErrorCheck $ \a8' ->
qlPseudoSqrt'_ a1' a2' a3' 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 321 "./QuantLib/Math.chs" #-}
rankReducedSqrt :: Matrix Double
-> Word
-> Double
-> SalvagingAlgorithm
-> IO (Matrix Double)
rankReducedSqrt (Matrix mr mc md) maxRank retained salvaging =
toMatrixDouble <$> qlRankReducedSqrt mr mc md maxRank retained salvaging
qlRankReducedSqrt :: (Word) -> (Word) -> ([Double]) -> (Word) -> (Double) -> (SalvagingAlgorithm) -> IO ((Word), (Word), ([Double]))
qlRankReducedSqrt a1 a2 a3 a4 a5 a6 =
let {a1' = fromIntegral a1} in
let {a2' = fromIntegral a2} in
withDoubleArrayRaw a3 $ \a3' ->
let {a4' = fromIntegral a4} in
let {a5' = realToFrac a5} in
let {a6' = fromEnumC a6} in
prePtr $ \a7' ->
prePtr $ \a8' ->
preArray $ \(a9'1, a9'2) ->
preErrorCheck $ \a10' ->
qlRankReducedSqrt'_ a1' a2' a3' a4' a5' a6' a7' a8' a9'1 a9'2 a10' >>
peekWord a7'>>= \a7'' ->
peekWord a8'>>= \a8'' ->
peekDoubleArray a9'1 a9'2>>= \a9'' ->
errorCheck a10'>>
return (a7'', a8'', a9'')
{-# LINE 336 "./QuantLib/Math.chs" #-}
choleskyDecomposition :: Matrix Double
-> Bool
-> IO (Matrix Double)
choleskyDecomposition (Matrix mr mc md) flexible = toMatrixDouble <$> qlCholeskyDecomposition mr mc md flexible
qlCholeskyDecomposition :: (Word) -> (Word) -> ([Double]) -> (Bool) -> IO ((Word), (Word), ([Double]))
qlCholeskyDecomposition a1 a2 a3 a4 =
let {a1' = fromIntegral a1} in
let {a2' = fromIntegral a2} in
withDoubleArrayRaw a3 $ \a3' ->
let {a4' = C2HSImp.fromBool a4} in
prePtr $ \a5' ->
prePtr $ \a6' ->
preArray $ \(a7'1, a7'2) ->
preErrorCheck $ \a8' ->
qlCholeskyDecomposition'_ a1' a2' a3' 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 349 "./QuantLib/Math.chs" #-}
choleskySolveFor :: Matrix Double
-> [Double]
-> IO [Double]
choleskySolveFor (Matrix mr mc md) b = qlCholeskySolveFor mr mc md b
qlCholeskySolveFor :: (Word) -> (Word) -> ([Double]) -> ([Double]) -> IO (([Double]))
qlCholeskySolveFor a1 a2 a3 a4 =
let {a1' = fromIntegral a1} in
let {a2' = fromIntegral a2} in
withDoubleArrayRaw a3 $ \a3' ->
withDoubleArray a4 $ \(a4'1, a4'2) ->
preArray $ \(a5'1, a5'2) ->
preErrorCheck $ \a6' ->
qlCholeskySolveFor'_ a1' a2' a3' a4'1 a4'2 a5'1 a5'2 a6' >>
peekDoubleArray a5'1 a5'2>>= \a5'' ->
errorCheck a6'>>
return (a5'')
{-# LINE 360 "./QuantLib/Math.chs" #-}
foreign import ccall safe "QuantLib/Math.chs.h qlRound"
applyRounding'_ :: ((C2HSImp.Ptr (CRounding)) -> (C2HSImp.CDouble -> (IO C2HSImp.CDouble)))
foreign import ccall safe "QuantLib/Math.chs.h qlOptimize"
optimize'_ :: ((C2HSImp.FunPtr ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> (IO C2HSImp.CDouble)))) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (CConstraint)) -> ((C2HSImp.Ptr (COptimizationMethod)) -> ((C2HSImp.Ptr (CEndCriteria)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ()))))))))))))
foreign import ccall safe "QuantLib/Math.chs.h qlTimeGrid1"
timeGrid'_ :: (C2HSImp.CDouble -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CTimeGrid))))))
foreign import ccall safe "QuantLib/Math.chs.h qlTimeGrid2"
timeGridFromVector'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CTimeGrid))))))
foreign import ccall safe "QuantLib/Math.chs.h qlTimeGrid3"
timeGridFromVectorWithSteps'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO (C2HSImp.Ptr (CTimeGrid)))))))
foreign import ccall safe "QuantLib/Math.chs.h qlTimeGridSize"
size'_ :: ((C2HSImp.Ptr (CTimeGrid)) -> (IO C2HSImp.CUInt))
foreign import ccall safe "QuantLib/Math.chs.h qlTimeGridAt"
timeAt'_ :: ((C2HSImp.Ptr (CTimeGrid)) -> (C2HSImp.CUInt -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))
foreign import ccall safe "QuantLib/Math.chs.h qlTimeGridPoints"
points'_ :: ((C2HSImp.Ptr (CTimeGrid)) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CDouble)) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO ())))))
foreign import ccall safe "QuantLib/Math.chs.h qlRiskStatisticsMean"
riskStatisticsMean'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))
foreign import ccall safe "QuantLib/Math.chs.h qlRiskStatisticsStandardDeviation"
riskStatisticsStandardDeviation'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))
foreign import ccall safe "QuantLib/Math.chs.h qlRiskStatisticsVariance"
riskStatisticsVariance'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))
foreign import ccall safe "QuantLib/Math.chs.h qlRiskStatisticsSkewness"
riskStatisticsSkewness'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))
foreign import ccall safe "QuantLib/Math.chs.h qlRiskStatisticsKurtosis"
riskStatisticsKurtosis'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))
foreign import ccall safe "QuantLib/Math.chs.h qlRiskStatisticsMin"
riskStatisticsMin'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))
foreign import ccall safe "QuantLib/Math.chs.h qlRiskStatisticsMax"
riskStatisticsMax'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))
foreign import ccall safe "QuantLib/Math.chs.h qlRiskStatisticsSemiVariance"
riskStatisticsSemiVariance'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))
foreign import ccall safe "QuantLib/Math.chs.h qlRiskStatisticsSemiDeviation"
riskStatisticsSemiDeviation'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))
foreign import ccall safe "QuantLib/Math.chs.h qlRiskStatisticsDownsideVariance"
riskStatisticsDownsideVariance'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))
foreign import ccall safe "QuantLib/Math.chs.h qlRiskStatisticsDownsideDeviation"
riskStatisticsDownsideDeviation'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble))))
foreign import ccall safe "QuantLib/Math.chs.h qlRiskStatisticsPercentile"
riskStatisticsPercentile'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))
foreign import ccall safe "QuantLib/Math.chs.h qlRiskStatisticsGaussianPercentile"
riskStatisticsGaussianPercentile'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))
foreign import ccall safe "QuantLib/Math.chs.h qlRiskStatisticsValueAtRisk"
riskStatisticsValueAtRisk'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))
foreign import ccall safe "QuantLib/Math.chs.h qlRiskStatisticsGaussianValueAtRisk"
riskStatisticsGaussianValueAtRisk'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))
foreign import ccall safe "QuantLib/Math.chs.h qlRiskStatisticsExpectedShortfall"
riskStatisticsExpectedShortfall'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))
foreign import ccall safe "QuantLib/Math.chs.h qlRiskStatisticsGaussianExpectedShortfall"
riskStatisticsGaussianExpectedShortfall'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))
foreign import ccall safe "QuantLib/Math.chs.h qlRiskStatisticsPotentialUpside"
riskStatisticsPotentialUpside'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))
foreign import ccall safe "QuantLib/Math.chs.h qlRiskStatisticsGaussianPotentialUpside"
riskStatisticsGaussianPotentialUpside'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))
foreign import ccall safe "QuantLib/Math.chs.h qlRiskStatisticsRegret"
riskStatisticsRegret'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))
foreign import ccall safe "QuantLib/Math.chs.h qlRiskStatisticsShortfall"
riskStatisticsShortfall'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))
foreign import ccall safe "QuantLib/Math.chs.h qlRiskStatisticsAverageShortfall"
riskStatisticsAverageShortfall'_ :: (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CDouble -> ((C2HSImp.Ptr (C2HSImp.Ptr C2HSImp.CChar)) -> (IO C2HSImp.CDouble)))))
foreign import ccall safe "QuantLib/Math.chs.h qlSymmetricSchurDecomposition"
qlSymmetricSchurDecomposition'_ :: (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> ((C2HSImp.Ptr C2HSImp.CUInt) -> ((C2HSImp.Ptr (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/Math.chs.h qlPseudoSqrt"
qlPseudoSqrt'_ :: (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> ((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/Math.chs.h qlRankReducedSqrt"
qlRankReducedSqrt'_ :: (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CUInt -> (C2HSImp.CDouble -> (C2HSImp.CInt -> ((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/Math.chs.h qlCholeskyDecomposition"
qlCholeskyDecomposition'_ :: (C2HSImp.CUInt -> (C2HSImp.CUInt -> ((C2HSImp.Ptr C2HSImp.CDouble) -> (C2HSImp.CInt -> ((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/Math.chs.h qlCholeskySolveFor"
qlCholeskySolveFor'_ :: (C2HSImp.CUInt -> (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 ())))))))))