From 5edda192f1a634ba284acdea7b6302f60df7b000 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Sat, 14 Jan 2017 19:02:56 +0100
Subject: [PATCH] complete wrapper.R; update TODO

---
 TODO                        | 17 ++++++++++++++---
 old_C_code/stage1/wrapper.R | 13 ++++++++++++-
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/TODO b/TODO
index 662635d..6937975 100644
--- a/TODO
+++ b/TODO
@@ -15,9 +15,20 @@ geometric structure of high dim data and dim reduction 2011
 https://docs.docker.com/engine/getstarted/step_one/
 
 A faire:
- - finir les experiences (sur nb de classes, nb de curves / chunk, nb de procs) 
+ - finir les experiences (sur nb de classes, nb de curves / chunk, nb de procs)
    et sur d'autres architectures
- - interface matrice -> binaire
+	 ==> code OK, source("wrapper.R") puis
+	 serialize("build", "pathTo2010.csv","pathTo2010.bin")
+	 ppam_exe("build",np,"pathTo2010.bin","nbSeriesPerChunk nbClusters 1 2")
+	 C = getMedoids("build", "ppamResult.xml", "ppamFinalSeries.bin")
+	 quelques_series = deserialize("pathTo2010.bin", rangs...)
+	 #plot C ... et quelques_series ...
+	 getDistor("buid", "ppamResult.xml", "pathTo2010.bin")
+
+- interface matrice -> binaire
+	 OK
+
  - courbe synchrone
+	 ??
 
-Piste à explorer pour les comparaisons: H20 
+Piste à explorer pour les comparaisons: H20
diff --git a/old_C_code/stage1/wrapper.R b/old_C_code/stage1/wrapper.R
index 0ce9786..ec859dc 100644
--- a/old_C_code/stage1/wrapper.R
+++ b/old_C_code/stage1/wrapper.R
@@ -34,9 +34,20 @@ getMedoids = function(path=".", xmlResult = "ppamResult.xml",
 	return ( curves[ranks,] ) # == medoids
 }
 
-#TODO: check C function( is it correct?!)
 getDistor = function(path=".", xmlResult = "ppamResult.xml",
 	finalSeries = "ppamFinalSeries.bin")
 {
 	system(paste(path,"/ppam.exe classif ",finalSeries," ",xmlResult,sep=""))
 }
+
+serialize = function(path=".", csvSeries, binSeries, byCols=0, nbSeries=0)
+{
+	system(paste(path,"/ppam.exe serialize ",csvSeries," ",binSeries," ",byCols," ",nbSeries,
+		sep=""))
+}
+
+deserialize = function(path=".", binSeries, csvSeries, ranks="-1")
+{
+	system(paste(path,"/ppam.exe deserialize ",binSeries," ",csvSeries," ",ranks,sep=""))
+	return ( read.table(csvSeries, sep=",") )
+}
-- 
2.44.0