summaryrefslogtreecommitdiff
path: root/lib/GSL/Minimization.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/GSL/Minimization.hs')
-rw-r--r--lib/GSL/Minimization.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/GSL/Minimization.hs b/lib/GSL/Minimization.hs
index a59977e..aa89475 100644
--- a/lib/GSL/Minimization.hs
+++ b/lib/GSL/Minimization.hs
@@ -150,9 +150,11 @@ minimizeConjugateGradient istep minimpar tol maxit f df xi = unsafePerformIO $ d
150 df' = (fromList . df . toList) 150 df' = (fromList . df . toList)
151 fp <- mkVecfun (iv f') 151 fp <- mkVecfun (iv f')
152 dfp <- mkVecVecfun (aux_vTov df') 152 dfp <- mkVecVecfun (aux_vTov df')
153 print "entro"
153 rawpath <- createMIO maxit (n+2) 154 rawpath <- createMIO maxit (n+2)
154 (c_minimizeConjugateGradient fp dfp istep minimpar tol maxit // vec xiv) 155 (c_minimizeConjugateGradient fp dfp istep minimpar tol maxit // vec xiv)
155 "minimizeDerivV" [xiv] 156 "minimizeDerivV" [xiv]
157 print "salgo"
156 let it = round (rawpath @@> (maxit-1,0)) 158 let it = round (rawpath @@> (maxit-1,0))
157 path = takeRows it rawpath 159 path = takeRows it rawpath
158 sol = toList $ cdat $ dropColumns 2 $ dropRows (it-1) path 160 sol = toList $ cdat $ dropColumns 2 $ dropRows (it-1) path
@@ -186,12 +188,12 @@ foreign import ccall "wrapper"
186 188
187aux_vTov :: (Vector Double -> Vector Double) -> (Int -> Ptr Double -> Ptr Double -> IO()) 189aux_vTov :: (Vector Double -> Vector Double) -> (Int -> Ptr Double -> Ptr Double -> IO())
188aux_vTov f n p r = g where 190aux_vTov f n p r = g where
189 V {fptr = pr, ptr = p} = f x 191 V {fptr = pr, ptr = t} = f x
190 x = createV n copy "aux_vTov" [] 192 x = createV n copy "aux_vTov" []
191 copy n q = do 193 copy n q = do
192 copyArray q p n 194 copyArray q p n
193 return 0 195 return 0
194 g = withForeignPtr pr $ \_ -> copyArray r p n 196 g = withForeignPtr pr $ \_ -> copyArray r t n
195 197
196-------------------------------------------------------------------- 198--------------------------------------------------------------------
197 199