Commits

Gabriel Pichot committed 3b5bfe5

Meilleur gestion du log dans arithmatik.ml

Comments (0)

Files changed (3)

   log "\n---- Recherche de l'ordre de %i dans %i ----\n" p n; 
   let l = getQ n in
   let q = pow 2 l in
-(*  log "On trouve q = %i = 2 ^ %i.\n" q l; *)
+  debug "On trouve q = %i = 2 ^ %i.\n" q l;
   let reg1 = new register l
   and reg2 = new register (nb_bits n) in
-(*  log "Création de deux registres de tailles respectives %i et %i.\n" 
-    (reg1#size()) (reg2#size());*)
+  debug "Création de deux registres de tailles respectives %i et %i.\n" 
+    (reg1#size()) (reg2#size());
   (* On met le premier registre dans un état de superposition uniforme *)
   reg1#setUniformSuperposition q;
   (* On calcule x ^ a mod n pour tous les a, on doit cependant
   (* Et on oublie pas de normaliser *)
   reg1#normalize ();
   (* Maintenant on applique la transformée de Fourier *)
-(*  log "Transformée de Fourier.\n"; *)
+  debug "Transformée de Fourier.\n"; 
   reg1#fft (); (* ou reg1#dft q() mais moins performant :) *)
-(*  log "Fin de la transformée de Fourier.\n";*)
+  debug "Fin de la transformée de Fourier.\n";
   reg1#normalize ();
   (* Si on doit afficher le résultat de la transformée de Fourier *)
   if texPrint then printAsTex reg1 p n;
   (* On mesure c sur le premier registre *)
   let c = reg1#measureState () in
- (* log "On trouve pour c : %i.\n" c;*)
+  debug "On trouve pour c : %i.\n" c;
   (* On approche le réel grâce aux fractions continues *)
   let s =  (float_of_int c) /. (float_of_int q) in
   let (d,r) = approx s (float_of_int q) in
-(*  log "---- Un ordre possible est donc %i. ----\n" r;*)
+  debug "---- Un ordre possible est donc %i. ----\n" r;
   r
   
 
 (* Log the debug fmt if necessary *)
 let debug fmt = if !mod_debug then fprintf logfile fmt else ifprintf logfile fmt
 (* Show in the console (do not forget to use the ! to flush the data) *)
-let print = printf "%s%!" 
+let print = printf "%s%!"
 (* Initialisation (debug, args, random...) {{{1 *)
 print "Simulation de l'algorithme de Shor\n";
 Random.self_init ();
-set_debug true;
+set_debug false;
 if !mod_debug then print "Mode DEBUG : on.\n";
 
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.