RANSAC 0.1.0.1 → 0.1.0.2
raw patch · 4 files changed
+49/−8 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- .travis.yml +40/−2
- RANSAC.cabal +1/−1
- src/Numeric/Ransac.hs +4/−3
- tests/SmokeTest.hs +4/−2
.travis.yml view
@@ -1,3 +1,41 @@-language: haskell+env:+ - CABALVER=1.18 GHCVER=7.6.3+ - CABALVER=1.18 GHCVER=7.8.3+ - CABALVER=1.22 GHCVER=7.10.1++before_install:+ - travis_retry sudo add-apt-repository -y ppa:hvr/ghc+ - travis_retry sudo apt-get update+ - travis_retry sudo apt-get -qq -y install cabal-install-$CABALVER ghc-$GHCVER+ - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH+ install:- - cabal install --enable-tests --force-reinstalls+ - cabal --version+ - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"+ - travis_retry cabal update+ - |+ if [ $GHCVER = "head" ] || [ ${GHCVER%.*} = "7.8" ] || [ ${GHCVER%.*} = "7.10" ]; then+ travis_retry sudo apt-get install happy-1.19.4 alex-3.1.3+ export PATH=/opt/alex/3.1.3/bin:/opt/happy/1.19.4/bin:$PATH+ else+ travis_retry sudo apt-get install happy alex+ fi+ + - cabal install --dependencies-only --enable-tests++script:+ - cabal configure --enable-tests+ - cabal build+ - cabal test+ - cabal check || true+ - cabal sdist++# The following scriptlet checks that the resulting source distribution can be built & installed+ - export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ;+ cd dist/;+ if [ -f "$SRC_TGZ" ]; then+ cabal install --force-reinstalls "$SRC_TGZ";+ else+ echo "expected '$SRC_TGZ' not found";+ exit 1;+ fi
RANSAC.cabal view
@@ -1,5 +1,5 @@ name: RANSAC-version: 0.1.0.1+version: 0.1.0.2 synopsis: The RANSAC algorithm for parameter estimation. description: The RANdom SAmple Consensus (RANSAC) algorithm for estimating the parameters of a mathematical model
src/Numeric/Ransac.hs view
@@ -54,9 +54,10 @@ genModel = do model <- untilJust (fit <$> sample) let !errors = V.map (residual model) pts !inliers = V.ifilter (const . goodFit . (errors !)) pts- Just model' = fit inliers- err = V.sum $ V.map (residual model') pts- return (model', err, inliers)+ case fit inliers of+ Nothing -> genModel+ Just model' -> let err = V.sum $ V.map (residual model') pts+ in return (model', err, inliers) n = V.length pts ratioInliers n' = fromIntegral n' / fromIntegral n {-# INLINE ransac #-}
tests/SmokeTest.hs view
@@ -19,13 +19,15 @@ -- | Fit a 2D line to a collection of 'Point's. fitLine :: Vector Point -> Maybe (V2 Float)-fitLine pts = (!* b) <$> inv22 a+fitLine pts = (!* b) <$> inv22' a where sx = V.sum $ V.map (view _x) pts a = V2 (V2 (V.sum (V.map (sq . view _x) pts)) sx) (V2 sx (fromIntegral (V.length pts))) b = V2 (V.sum (V.map F.product pts)) (V.sum (V.map (view _y) pts))-+ inv22' m = let m' = inv22 m + in if F.any (F.any isNaN) m' then Nothing else Just m'+ -- | Compute the error of a 'Point' with respect to a hypothesized -- linear model. ptError :: V2 Float -> Point -> Float