From 493a35bfea6d1210c94ced8fbfe3e572f0389ea5 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Mon, 28 Nov 2016 18:04:45 +0100
Subject: [PATCH] prepare structure for R package

---
 DESCRIPTION                                   | 13 +++++
 .../InputParameters}/basicInitParameters.m    |  0
 .../InputParameters}/compileMex.m             |  0
 .../InputParameters}/generateIO.m             |  0
 .../InputParameters}/generateIOdefault.m      |  0
 .../InputParameters}/grillelambda.m           |  0
 .../InputParameters}/initSmallEM.m            |  0
 .../InputParameters}/selectiontotale.m        |  0
 .../ProcLassoMLE}/EMGLLF.m                    |  0
 .../ProcLassoMLE}/compileMex.m                |  0
 .../constructionModelesLassoMLE.m             |  0
 .../ProcLassoRank}/EMGrank.m                  |  0
 .../ProcLassoRank}/compileMex.m               |  0
 .../constructionModelesLassoRank.m            |  0
 .../SelectModel}/selectionModelesLassoMLE.m   |  0
 .../SelectModel}/selectionModelesLassoRank.m  |  0
 .../SelectModel}/selectiondindice.m           |  0
 .../SelectModel}/selectionmodele.m            |  0
 .../SelectModel}/suppressionmodelesegaux.m    |  0
 .../SelectModel}/suppressionmodelesegaux2.m   |  0
 {InputParameters => R}/basicInitParameters.R  |  0
 {InputParameters => R}/generateIO.R           |  0
 {InputParameters => R}/generateIOdefault.R    |  0
 {InputParameters => R}/gridLambda.R           |  0
 {InputParameters => R}/initSmallEM.R          |  0
 selmix.m => R/main.R                          |  2 +
 {SelectModel => R}/selectionindice.R          |  0
 {SelectModel => R}/selectionmodele.R          |  0
 {SelectModel => R}/suppressionmodelesegaux.R  |  0
 {SelectModel => R}/suppressionmodelesegaux2.R |  0
 README.md                                     | 52 ++-----------------
 data/TODO                                     |  0
 man/TODO                                      |  0
 src/Makevars                                  |  7 +++
 .../adapters}/EMGLLF_interface.c              |  0
 .../adapters}/EMGrank_interface.c             |  0
 .../constructionModelesLassoMLE_interface.c   |  0
 .../constructionModelesLassoRank_interface.c  |  0
 .../adapters}/selectiontotale_interface.c     |  0
 {ProcLassoMLE => src/sources}/EMGLLF.c        |  0
 {ProcLassoMLE => src/sources}/EMGLLF.h        |  0
 {ProcLassoRank => src/sources}/EMGrank.c      |  0
 {ProcLassoRank => src/sources}/EMGrank.h      |  0
 .../sources}/constructionModelesLassoMLE.c    |  0
 .../sources}/constructionModelesLassoMLE.h    |  0
 .../sources}/constructionModelesLassoRank.c   |  0
 .../sources}/constructionModelesLassoRank.h   |  0
 .../sources}/selectiontotale.c                |  0
 .../sources}/selectiontotale.h                |  0
 {Util => src/sources/utils}/ioutils.c         |  0
 {Util => src/sources/utils}/ioutils.h         |  0
 {Util => src/sources/utils}/omp_num_threads.h |  0
 52 files changed, 25 insertions(+), 49 deletions(-)
 create mode 100644 DESCRIPTION
 rename {InputParameters => OLD_MATLAB/InputParameters}/basicInitParameters.m (100%)
 rename {InputParameters => OLD_MATLAB/InputParameters}/compileMex.m (100%)
 rename {InputParameters => OLD_MATLAB/InputParameters}/generateIO.m (100%)
 rename {InputParameters => OLD_MATLAB/InputParameters}/generateIOdefault.m (100%)
 rename {InputParameters => OLD_MATLAB/InputParameters}/grillelambda.m (100%)
 rename {InputParameters => OLD_MATLAB/InputParameters}/initSmallEM.m (100%)
 rename {InputParameters => OLD_MATLAB/InputParameters}/selectiontotale.m (100%)
 rename {ProcLassoMLE => OLD_MATLAB/ProcLassoMLE}/EMGLLF.m (100%)
 rename {ProcLassoMLE => OLD_MATLAB/ProcLassoMLE}/compileMex.m (100%)
 rename {ProcLassoMLE => OLD_MATLAB/ProcLassoMLE}/constructionModelesLassoMLE.m (100%)
 rename {ProcLassoRank => OLD_MATLAB/ProcLassoRank}/EMGrank.m (100%)
 rename {ProcLassoRank => OLD_MATLAB/ProcLassoRank}/compileMex.m (100%)
 rename {ProcLassoRank => OLD_MATLAB/ProcLassoRank}/constructionModelesLassoRank.m (100%)
 rename {SelectModel => OLD_MATLAB/SelectModel}/selectionModelesLassoMLE.m (100%)
 rename {SelectModel => OLD_MATLAB/SelectModel}/selectionModelesLassoRank.m (100%)
 rename {SelectModel => OLD_MATLAB/SelectModel}/selectiondindice.m (100%)
 rename {SelectModel => OLD_MATLAB/SelectModel}/selectionmodele.m (100%)
 rename {SelectModel => OLD_MATLAB/SelectModel}/suppressionmodelesegaux.m (100%)
 rename {SelectModel => OLD_MATLAB/SelectModel}/suppressionmodelesegaux2.m (100%)
 rename {InputParameters => R}/basicInitParameters.R (100%)
 rename {InputParameters => R}/generateIO.R (100%)
 rename {InputParameters => R}/generateIOdefault.R (100%)
 rename {InputParameters => R}/gridLambda.R (100%)
 rename {InputParameters => R}/initSmallEM.R (100%)
 rename selmix.m => R/main.R (99%)
 rename {SelectModel => R}/selectionindice.R (100%)
 rename {SelectModel => R}/selectionmodele.R (100%)
 rename {SelectModel => R}/suppressionmodelesegaux.R (100%)
 rename {SelectModel => R}/suppressionmodelesegaux2.R (100%)
 create mode 100644 data/TODO
 create mode 100644 man/TODO
 create mode 100644 src/Makevars
 rename {ProcLassoMLE => src/adapters}/EMGLLF_interface.c (100%)
 rename {ProcLassoRank => src/adapters}/EMGrank_interface.c (100%)
 rename {ProcLassoMLE => src/adapters}/constructionModelesLassoMLE_interface.c (100%)
 rename {ProcLassoRank => src/adapters}/constructionModelesLassoRank_interface.c (100%)
 rename {InputParameters => src/adapters}/selectiontotale_interface.c (100%)
 rename {ProcLassoMLE => src/sources}/EMGLLF.c (100%)
 rename {ProcLassoMLE => src/sources}/EMGLLF.h (100%)
 rename {ProcLassoRank => src/sources}/EMGrank.c (100%)
 rename {ProcLassoRank => src/sources}/EMGrank.h (100%)
 rename {ProcLassoMLE => src/sources}/constructionModelesLassoMLE.c (100%)
 rename {ProcLassoMLE => src/sources}/constructionModelesLassoMLE.h (100%)
 rename {ProcLassoRank => src/sources}/constructionModelesLassoRank.c (100%)
 rename {ProcLassoRank => src/sources}/constructionModelesLassoRank.h (100%)
 rename {InputParameters => src/sources}/selectiontotale.c (100%)
 rename {InputParameters => src/sources}/selectiontotale.h (100%)
 rename {Util => src/sources/utils}/ioutils.c (100%)
 rename {Util => src/sources/utils}/ioutils.h (100%)
 rename {Util => src/sources/utils}/omp_num_threads.h (100%)

diff --git a/DESCRIPTION b/DESCRIPTION
new file mode 100644
index 0000000..8902f1a
--- /dev/null
+++ b/DESCRIPTION
@@ -0,0 +1,13 @@
+Package: valse
+Title: Variable selection with mixture of models
+Date: 2016-12-01
+Version: 0.1-0
+Description: TODO
+Authors@R: c( person("Benjamin Auder", "Developer", role=c("ctb","cre"), email="Benjamin.Auder@math.u-psud.fr"),
+	person("Benjamin Goehry", "User", role="aut", email = "Benjamin.Goehry@math.u-psud.fr"),
+	person("Emilie Devijver", "User", role="ctb", email = "Emilie.Devijver@kuleuven.be"))
+Depends:
+    R (>= 2.15)
+LazyData: yes
+URL: http://git.auder.net/?p=valse.git
+License: MIT
diff --git a/InputParameters/basicInitParameters.m b/OLD_MATLAB/InputParameters/basicInitParameters.m
similarity index 100%
rename from InputParameters/basicInitParameters.m
rename to OLD_MATLAB/InputParameters/basicInitParameters.m
diff --git a/InputParameters/compileMex.m b/OLD_MATLAB/InputParameters/compileMex.m
similarity index 100%
rename from InputParameters/compileMex.m
rename to OLD_MATLAB/InputParameters/compileMex.m
diff --git a/InputParameters/generateIO.m b/OLD_MATLAB/InputParameters/generateIO.m
similarity index 100%
rename from InputParameters/generateIO.m
rename to OLD_MATLAB/InputParameters/generateIO.m
diff --git a/InputParameters/generateIOdefault.m b/OLD_MATLAB/InputParameters/generateIOdefault.m
similarity index 100%
rename from InputParameters/generateIOdefault.m
rename to OLD_MATLAB/InputParameters/generateIOdefault.m
diff --git a/InputParameters/grillelambda.m b/OLD_MATLAB/InputParameters/grillelambda.m
similarity index 100%
rename from InputParameters/grillelambda.m
rename to OLD_MATLAB/InputParameters/grillelambda.m
diff --git a/InputParameters/initSmallEM.m b/OLD_MATLAB/InputParameters/initSmallEM.m
similarity index 100%
rename from InputParameters/initSmallEM.m
rename to OLD_MATLAB/InputParameters/initSmallEM.m
diff --git a/InputParameters/selectiontotale.m b/OLD_MATLAB/InputParameters/selectiontotale.m
similarity index 100%
rename from InputParameters/selectiontotale.m
rename to OLD_MATLAB/InputParameters/selectiontotale.m
diff --git a/ProcLassoMLE/EMGLLF.m b/OLD_MATLAB/ProcLassoMLE/EMGLLF.m
similarity index 100%
rename from ProcLassoMLE/EMGLLF.m
rename to OLD_MATLAB/ProcLassoMLE/EMGLLF.m
diff --git a/ProcLassoMLE/compileMex.m b/OLD_MATLAB/ProcLassoMLE/compileMex.m
similarity index 100%
rename from ProcLassoMLE/compileMex.m
rename to OLD_MATLAB/ProcLassoMLE/compileMex.m
diff --git a/ProcLassoMLE/constructionModelesLassoMLE.m b/OLD_MATLAB/ProcLassoMLE/constructionModelesLassoMLE.m
similarity index 100%
rename from ProcLassoMLE/constructionModelesLassoMLE.m
rename to OLD_MATLAB/ProcLassoMLE/constructionModelesLassoMLE.m
diff --git a/ProcLassoRank/EMGrank.m b/OLD_MATLAB/ProcLassoRank/EMGrank.m
similarity index 100%
rename from ProcLassoRank/EMGrank.m
rename to OLD_MATLAB/ProcLassoRank/EMGrank.m
diff --git a/ProcLassoRank/compileMex.m b/OLD_MATLAB/ProcLassoRank/compileMex.m
similarity index 100%
rename from ProcLassoRank/compileMex.m
rename to OLD_MATLAB/ProcLassoRank/compileMex.m
diff --git a/ProcLassoRank/constructionModelesLassoRank.m b/OLD_MATLAB/ProcLassoRank/constructionModelesLassoRank.m
similarity index 100%
rename from ProcLassoRank/constructionModelesLassoRank.m
rename to OLD_MATLAB/ProcLassoRank/constructionModelesLassoRank.m
diff --git a/SelectModel/selectionModelesLassoMLE.m b/OLD_MATLAB/SelectModel/selectionModelesLassoMLE.m
similarity index 100%
rename from SelectModel/selectionModelesLassoMLE.m
rename to OLD_MATLAB/SelectModel/selectionModelesLassoMLE.m
diff --git a/SelectModel/selectionModelesLassoRank.m b/OLD_MATLAB/SelectModel/selectionModelesLassoRank.m
similarity index 100%
rename from SelectModel/selectionModelesLassoRank.m
rename to OLD_MATLAB/SelectModel/selectionModelesLassoRank.m
diff --git a/SelectModel/selectiondindice.m b/OLD_MATLAB/SelectModel/selectiondindice.m
similarity index 100%
rename from SelectModel/selectiondindice.m
rename to OLD_MATLAB/SelectModel/selectiondindice.m
diff --git a/SelectModel/selectionmodele.m b/OLD_MATLAB/SelectModel/selectionmodele.m
similarity index 100%
rename from SelectModel/selectionmodele.m
rename to OLD_MATLAB/SelectModel/selectionmodele.m
diff --git a/SelectModel/suppressionmodelesegaux.m b/OLD_MATLAB/SelectModel/suppressionmodelesegaux.m
similarity index 100%
rename from SelectModel/suppressionmodelesegaux.m
rename to OLD_MATLAB/SelectModel/suppressionmodelesegaux.m
diff --git a/SelectModel/suppressionmodelesegaux2.m b/OLD_MATLAB/SelectModel/suppressionmodelesegaux2.m
similarity index 100%
rename from SelectModel/suppressionmodelesegaux2.m
rename to OLD_MATLAB/SelectModel/suppressionmodelesegaux2.m
diff --git a/InputParameters/basicInitParameters.R b/R/basicInitParameters.R
similarity index 100%
rename from InputParameters/basicInitParameters.R
rename to R/basicInitParameters.R
diff --git a/InputParameters/generateIO.R b/R/generateIO.R
similarity index 100%
rename from InputParameters/generateIO.R
rename to R/generateIO.R
diff --git a/InputParameters/generateIOdefault.R b/R/generateIOdefault.R
similarity index 100%
rename from InputParameters/generateIOdefault.R
rename to R/generateIOdefault.R
diff --git a/InputParameters/gridLambda.R b/R/gridLambda.R
similarity index 100%
rename from InputParameters/gridLambda.R
rename to R/gridLambda.R
diff --git a/InputParameters/initSmallEM.R b/R/initSmallEM.R
similarity index 100%
rename from InputParameters/initSmallEM.R
rename to R/initSmallEM.R
diff --git a/selmix.m b/R/main.R
similarity index 99%
rename from selmix.m
rename to R/main.R
index a4bea19..b5b5144 100644
--- a/selmix.m
+++ b/R/main.R
@@ -1,3 +1,5 @@
+## TODO: turn this code into R
+
 classdef selmix < handle
     
     properties (SetAccess = private)
diff --git a/SelectModel/selectionindice.R b/R/selectionindice.R
similarity index 100%
rename from SelectModel/selectionindice.R
rename to R/selectionindice.R
diff --git a/SelectModel/selectionmodele.R b/R/selectionmodele.R
similarity index 100%
rename from SelectModel/selectionmodele.R
rename to R/selectionmodele.R
diff --git a/SelectModel/suppressionmodelesegaux.R b/R/suppressionmodelesegaux.R
similarity index 100%
rename from SelectModel/suppressionmodelesegaux.R
rename to R/suppressionmodelesegaux.R
diff --git a/SelectModel/suppressionmodelesegaux2.R b/R/suppressionmodelesegaux2.R
similarity index 100%
rename from SelectModel/suppressionmodelesegaux2.R
rename to R/suppressionmodelesegaux2.R
diff --git a/README.md b/README.md
index b48c505..ada56d8 100644
--- a/README.md
+++ b/README.md
@@ -1,53 +1,7 @@
-# model SELECTion
+# VAriable seLection with mixtureS of modEls
 
-This code is the applied part of the PhD thesis of [Emilie Devijver](http://www.math.u-psud.fr/~devijver/).
+This code is the applied part of the PhD thesis of [Benjamin Gohehry](http://www.math.u-psud.fr/~goehry/).
 
 ## Description
 
-The function selmix delivers a multivariate Gaussian mixture in regression model collection. 
-According to the parameter estimation, we can compute classical model selection criterion, as BIC or AIC, or slope heuristic, using the CAPUSHE package. 
-The methodology used is described in 'Model-Based Clustering for High-Dimensional Data. Application to Functional Data.', 
-available at [this location](https://hal.archives-ouvertes.fr/hal-01060063)
-
-## Arguments
-
-Regressors, denoted by X (of size n x p) and responses, denoted by Y (of size n x q) are must-have arguments. 
-
-Optionally, we could add
-
-* gamma: weight power in the Lasso penalty (according to Stadler et al., $\gamma \in \{0,1/2,1\}$;
-* mini: the minimum number of iterations;
-* maxi: the maximum number of iterations;
-* tau: the threshold for stopping EM algorithm;
-* kmin and kmax: the bounds of interesting number of components,
-* rangmin and rangmax: the bounds of interesting rank values.
-
-## Usage
-
-	objet = selmix(X,Y)
-	objet.run(index)
-
-For index=1, it computes the Lasso-MLE procedure.
-For index=2, it computes the Lasso-Rank procedure.
-
-/!\ Be careful to the current path /!\
-
-## Values
-
-* phiInit, rhoInit, piInit, gamInit: the initialization of the matrices phi, rho, pi and gamma,
-* gridLambda: grid of regularization parameters used to select relevant variables (if kmax-kmin=0, it is, if not, it is the last grid of regularization parameters)
-* A1,A2: indices of variables selected or not selected (matrices of size (p+1) x q x size(gridLambda))
-* Phi,Rho,Pi: estimations of each parameter thanks to the procedure LassoMLE if compute index=1, and thanks to the procedure LassoRank if computed index=2.
-
-
-## Example
-
-	n=10;
-	p=10;
-	q=5;
-	X=randn(n,p);
-	Y=randn(n,q);
-
-	objet=selmix(X,Y);
-	objet.run(1);
-	objet.run(2);
+TODO : see R package
diff --git a/data/TODO b/data/TODO
new file mode 100644
index 0000000..e69de29
diff --git a/man/TODO b/man/TODO
new file mode 100644
index 0000000..e69de29
diff --git a/src/Makevars b/src/Makevars
new file mode 100644
index 0000000..aa08234
--- /dev/null
+++ b/src/Makevars
@@ -0,0 +1,7 @@
+PKG_CFLAGS=-g -I.
+
+PKG_LIBS=-lm
+
+SOURCES = $(wildcard adapters/*.c sources/*.c sources/utils/*.c)
+
+OBJECTS = $(SOURCES:.c=.o)
diff --git a/ProcLassoMLE/EMGLLF_interface.c b/src/adapters/EMGLLF_interface.c
similarity index 100%
rename from ProcLassoMLE/EMGLLF_interface.c
rename to src/adapters/EMGLLF_interface.c
diff --git a/ProcLassoRank/EMGrank_interface.c b/src/adapters/EMGrank_interface.c
similarity index 100%
rename from ProcLassoRank/EMGrank_interface.c
rename to src/adapters/EMGrank_interface.c
diff --git a/ProcLassoMLE/constructionModelesLassoMLE_interface.c b/src/adapters/constructionModelesLassoMLE_interface.c
similarity index 100%
rename from ProcLassoMLE/constructionModelesLassoMLE_interface.c
rename to src/adapters/constructionModelesLassoMLE_interface.c
diff --git a/ProcLassoRank/constructionModelesLassoRank_interface.c b/src/adapters/constructionModelesLassoRank_interface.c
similarity index 100%
rename from ProcLassoRank/constructionModelesLassoRank_interface.c
rename to src/adapters/constructionModelesLassoRank_interface.c
diff --git a/InputParameters/selectiontotale_interface.c b/src/adapters/selectiontotale_interface.c
similarity index 100%
rename from InputParameters/selectiontotale_interface.c
rename to src/adapters/selectiontotale_interface.c
diff --git a/ProcLassoMLE/EMGLLF.c b/src/sources/EMGLLF.c
similarity index 100%
rename from ProcLassoMLE/EMGLLF.c
rename to src/sources/EMGLLF.c
diff --git a/ProcLassoMLE/EMGLLF.h b/src/sources/EMGLLF.h
similarity index 100%
rename from ProcLassoMLE/EMGLLF.h
rename to src/sources/EMGLLF.h
diff --git a/ProcLassoRank/EMGrank.c b/src/sources/EMGrank.c
similarity index 100%
rename from ProcLassoRank/EMGrank.c
rename to src/sources/EMGrank.c
diff --git a/ProcLassoRank/EMGrank.h b/src/sources/EMGrank.h
similarity index 100%
rename from ProcLassoRank/EMGrank.h
rename to src/sources/EMGrank.h
diff --git a/ProcLassoMLE/constructionModelesLassoMLE.c b/src/sources/constructionModelesLassoMLE.c
similarity index 100%
rename from ProcLassoMLE/constructionModelesLassoMLE.c
rename to src/sources/constructionModelesLassoMLE.c
diff --git a/ProcLassoMLE/constructionModelesLassoMLE.h b/src/sources/constructionModelesLassoMLE.h
similarity index 100%
rename from ProcLassoMLE/constructionModelesLassoMLE.h
rename to src/sources/constructionModelesLassoMLE.h
diff --git a/ProcLassoRank/constructionModelesLassoRank.c b/src/sources/constructionModelesLassoRank.c
similarity index 100%
rename from ProcLassoRank/constructionModelesLassoRank.c
rename to src/sources/constructionModelesLassoRank.c
diff --git a/ProcLassoRank/constructionModelesLassoRank.h b/src/sources/constructionModelesLassoRank.h
similarity index 100%
rename from ProcLassoRank/constructionModelesLassoRank.h
rename to src/sources/constructionModelesLassoRank.h
diff --git a/InputParameters/selectiontotale.c b/src/sources/selectiontotale.c
similarity index 100%
rename from InputParameters/selectiontotale.c
rename to src/sources/selectiontotale.c
diff --git a/InputParameters/selectiontotale.h b/src/sources/selectiontotale.h
similarity index 100%
rename from InputParameters/selectiontotale.h
rename to src/sources/selectiontotale.h
diff --git a/Util/ioutils.c b/src/sources/utils/ioutils.c
similarity index 100%
rename from Util/ioutils.c
rename to src/sources/utils/ioutils.c
diff --git a/Util/ioutils.h b/src/sources/utils/ioutils.h
similarity index 100%
rename from Util/ioutils.h
rename to src/sources/utils/ioutils.h
diff --git a/Util/omp_num_threads.h b/src/sources/utils/omp_num_threads.h
similarity index 100%
rename from Util/omp_num_threads.h
rename to src/sources/utils/omp_num_threads.h
-- 
2.44.0