packages feed

hasquant-0.5.0.2: QuantLib/Math.chs

module QuantLib.Math
  (
    RoundingType(..)
  , Rounding(..)
  , applyRounding

  , EndCriteriaType(..)
  , HistogramAlgorithm(..)

  , Approximation(..)
  , Interpolation(..)
  , Interpolation2D(..)

  , RngTrait(..)
  , BinomialTree(..)
  , BoundaryConditionSide(..)
  , FdmSchemeType(..)
  , FdmScheme(..)
  , PolynomialType(..)
  , ComplexLogFormula(..)
  , CmsMarketCalibrationType(..)
  , EndCriteria(..)
  , OptimizationMethod(..)
  , Constraint(..)
  , SobolDirectionIntegers(..)

  , Matrix(..)
  , realMatrix
  , objectMatrix

  , TimeGrid
  , timeGrid
  , timeGridFromList
  , timeGridFromList'
  , timeAt
  , size
  , points
  , points'
  ) where
import QuantLib.Internal
import QuantLib.Internal.Enum
import QuantLib.Internal.Type
import Foreign.C.Types(CDouble)
import Data.Vector.Storable(Vector)
import Data.List.NonEmpty(NonEmpty)

#include "qlTypesC2HS.h"
#include "ql.h"

#include "qlEnumC2HS.h"
#include "qlEnumObjects.h"

{#enum EndCriteriaType{} deriving(Show, Eq)#}
{#enum HistogramAlgorithm{} deriving(Show, Eq)#}
{#enum RngTrait{} deriving(Show, Eq)#}
{#enum BinomialTree{} deriving(Show, Eq)#}
{#enum BoundaryConditionSide{} deriving(Show, Eq)#}
{#enum PolynomialType{} deriving(Show, Eq)#}
{#enum ComplexLogFormula{} deriving(Show, Eq)#}
{#enum CmsMarketCalibrationType{} deriving(Show, Eq)#}
{#enum SobolDirectionIntegers{} deriving(Show, Eq)#}

{#pointer *TimeGrid foreign -> CTimeGrid nocode#}
{#pointer *Rounding as QlRounding foreign -> CRounding nocode#}

-- |rounds a value to the precision and rule carried by the given 'Rounding'
{#fun pure qlRound as applyRounding{withRounding*`Rounding' -- ^rounding
  ,`Double' -- ^value
  }->`Double'#}

-- |Regularly spaced time-grid.
{#fun qlTimeGrid1 as timeGrid{`Double' -- ^end
  ,fromIntegral`Word' -- ^steps
  ,preErrorCheck-`String'errorCheck*-}->`TimeGrid'peekTimeGrid*#}

-- |Time grid with mandatory time points.
-- Mandatory points are guaranteed to belong to the grid. No additional points are added.
{#fun qlTimeGrid2 as timeGridFromList{withNonEmptyDoubleArray*`NonEmpty Double'&,preErrorCheck-`String'errorCheck*-}->`TimeGrid'peekTimeGrid*#}

-- |Time grid with mandatory time points.
-- Mandatory points are guaranteed to belong to the grid. Additional points are then added with regular spacing between pairs of mandatory times in order to reach the desired number of steps.
{#fun qlTimeGrid3 as timeGridFromList'{withNonEmptyDoubleArray*`NonEmpty Double'&,fromIntegral`Word',preErrorCheck-`String'errorCheck*-}->`TimeGrid'peekTimeGrid*#}

-- |returns the number of times on the grid
{#fun pure qlTimeGridSize as size{withTimeGrid*`TimeGrid'}->`Word'fromIntegral#}

-- |returns the time at the given index of the grid
{#fun qlTimeGridAt as timeAt{withTimeGrid*`TimeGrid' -- ^grid
  ,fromIntegral`Word' -- ^index
  ,preErrorCheck-`String'errorCheck*-}->`Double'#}

-- |returns all the times on the grid, as a list
{#fun qlTimeGridPoints as points{withTimeGrid*`TimeGrid',preArray-`[Double]'&peekDoubleArray*,preErrorCheck-`String'errorCheck*-}->`()'#}

-- |returns all the times on the grid, as a vector
{#fun qlTimeGridPoints as points'{withTimeGrid*`TimeGrid',preArray-`Vector CDouble'&peekDoubleVector*,preErrorCheck-`String'errorCheck*-}->`()'#}

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