From ff044e9672f515cd65730f7a415e9af0e4424363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= Date: Thu, 11 Jul 2013 13:41:00 +0800 Subject: [PATCH] Restructure src directory --- apps/ExperimentMain.hs | 16 ++++++------- apps/Recognize.hs | 6 ++--- hopfield.cabal | 24 +++++++++---------- src/Hopfield/Benchmark.hs | 2 +- .../ClassificationBoltzmannMachine.hs | 2 +- .../RestrictedBoltzmannMachine.hs | 2 +- .../{ => Experiments}/ClusterExperiments.hs | 2 +- src/Hopfield/{ => Experiments}/Experiment.hs | 4 ++-- .../Experiment2SuperAttractors.hs | 4 ++-- .../{ => Experiments}/ExperimentUtil.hs | 2 +- .../{ => Experiments}/SmallExperiments.hs | 2 +- src/Hopfield/{ => Images}/ConvertImage.hsc | 4 ++-- src/Hopfield/{ => Images}/Testload.hs | 0 src/Hopfield/{ => Images}/convertImage.c | 0 src/Hopfield/{ => Images}/convertImage.h | 0 src/Hopfield/{ => Images}/testConvertImage.c | 0 src/Hopfield/TestUtil.hs | 2 +- 17 files changed, 36 insertions(+), 36 deletions(-) rename src/Hopfield/{ => Boltzmann}/ClassificationBoltzmannMachine.hs (99%) rename src/Hopfield/{ => Boltzmann}/RestrictedBoltzmannMachine.hs (99%) rename src/Hopfield/{ => Experiments}/ClusterExperiments.hs (98%) rename src/Hopfield/{ => Experiments}/Experiment.hs (96%) rename src/Hopfield/{ => Experiments}/Experiment2SuperAttractors.hs (96%) rename src/Hopfield/{ => Experiments}/ExperimentUtil.hs (97%) rename src/Hopfield/{ => Experiments}/SmallExperiments.hs (94%) rename src/Hopfield/{ => Images}/ConvertImage.hsc (94%) rename src/Hopfield/{ => Images}/Testload.hs (100%) rename src/Hopfield/{ => Images}/convertImage.c (100%) rename src/Hopfield/{ => Images}/convertImage.h (100%) rename src/Hopfield/{ => Images}/testConvertImage.c (100%) diff --git a/apps/ExperimentMain.hs b/apps/ExperimentMain.hs index d443cff..ff0c028 100644 --- a/apps/ExperimentMain.hs +++ b/apps/ExperimentMain.hs @@ -3,10 +3,10 @@ module Main where import Options.Applicative -import qualified Hopfield.Experiment -import qualified Hopfield.SmallExperiments -import qualified Hopfield.ClusterExperiments -import qualified Hopfield.Experiment2SuperAttractors +import qualified Hopfield.Experiments.Experiment +import qualified Hopfield.Experiments.SmallExperiments +import qualified Hopfield.Experiments.ClusterExperiments +import qualified Hopfield.Experiments.Experiment2SuperAttractors data ExperimentArgs = ExperimentArgs { experimentName :: String @@ -27,8 +27,8 @@ main = do ExperimentArgs expName args <- execParser argParser case expName of - "experiment" -> Hopfield.Experiment.main - "small" -> Hopfield.SmallExperiments.main - "cluster" -> Hopfield.ClusterExperiments.run args - "super" -> Hopfield.Experiment2SuperAttractors.main + "experiment" -> Hopfield.Experiments.Experiment.main + "small" -> Hopfield.Experiments.SmallExperiments.main + "cluster" -> Hopfield.Experiments.ClusterExperiments.run args + "super" -> Hopfield.Experiments.Experiment2SuperAttractors.main _ -> error "unknown experiment" diff --git a/apps/Recognize.hs b/apps/Recognize.hs index 7852fde..5cc62d1 100644 --- a/apps/Recognize.hs +++ b/apps/Recognize.hs @@ -12,9 +12,9 @@ import System.Directory import Hopfield.Common import Hopfield.Hopfield -import Hopfield.ConvertImage -import Hopfield.RestrictedBoltzmannMachine -import Hopfield.ClassificationBoltzmannMachine +import Hopfield.Images.ConvertImage +import Hopfield.Boltzmann.RestrictedBoltzmannMachine +import Hopfield.Boltzmann.ClassificationBoltzmannMachine import Hopfield.Benchmark import Hopfield.Util diff --git a/hopfield.cabal b/hopfield.cabal index f4fa6a1..597d12b 100644 --- a/hopfield.cabal +++ b/hopfield.cabal @@ -15,21 +15,21 @@ library exposed-modules: Hopfield.Hopfield , Hopfield.Analysis - , Hopfield.Measurement - , Hopfield.ClassificationBoltzmannMachine + , Hopfield.Benchmark + , Hopfield.Boltzmann.ClassificationBoltzmannMachine + , Hopfield.Boltzmann.RestrictedBoltzmannMachine , Hopfield.Clusters , Hopfield.Common - , Hopfield.ConvertImage - , Hopfield.RestrictedBoltzmannMachine + , Hopfield.Experiments.ClusterExperiments + , Hopfield.Experiments.Experiment + , Hopfield.Experiments.Experiment2SuperAttractors + , Hopfield.Experiments.ExperimentUtil + , Hopfield.Experiments.SmallExperiments + , Hopfield.Images.ConvertImage + , Hopfield.Measurement , Hopfield.SuperAttractors - , Hopfield.Util - , Hopfield.Experiment , Hopfield.TestUtil - , Hopfield.ExperimentUtil - , Hopfield.Benchmark - , Hopfield.SmallExperiments - , Hopfield.ClusterExperiments - , Hopfield.Experiment2SuperAttractors + , Hopfield.Util other-modules: hs-source-dirs: src @@ -52,7 +52,7 @@ library , monad-loops >= 0.3.3.0 , split >= 0.2.1.1 c-sources: - src/Hopfield/convertImage.c + src/Hopfield/Images/convertImage.c include-dirs: src/Hopfield , /usr/include/ImageMagick diff --git a/src/Hopfield/Benchmark.hs b/src/Hopfield/Benchmark.hs index e8d57f9..5a860a8 100644 --- a/src/Hopfield/Benchmark.hs +++ b/src/Hopfield/Benchmark.hs @@ -3,7 +3,7 @@ module Hopfield.Benchmark where import Hopfield.Hopfield import Hopfield.Clusters -import Hopfield.ClusterExperiments +import Hopfield.Experiments.ClusterExperiments bench1 :: IO () bench1 = print =<< experimentUsingT1NoAvg Hebbian 10 10 diff --git a/src/Hopfield/ClassificationBoltzmannMachine.hs b/src/Hopfield/Boltzmann/ClassificationBoltzmannMachine.hs similarity index 99% rename from src/Hopfield/ClassificationBoltzmannMachine.hs rename to src/Hopfield/Boltzmann/ClassificationBoltzmannMachine.hs index c368051..136d7be 100644 --- a/src/Hopfield/ClassificationBoltzmannMachine.hs +++ b/src/Hopfield/Boltzmann/ClassificationBoltzmannMachine.hs @@ -1,6 +1,6 @@ {-# LANGUAGE PatternGuards, ScopedTypeVariables #-} -module Hopfield.ClassificationBoltzmannMachine where +module Hopfield.Boltzmann.ClassificationBoltzmannMachine where -- | Base Restricted Boltzmann machine. -- http://en.wikipedia.org/wiki/Restricted_Boltzmann_machine diff --git a/src/Hopfield/RestrictedBoltzmannMachine.hs b/src/Hopfield/Boltzmann/RestrictedBoltzmannMachine.hs similarity index 99% rename from src/Hopfield/RestrictedBoltzmannMachine.hs rename to src/Hopfield/Boltzmann/RestrictedBoltzmannMachine.hs index 7678101..0887207 100644 --- a/src/Hopfield/RestrictedBoltzmannMachine.hs +++ b/src/Hopfield/Boltzmann/RestrictedBoltzmannMachine.hs @@ -2,7 +2,7 @@ -- | Base Restricted Boltzmann machine. -- http://en.wikipedia.org/wiki/Restricted_Boltzmann_machine -module Hopfield.RestrictedBoltzmannMachine where +module Hopfield.Boltzmann.RestrictedBoltzmannMachine where import Data.Maybe diff --git a/src/Hopfield/ClusterExperiments.hs b/src/Hopfield/Experiments/ClusterExperiments.hs similarity index 98% rename from src/Hopfield/ClusterExperiments.hs rename to src/Hopfield/Experiments/ClusterExperiments.hs index 07d51bf..2b952ff 100644 --- a/src/Hopfield/ClusterExperiments.hs +++ b/src/Hopfield/Experiments/ClusterExperiments.hs @@ -1,6 +1,6 @@ {-# LANGUAGE ParallelListComp #-} -module Hopfield.ClusterExperiments where +module Hopfield.Experiments.ClusterExperiments where -- Cluster Experiments which were performed by Federico import Control.Monad diff --git a/src/Hopfield/Experiment.hs b/src/Hopfield/Experiments/Experiment.hs similarity index 96% rename from src/Hopfield/Experiment.hs rename to src/Hopfield/Experiments/Experiment.hs index b9751ae..069b87c 100644 --- a/src/Hopfield/Experiment.hs +++ b/src/Hopfield/Experiments/Experiment.hs @@ -1,6 +1,6 @@ {-# LANGUAGE ParallelListComp #-} -module Hopfield.Experiment where +module Hopfield.Experiments.Experiment where import Control.Monad (replicateM) import Control.Monad.Random @@ -9,7 +9,7 @@ import Test.QuickCheck.Gen (unGen) import Hopfield.Clusters import Hopfield.Common -import Hopfield.ExperimentUtil +import Hopfield.Experiments.ExperimentUtil import Hopfield.Hopfield import Hopfield.Measurement import Hopfield.SuperAttractors diff --git a/src/Hopfield/Experiment2SuperAttractors.hs b/src/Hopfield/Experiments/Experiment2SuperAttractors.hs similarity index 96% rename from src/Hopfield/Experiment2SuperAttractors.hs rename to src/Hopfield/Experiments/Experiment2SuperAttractors.hs index 8126ee4..f6e1f34 100644 --- a/src/Hopfield/Experiment2SuperAttractors.hs +++ b/src/Hopfield/Experiments/Experiment2SuperAttractors.hs @@ -1,7 +1,7 @@ {-# LANGUAGE ParallelListComp #-} -- | Performs experiments with two super attractors. -module Hopfield.Experiment2SuperAttractors where +module Hopfield.Experiments.Experiment2SuperAttractors where import Control.Monad (replicateM) import Control.Monad.Random @@ -9,7 +9,7 @@ import Test.QuickCheck import Test.QuickCheck.Gen (unGen) import Hopfield.Common -import Hopfield.ExperimentUtil +import Hopfield.Experiments.ExperimentUtil import Hopfield.Hopfield (LearningType (..)) import Hopfield.Measurement import Hopfield.SuperAttractors diff --git a/src/Hopfield/ExperimentUtil.hs b/src/Hopfield/Experiments/ExperimentUtil.hs similarity index 97% rename from src/Hopfield/ExperimentUtil.hs rename to src/Hopfield/Experiments/ExperimentUtil.hs index bb93b9d..cff1c4e 100644 --- a/src/Hopfield/ExperimentUtil.hs +++ b/src/Hopfield/Experiments/ExperimentUtil.hs @@ -1,6 +1,6 @@ {-# LANGUAGE ParallelListComp #-} -module Hopfield.ExperimentUtil where +module Hopfield.Experiments.ExperimentUtil where import qualified Data.Vector as V diff --git a/src/Hopfield/SmallExperiments.hs b/src/Hopfield/Experiments/SmallExperiments.hs similarity index 94% rename from src/Hopfield/SmallExperiments.hs rename to src/Hopfield/Experiments/SmallExperiments.hs index ad9cfd7..6483dee 100644 --- a/src/Hopfield/SmallExperiments.hs +++ b/src/Hopfield/Experiments/SmallExperiments.hs @@ -1,6 +1,6 @@ {-# LANGUAGE ParallelListComp #-} -module Hopfield.SmallExperiments where +module Hopfield.Experiments.SmallExperiments where -- Module use to perform small experiments that prove that Storkey learning -- has a bigger basin size than Hebbian learning diff --git a/src/Hopfield/ConvertImage.hsc b/src/Hopfield/Images/ConvertImage.hsc similarity index 94% rename from src/Hopfield/ConvertImage.hsc rename to src/Hopfield/Images/ConvertImage.hsc index 57b6de6..39cce41 100644 --- a/src/Hopfield/ConvertImage.hsc +++ b/src/Hopfield/Images/ConvertImage.hsc @@ -1,6 +1,6 @@ {-# LANGUAGE CPP, ForeignFunctionInterface #-} -module Hopfield.ConvertImage ( +module Hopfield.Images.ConvertImage ( loadPicture , CBinaryPattern (..) ) where @@ -11,7 +11,7 @@ import Foreign.Ptr import Foreign.Storable import Foreign.Marshal.Array -#include "convertImage.h" +#include "Images/convertImage.h" -- From: http://www.haskell.org/haskellwiki/FFI_cook_book #let alignment t = "%lu", (unsigned long) offsetof(struct { char x__; t (y__); }, y__) diff --git a/src/Hopfield/Testload.hs b/src/Hopfield/Images/Testload.hs similarity index 100% rename from src/Hopfield/Testload.hs rename to src/Hopfield/Images/Testload.hs diff --git a/src/Hopfield/convertImage.c b/src/Hopfield/Images/convertImage.c similarity index 100% rename from src/Hopfield/convertImage.c rename to src/Hopfield/Images/convertImage.c diff --git a/src/Hopfield/convertImage.h b/src/Hopfield/Images/convertImage.h similarity index 100% rename from src/Hopfield/convertImage.h rename to src/Hopfield/Images/convertImage.h diff --git a/src/Hopfield/testConvertImage.c b/src/Hopfield/Images/testConvertImage.c similarity index 100% rename from src/Hopfield/testConvertImage.c rename to src/Hopfield/Images/testConvertImage.c diff --git a/src/Hopfield/TestUtil.hs b/src/Hopfield/TestUtil.hs index fdb5e6c..d0a454c 100644 --- a/src/Hopfield/TestUtil.hs +++ b/src/Hopfield/TestUtil.hs @@ -16,7 +16,7 @@ import Test.QuickCheck import Hopfield.Hopfield import Hopfield.Measurement -import Hopfield.RestrictedBoltzmannMachine +import Hopfield.Boltzmann.RestrictedBoltzmannMachine import Hopfield.Util