module Bindings.LevMar
( c'LM_VERSION
, c'LM_OPTS_SZ
, c'LM_INFO_SZ
, c'LM_ERROR
, c'LM_ERROR_LAPACK_ERROR
, c'LM_ERROR_NO_JACOBIAN
, c'LM_ERROR_NO_BOX_CONSTRAINTS
, c'LM_ERROR_FAILED_BOX_CHECK
, c'LM_ERROR_MEMORY_ALLOCATION_FAILURE
, c'LM_ERROR_CONSTRAINT_MATRIX_ROWS_GT_COLS
, c'LM_ERROR_CONSTRAINT_MATRIX_NOT_FULL_ROW_RANK
, c'LM_ERROR_TOO_FEW_MEASUREMENTS
, c'LM_ERROR_SINGULAR_MATRIX
, c'LM_ERROR_SUM_OF_SQUARES_NOT_FINITE
, c'LM_INIT_MU
, c'LM_STOP_THRESH
, c'LM_DIFF_DELTA
, Parameters
, Measurements
, Options
, LowerBounds
, UpperBounds
, ConstraintsMatrix
, ConstraintsVector
, Weights
, Info
, Work
, Covar
, AData
, NrOfParameters
, NrOfMeasurements
, NrOfConstraints
, MaxIterations
, Model
, Jacobian
, withModel
, withJacobian
, LevMarDer
, LevMarDif
, LevMarBCDer
, LevMarBCDif
, LevMarLecDer
, LevMarLecDif
, LevMarBLecDer
, LevMarBLecDif
, c'dlevmar_der
, c'slevmar_der
, c'dlevmar_dif
, c'slevmar_dif
, c'dlevmar_bc_der
, c'slevmar_bc_der
, c'dlevmar_bc_dif
, c'slevmar_bc_dif
, c'dlevmar_lec_der
, c'slevmar_lec_der
, c'dlevmar_lec_dif
, c'slevmar_lec_dif
, c'dlevmar_blec_der
, c'slevmar_blec_der
, c'dlevmar_blec_dif
, c'slevmar_blec_dif
, Errors
, LevMarChkJac
, c'dlevmar_chkjac
, c'slevmar_chkjac
, BestFitParameterIx
, LevMarStddev
, LevMarCorCoef
, LevMarR2
, Result
, c'dlevmar_stddev
, c'slevmar_stddev
, c'dlevmar_corcoef
, c'slevmar_corcoef
, c'dlevmar_R2
, c'slevmar_R2
) where
import Prelude ( Num, Fractional )
import System.IO ( IO )
import Data.Char ( String )
import Foreign.C.Types ( CInt, CFloat, CDouble )
import Foreign.Ptr ( Ptr, FunPtr, freeHaskellFunPtr )
import Control.Exception ( bracket )
c'LM_VERSION :: String
c'LM_VERSION = "2.4 (April 2009)"
c'LM_OPTS_SZ = 5
c'LM_OPTS_SZ :: (Num a) => a
c'LM_INFO_SZ = 10
c'LM_INFO_SZ :: (Num a) => a
c'LM_ERROR = 1
c'LM_ERROR :: (Num a) => a
c'LM_ERROR_LAPACK_ERROR = 2
c'LM_ERROR_LAPACK_ERROR :: (Num a) => a
c'LM_ERROR_NO_JACOBIAN = 3
c'LM_ERROR_NO_JACOBIAN :: (Num a) => a
c'LM_ERROR_NO_BOX_CONSTRAINTS = 4
c'LM_ERROR_NO_BOX_CONSTRAINTS :: (Num a) => a
c'LM_ERROR_FAILED_BOX_CHECK = 5
c'LM_ERROR_FAILED_BOX_CHECK :: (Num a) => a
c'LM_ERROR_MEMORY_ALLOCATION_FAILURE = 6
c'LM_ERROR_MEMORY_ALLOCATION_FAILURE :: (Num a) => a
c'LM_ERROR_CONSTRAINT_MATRIX_ROWS_GT_COLS = 7
c'LM_ERROR_CONSTRAINT_MATRIX_ROWS_GT_COLS :: (Num a) => a
c'LM_ERROR_CONSTRAINT_MATRIX_NOT_FULL_ROW_RANK = 8
c'LM_ERROR_CONSTRAINT_MATRIX_NOT_FULL_ROW_RANK :: (Num a) => a
c'LM_ERROR_TOO_FEW_MEASUREMENTS = 9
c'LM_ERROR_TOO_FEW_MEASUREMENTS :: (Num a) => a
c'LM_ERROR_SINGULAR_MATRIX = 10
c'LM_ERROR_SINGULAR_MATRIX :: (Num a) => a
c'LM_ERROR_SUM_OF_SQUARES_NOT_FINITE = 11
c'LM_ERROR_SUM_OF_SQUARES_NOT_FINITE :: (Num a) => a
c'LM_INIT_MU = 1.000000e-03
c'LM_INIT_MU :: (Fractional a) => a
c'LM_STOP_THRESH = 1.000000e-17
c'LM_STOP_THRESH :: (Fractional a) => a
c'LM_DIFF_DELTA = 1.000000e-06
c'LM_DIFF_DELTA :: (Fractional a) => a
type Parameters = Ptr
type Measurements = Ptr
type Options = Ptr
type LowerBounds = Ptr
type UpperBounds = Ptr
type ConstraintsMatrix = Ptr
type ConstraintsVector = Ptr
type Weights = Ptr
type Info = Ptr
type Work = Ptr
type Covar = Ptr
type AData = Ptr ()
type NrOfParameters = CInt
type NrOfMeasurements = CInt
type NrOfConstraints = CInt
type MaxIterations = CInt
type Model r = Parameters r
-> Measurements r
-> NrOfParameters
-> NrOfMeasurements
-> AData
-> IO ()
type Jacobian a = Model a
foreign import ccall "wrapper" mkModel :: Model a -> IO (FunPtr (Model a))
mkJacobian :: Jacobian a -> IO (FunPtr (Jacobian a))
mkJacobian = mkModel
withModel :: Model a -> (FunPtr (Model a) -> IO b) -> IO b
withModel m = bracket (mkModel m) freeHaskellFunPtr
withJacobian :: Jacobian a -> (FunPtr (Jacobian a) -> IO b) -> IO b
withJacobian j = bracket (mkJacobian j) freeHaskellFunPtr
type LevMarDer cr = FunPtr (Model cr)
-> FunPtr (Jacobian cr)
-> Parameters cr
-> Measurements cr
-> NrOfParameters
-> NrOfMeasurements
-> MaxIterations
-> Options cr
-> Info cr
-> Work cr
-> Covar cr
-> AData
-> IO CInt
type LevMarDif cr = FunPtr (Model cr)
-> Parameters cr
-> Measurements cr
-> NrOfParameters
-> NrOfMeasurements
-> MaxIterations
-> Options cr
-> Info cr
-> Work cr
-> Covar cr
-> AData
-> IO CInt
type LevMarBCDer cr = FunPtr (Model cr)
-> FunPtr (Jacobian cr)
-> Parameters cr
-> Measurements cr
-> NrOfParameters
-> NrOfMeasurements
-> LowerBounds cr
-> UpperBounds cr
-> MaxIterations
-> Options cr
-> Info cr
-> Work cr
-> Covar cr
-> AData
-> IO CInt
type LevMarBCDif cr = FunPtr (Model cr)
-> Parameters cr
-> Measurements cr
-> NrOfParameters
-> NrOfMeasurements
-> LowerBounds cr
-> UpperBounds cr
-> MaxIterations
-> Options cr
-> Info cr
-> Work cr
-> Covar cr
-> AData
-> IO CInt
type LevMarLecDer cr = FunPtr (Model cr)
-> FunPtr (Jacobian cr)
-> Parameters cr
-> Measurements cr
-> NrOfParameters
-> NrOfMeasurements
-> ConstraintsMatrix cr
-> ConstraintsVector cr
-> NrOfConstraints
-> MaxIterations
-> Options cr
-> Info cr
-> Work cr
-> Covar cr
-> AData
-> IO CInt
type LevMarLecDif cr = FunPtr (Model cr)
-> Parameters cr
-> Measurements cr
-> NrOfParameters
-> NrOfMeasurements
-> ConstraintsMatrix cr
-> ConstraintsVector cr
-> NrOfConstraints
-> MaxIterations
-> Options cr
-> Info cr
-> Work cr
-> Covar cr
-> AData
-> IO CInt
type LevMarBLecDer cr = FunPtr (Model cr)
-> FunPtr (Jacobian cr)
-> Parameters cr
-> Measurements cr
-> NrOfParameters
-> NrOfMeasurements
-> LowerBounds cr
-> UpperBounds cr
-> ConstraintsMatrix cr
-> ConstraintsVector cr
-> NrOfConstraints
-> Weights cr
-> MaxIterations
-> Options cr
-> Info cr
-> Work cr
-> Covar cr
-> AData
-> IO CInt
type LevMarBLecDif cr = FunPtr (Model cr)
-> Parameters cr
-> Measurements cr
-> NrOfParameters
-> NrOfMeasurements
-> LowerBounds cr
-> UpperBounds cr
-> ConstraintsMatrix cr
-> ConstraintsVector cr
-> NrOfConstraints
-> Weights cr
-> MaxIterations
-> Options cr
-> Info cr
-> Work cr
-> Covar cr
-> AData
-> IO CInt
foreign import ccall "slevmar_der" c'slevmar_der
:: LevMarDer CFloat
foreign import ccall "&slevmar_der" p'slevmar_der
:: FunPtr (LevMarDer CFloat)
foreign import ccall "dlevmar_der" c'dlevmar_der
:: LevMarDer CDouble
foreign import ccall "&dlevmar_der" p'dlevmar_der
:: FunPtr (LevMarDer CDouble)
foreign import ccall "slevmar_dif" c'slevmar_dif
:: LevMarDif CFloat
foreign import ccall "&slevmar_dif" p'slevmar_dif
:: FunPtr (LevMarDif CFloat)
foreign import ccall "dlevmar_dif" c'dlevmar_dif
:: LevMarDif CDouble
foreign import ccall "&dlevmar_dif" p'dlevmar_dif
:: FunPtr (LevMarDif CDouble)
foreign import ccall "slevmar_bc_der" c'slevmar_bc_der
:: LevMarBCDer CFloat
foreign import ccall "&slevmar_bc_der" p'slevmar_bc_der
:: FunPtr (LevMarBCDer CFloat)
foreign import ccall "dlevmar_bc_der" c'dlevmar_bc_der
:: LevMarBCDer CDouble
foreign import ccall "&dlevmar_bc_der" p'dlevmar_bc_der
:: FunPtr (LevMarBCDer CDouble)
foreign import ccall "slevmar_bc_dif" c'slevmar_bc_dif
:: LevMarBCDif CFloat
foreign import ccall "&slevmar_bc_dif" p'slevmar_bc_dif
:: FunPtr (LevMarBCDif CFloat)
foreign import ccall "dlevmar_bc_dif" c'dlevmar_bc_dif
:: LevMarBCDif CDouble
foreign import ccall "&dlevmar_bc_dif" p'dlevmar_bc_dif
:: FunPtr (LevMarBCDif CDouble)
foreign import ccall "slevmar_lec_der" c'slevmar_lec_der
:: LevMarLecDer CFloat
foreign import ccall "&slevmar_lec_der" p'slevmar_lec_der
:: FunPtr (LevMarLecDer CFloat)
foreign import ccall "dlevmar_lec_der" c'dlevmar_lec_der
:: LevMarLecDer CDouble
foreign import ccall "&dlevmar_lec_der" p'dlevmar_lec_der
:: FunPtr (LevMarLecDer CDouble)
foreign import ccall "slevmar_lec_dif" c'slevmar_lec_dif
:: LevMarLecDif CFloat
foreign import ccall "&slevmar_lec_dif" p'slevmar_lec_dif
:: FunPtr (LevMarLecDif CFloat)
foreign import ccall "dlevmar_lec_dif" c'dlevmar_lec_dif
:: LevMarLecDif CDouble
foreign import ccall "&dlevmar_lec_dif" p'dlevmar_lec_dif
:: FunPtr (LevMarLecDif CDouble)
foreign import ccall "slevmar_blec_der" c'slevmar_blec_der
:: LevMarBLecDer CFloat
foreign import ccall "&slevmar_blec_der" p'slevmar_blec_der
:: FunPtr (LevMarBLecDer CFloat)
foreign import ccall "dlevmar_blec_der" c'dlevmar_blec_der
:: LevMarBLecDer CDouble
foreign import ccall "&dlevmar_blec_der" p'dlevmar_blec_der
:: FunPtr (LevMarBLecDer CDouble)
foreign import ccall "slevmar_blec_dif" c'slevmar_blec_dif
:: LevMarBLecDif CFloat
foreign import ccall "&slevmar_blec_dif" p'slevmar_blec_dif
:: FunPtr (LevMarBLecDif CFloat)
foreign import ccall "dlevmar_blec_dif" c'dlevmar_blec_dif
:: LevMarBLecDif CDouble
foreign import ccall "&dlevmar_blec_dif" p'dlevmar_blec_dif
:: FunPtr (LevMarBLecDif CDouble)
type Errors = Ptr
type LevMarChkJac cr = FunPtr (Model cr)
-> FunPtr (Jacobian cr)
-> Parameters cr
-> NrOfParameters
-> NrOfMeasurements
-> AData
-> Errors cr
-> IO ()
foreign import ccall "dlevmar_chkjac" c'dlevmar_chkjac
:: LevMarChkJac CDouble
foreign import ccall "&dlevmar_chkjac" p'dlevmar_chkjac
:: FunPtr (LevMarChkJac CDouble)
foreign import ccall "slevmar_chkjac" c'slevmar_chkjac
:: LevMarChkJac CFloat
foreign import ccall "&slevmar_chkjac" p'slevmar_chkjac
:: FunPtr (LevMarChkJac CFloat)
type BestFitParameterIx = CInt
type LevMarStddev cr = Covar cr
-> NrOfParameters
-> BestFitParameterIx
-> IO cr
type LevMarCorCoef cr = Covar cr
-> NrOfParameters
-> BestFitParameterIx
-> BestFitParameterIx
-> IO cr
type LevMarR2 cr = FunPtr (Model cr)
-> Parameters cr
-> Measurements cr
-> NrOfParameters
-> NrOfMeasurements
-> AData
-> Result cr
-> IO CInt
type Result = Ptr
foreign import ccall "dlevmar_stddev" c'dlevmar_stddev
:: LevMarStddev CDouble
foreign import ccall "&dlevmar_stddev" p'dlevmar_stddev
:: FunPtr (LevMarStddev CDouble)
foreign import ccall "slevmar_stddev" c'slevmar_stddev
:: LevMarStddev CFloat
foreign import ccall "&slevmar_stddev" p'slevmar_stddev
:: FunPtr (LevMarStddev CFloat)
foreign import ccall "dlevmar_corcoef" c'dlevmar_corcoef
:: LevMarCorCoef CDouble
foreign import ccall "&dlevmar_corcoef" p'dlevmar_corcoef
:: FunPtr (LevMarCorCoef CDouble)
foreign import ccall "slevmar_corcoef" c'slevmar_corcoef
:: LevMarCorCoef CFloat
foreign import ccall "&slevmar_corcoef" p'slevmar_corcoef
:: FunPtr (LevMarCorCoef CFloat)
foreign import ccall "dlevmar_R2" c'dlevmar_R2
:: LevMarR2 CDouble
foreign import ccall "&dlevmar_R2" p'dlevmar_R2
:: FunPtr (LevMarR2 CDouble)
foreign import ccall "slevmar_R2" c'slevmar_R2
:: LevMarR2 CFloat
foreign import ccall "&slevmar_R2" p'slevmar_R2
:: FunPtr (LevMarR2 CFloat)