optimization 0.1.6 → 0.1.7
raw patch · 3 files changed
+7/−95 lines, 3 filesdep −directorydep −doctestdep −filepathdep ~basedep ~semigroupoids
Dependencies removed: directory, doctest, filepath
Dependency ranges changed: base, semigroupoids
Files
- optimization.cabal +6/−22
- src/Optimization/LineSearch/ConjugateGradient.hs +1/−0
- tests/doctests.hsc +0/−73
optimization.cabal view
@@ -1,6 +1,6 @@ name: optimization category: Math-version: 0.1.6+version: 0.1.7 license: BSD3 cabal-version: >= 1.10 license-file: LICENSE@@ -21,13 +21,11 @@ a number of optimization techniques from the modern optimization literature. .- Those seeking a high-level overview of some of these methods are- referred to Stephen Wright's excellent tutorial from NIPS 2010- <http://videolectures.net/nips2010_wright_oaml/>. A deeper- introduction can be found in Boyd and Vandenberghe's *Complex- Optimization* which available freely online.+ A deep introduction to optimization can be found in Boyd and Vandenberghe's+ *Convex Optimization* which available freely online,+ (<http://web.stanford.edu/~boyd/cvxbook/>). -build-type: Custom+build-type: Simple extra-source-files: .ghci@@ -53,7 +51,7 @@ vector >= 0.10 && < 1.0, ad >= 3.4 && < 4.3, linear >= 1.16 && < 2.0,- semigroupoids >= 3.0 && < 5.0,+ semigroupoids >= 3.0 && < 6.0, distributive >= 0.3 && < 0.5 exposed-modules:@@ -69,17 +67,3 @@ Optimization.Constrained.Penalty Optimization.Constrained.ProjectedSubgradient --test-suite doctests- type: exitcode-stdio-1.0- main-is: doctests.hs- default-language: Haskell2010- build-depends:- base,- directory >= 1.0,- doctest >= 0.9.1,- filepath- ghc-options: -Wall -threaded- if impl(ghc<7.6.1)- ghc-options: -Werror- hs-source-dirs: tests
src/Optimization/LineSearch/ConjugateGradient.hs view
@@ -25,6 +25,7 @@ -- a wide range of eigenvalues). It does this by choosing directions which -- satisfy a condition of @A@ orthogonality, ensuring that steps in the -- "unstretched" search space are orthogonal.+ -- TODO: clarify explanation conjGrad :: (Num a, RealFloat a, Additive f, Metric f) => LineSearch f a -- ^ line search method
− tests/doctests.hsc
@@ -1,73 +0,0 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE ForeignFunctionInterface #-}--------------------------------------------------------------------------------- |--- Module : Main (doctests)--- Copyright : (C) 2012-13 Edward Kmett--- License : BSD-style (see the file LICENSE)--- Maintainer : Edward Kmett <ekmett@gmail.com>--- Stability : provisional--- Portability : portable------ This module provides doctests for a project based on the actual versions--- of the packages it was built with. It requires a corresponding Setup.lhs--- to be added to the project-------------------------------------------------------------------------------module Main where--import Build_doctests (deps)-import Control.Applicative-import Control.Monad-import Data.List-import System.Directory-import System.FilePath-import Test.DocTest--##ifdef mingw32_HOST_ARCH-##ifdef i386_HOST_ARCH-##define USE_CP-import Control.Applicative-import Control.Exception-import Foreign.C.Types-foreign import stdcall "windows.h SetConsoleCP" c_SetConsoleCP :: CUInt -> IO Bool-foreign import stdcall "windows.h GetConsoleCP" c_GetConsoleCP :: IO CUInt-##elif defined(x86_64_HOST_ARCH)-##define USE_CP-import Control.Applicative-import Control.Exception-import Foreign.C.Types-foreign import ccall "windows.h SetConsoleCP" c_SetConsoleCP :: CUInt -> IO Bool-foreign import ccall "windows.h GetConsoleCP" c_GetConsoleCP :: IO CUInt-##endif-##endif---- | Run in a modified codepage where we can print UTF-8 values on Windows.-withUnicode :: IO a -> IO a-##ifdef USE_CP-withUnicode m = do- cp <- c_GetConsoleCP- (c_SetConsoleCP 65001 >> m) `finally` c_SetConsoleCP cp-##else-withUnicode m = m-##endif--main :: IO ()-main = withUnicode $ getSources >>= \sources -> doctest $- "-isrc"- : "-idist/build/autogen"- : "-optP-include"- : "-optPdist/build/autogen/cabal_macros.h"- : "-hide-all-packages"- : map ("-package="++) deps ++ sources--getSources :: IO [FilePath]-getSources = filter (isSuffixOf ".hs") <$> go "src"- where- go dir = do- (dirs, files) <- getFilesAndDirectories dir- (files ++) . concat <$> mapM go dirs--getFilesAndDirectories :: FilePath -> IO ([FilePath], [FilePath])-getFilesAndDirectories dir = do- c <- map (dir </>) . filter (`notElem` ["..", "."]) <$> getDirectoryContents dir- (,) <$> filterM doesDirectoryExist c <*> filterM doesFileExist c