levmar 0.2 → 0.2.1
raw patch · 3 files changed
+22/−11 lines, 3 filesdep ~bindings-levmar
Dependency ranges changed: bindings-levmar
Files
- LevMar/Intermediate/AD.hs +10/−5
- LevMar/Intermediate/Fitting/AD.hs +10/−4
- levmar.cabal +2/−2
LevMar/Intermediate/AD.hs view
@@ -24,6 +24,8 @@ module LevMar.Intermediate.AD ( -- * Model. LMA_I.Model+ , LMA_I.Jacobian+ , jacobianOf -- * Levenberg-Marquardt algorithm. , LMA_I.LevMarable@@ -91,11 +93,14 @@ convertModel :: LMA_I.Model (r :~> r) -> LMA_I.Model r convertModel mdl = map value . mdl . map constant - jacobianOf :: LMA_I.Model (r :~> r) -> LMA_I.Jacobian r- (jacobianOf mdl) ps = map (\fs -> zipWith (firstDeriv .) fs ps)- . transpose $ map mdl pDs- where- pDs = [idDAt n ps | n <- [0 .. length ps - 1]]+-- | Compute the 'LMA_I.Jacobian' of the 'LMA_I.Model' using Automatic+-- Differentiation.+jacobianOf :: (HasBasis r, Basis r ~ (), VectorSpace (Scalar r))+ => LMA_I.Model (r :~> r) -> LMA_I.Jacobian r+(jacobianOf mdl) ps = map (\fs -> zipWith (firstDeriv .) fs ps)+ . transpose $ map mdl pDs+ where+ pDs = [idDAt n ps | n <- [0 .. length ps - 1]] -- The End ---------------------------------------------------------------------
LevMar/Intermediate/Fitting/AD.hs view
@@ -25,6 +25,9 @@ ( -- * Model. LMA_I.Model , LMA_I.SimpleModel+ , LMA_I.Jacobian+ , LMA_I.SimpleJacobian+ , jacobianOf -- * Levenberg-Marquardt algorithm. , LMA_I.LevMarable@@ -91,10 +94,13 @@ convertModel :: LMA_I.Model (r :~> r) a -> LMA_I.Model r a convertModel mdl = \ps -> value . mdl (map constant ps) - jacobianOf :: LMA_I.Model (r :~> r) a -> LMA_I.Jacobian r a- jacobianOf mdl =- \ps x -> map (\(ix, p) -> firstDeriv $ mdl (idDAt ix ps) x p)- $ zip [0..] ps+-- | Compute the 'LMA_I.Jacobian' of the 'LMA_I.Model' using Automatic+-- Differentiation.+jacobianOf :: (HasBasis r, Basis r ~ (), VectorSpace (Scalar r))+ => LMA_I.Model (r :~> r) a -> LMA_I.Jacobian r a+jacobianOf mdl =+ \ps x -> map (\(ix, p) -> firstDeriv $ mdl (idDAt ix ps) x p) $+ zip [0..] ps -- The End ---------------------------------------------------------------------
levmar.cabal view
@@ -1,5 +1,5 @@ name: levmar-version: 0.2+version: 0.2.1 cabal-version: >= 1.6 build-type: Simple stability: experimental@@ -83,7 +83,7 @@ library build-depends: base >= 3 && < 4.2- , bindings-levmar == 0.1.*+ , bindings-levmar >= 0.1.1.1 && < 0.2 , vector-space >= 0.5.7 && < 0.6 , MemoTrie >= 0.4.5 && < 0.5 exposed-modules: LevMar