module Numeric.GSL.Fitting.Linear (
linear, linear_w
) where
import Data.Packed.Vector
import Data.Packed.Matrix
import Data.Packed.Development
import Foreign
import Foreign.ForeignPtr
import Foreign.C.Types(CInt)
linear :: Vector Double
-> Vector Double
-> (Vector Double,Vector Double,Matrix Double,Matrix Double,Matrix Double,Matrix Double)
linear x y = unsafePerformIO $ do
let s = dim x
c0 <- createVector 1
c1 <- createVector 1
cov00 <- createMatrix RowMajor s s
cov01 <- createMatrix RowMajor s s
cov11 <- createMatrix RowMajor s s
chi_sq <- createMatrix RowMajor s s
app8 fitting_linear vec x vec y vec c0 vec c1 mat cov00 mat cov01 mat cov11 mat chi_sq "linear"
return (c0,c1,cov00,cov01,cov11,chi_sq)
foreign import ccall "fitting-aux.h linear" fitting_linear :: CInt -> Ptr Double -> CInt -> Ptr Double -> CInt -> Ptr Double -> CInt -> Ptr Double -> CInt -> CInt -> Ptr Double -> CInt -> CInt -> Ptr Double -> CInt -> CInt -> Ptr Double -> CInt -> CInt -> Ptr Double -> IO CInt
linear_w :: Vector Double
-> Vector Double
-> Vector Double
-> (Vector Double,Vector Double,Matrix Double,Matrix Double,Matrix Double,Matrix Double)
linear_w x w y = unsafePerformIO $ do
let s = dim x
c0 <- createVector 1
c1 <- createVector 1
cov00 <- createMatrix RowMajor s s
cov01 <- createMatrix RowMajor s s
cov11 <- createMatrix RowMajor s s
chi_sq <- createMatrix RowMajor s s
app9 fitting_linear_w vec x vec w vec y vec c0 vec c1 mat cov00 mat cov01 mat cov11 mat chi_sq "linear_w"
return (c0,c1,cov00,cov01,cov11,chi_sq)
foreign import ccall "fitting-aux.h linear_weighted" fitting_linear_w :: CInt -> Ptr Double -> CInt -> Ptr Double -> CInt -> Ptr Double -> CInt -> Ptr Double -> CInt -> Ptr Double -> CInt -> CInt -> Ptr Double -> CInt -> CInt -> Ptr Double -> CInt -> CInt -> Ptr Double -> CInt -> CInt -> Ptr Double -> IO CInt