Skip to content

Commit

Permalink
Removal of all comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MarwanG committed Jul 2, 2013
1 parent a0fcc73 commit b6c27c4
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 95 deletions.
4 changes: 0 additions & 4 deletions src/CombSys.ml
Expand Up @@ -54,14 +54,10 @@ let evaluation (phi:combsys) (z:float) (y:float array):float array =
let u = Array.create (Array.length y) 0.0 in
for i=0 to ((Array.length y) - 1)
do
(*print_string ("i=" ^ (string_of_int i)) ;*)
let vali = eval_eq z y phi.(i)
in
(* print_endline (" vali=" ^ (string_of_float vali)) ;*)
u.(i) <- vali
done;
(*print_endline ("u = " ^ (Util.string_of_array string_of_float u)) ;*)
(*print_endline (string_of_float u.(0));*)
u ;;

(* conversion from grammar *)
Expand Down
10 changes: 0 additions & 10 deletions src/GParser.ml
Expand Up @@ -115,7 +115,6 @@ let next_word str i =
else aux (i+1) (ch::word)
in
let (word,i') = aux (skip str i) [] in
(* print_endline ("next word = " ^ (string_of_list word)) ; *)
(string_of_list word,i') ;;

let advance str i expect =
Expand All @@ -127,7 +126,6 @@ let advance str i expect =
let parse_component str i =
let rec aux i weight refs =
let (componentName,i') = next_word str i in
(* print_endline ("Component name = " ^ componentName) ; *)
if componentName="<z>" then
let (next,i'') = next_word str i' in
(if next="*" then
Expand All @@ -152,7 +150,6 @@ let parse_component str i =
else raise (Parse_Error "Expecting '+', ';' or '*'")
else (* component Name is ok *)
let (next,i'') = next_word str i' in
(* print_endline ("Next = " ^ next) ; *)
if next="+" or next =";" then
((weight,List.rev ((ELEM componentName)::refs)),i')
else if next="*" then
Expand Down Expand Up @@ -311,10 +308,3 @@ let parse_from_file fname =
if Options.global_options.verbosity >= 3
then printf "[GEN]: Parsed grammar = %s\n%!" (Grammar.string_of_grammar (List.map (fun (n,l) -> (ELEM n,l)) grm)) ;
grm ;;

(*
let gram = parse_from_file "examples/binary.arb"
in
(print_endline "Grammar parsed = ") ;
(print_endline (string_of_grammar gram));;
*)
47 changes: 1 addition & 46 deletions src/Gen.ml
Expand Up @@ -112,7 +112,6 @@ let rec gen_stack_tree
(fun (l,n) elt ->
match elt with
| SEQ(rul) -> let (_,rdm) = StringMap.find rul map in
(* print_endline (string_of_float rdm);*)
let n' = int_of_float (floor((log( Random.float 1.)) /. (log rdm))) in
((List.append (concat_n [rul] n') l),(n'+n-1))
| ELEM(rul) -> if(List.exists (fun x -> x = rul) leafs) then
Expand Down Expand Up @@ -161,51 +160,7 @@ let gen_tree_of_stack
| 0 -> (None,0)
| _ -> gen_tree_of_stack_rec (stack,size) queue with_prefix idprefix;
(Some(Queue.pop queue),size)
(*
let rec gen_tree_rec
(size:int)
(next_rule:string)
wmap gmap sizemax with_prefix idprefix
: (tree option * int) =
if sizemax-size<=0 then
(None,sizemax)
else
(* On génère la suite de l'arbre *)
if StringMap.find next_rule wmap = 1.
(* On doit générer une feuille *)
then
let prefix =
if with_prefix then idprefix ^ (string_of_int (size))
else (string_of_int (size))
in
(Some (Leaf((name_of_elem next_rule),prefix)),size+1)
else
(* On doit générer des sous arbres *)
let prefix =
if with_prefix then idprefix ^ (string_of_int (size+1))
else (string_of_int (size+1))
in
let rdm_float = Random.float (StringMap.find next_rule wmap) in
let (_,_,next_rules_list) =
List.fold_left
(fun (limit,stop,temp) (l,f) -> if limit-.f<=0. && stop then (limit,false,l) else (limit-.f,stop,temp))
(rdm_float,true,[])
(StringMap.find next_rule gmap)
in
let aux opt next =
match opt with
|None -> None
|Some(l,s) ->
match gen_tree_rec s next wmap gmap sizemax with_prefix idprefix with
|(None,_) -> None
|(Some sub_tree,new_size) -> Some(l@[sub_tree],new_size)
in
let suite = List.fold_left aux (Some([],size+1)) next_rules_list in
match suite with
|None -> (None,sizemax)
|Some([Leaf(a,b)],s) -> (Some(Leaf(a,b)),s-1)
|Some(sons,s) -> (Some(Node((name_of_elem next_rule),prefix,sons)),s)
*)

let gen_tree
(g:grammar)
(with_prefix:bool) (idprefix:string)
Expand Down
1 change: 0 additions & 1 deletion src/Grammar.ml
Expand Up @@ -93,4 +93,3 @@ let rec string_of_grammar = function
| [] -> ""
| rul::rules -> (string_of_rule rul) ^ "\n" ^ (string_of_grammar rules) ;;

(* print_endline (string_of_grammar bintree);; *)
5 changes: 0 additions & 5 deletions src/OracleSimple.ml
Expand Up @@ -22,7 +22,6 @@ let iterationSimple (phi:combsys) (z:float) (epsilon:float):float array =
let rec iterate (y:float array): float array =
let y' = evaluation phi z y
in
(* print_endline (string_of_float (normInf_diff y y'));*)
if (Array.fold_left (fun pred x -> pred or (x > 1.)) false y')
then (Array.make (Array.length y') (-1.0))
else
Expand All @@ -37,7 +36,6 @@ let iterationSimple (phi:combsys) (z:float) (epsilon:float):float array =
let diverge (y:float array) (epsilon:float):bool =
let tooBig = 1.0/.epsilon in
let rec dvgi (i:int) (s:int):bool =
(*print_endline ("element = " ^ (string_of_float ele));*)
if i <= s then
(if (y.(i) < 0.0) || (y.(i) > tooBig) then true
else dvgi (i+1) s)
Expand All @@ -47,14 +45,11 @@ let diverge (y:float array) (epsilon:float):bool =

(* output:zmin,zmax,vectorY *)
let rec searchSingularity phi (zmin:float) (zmax:float) (epsilon1:float) (epsilon2:float)(zstart:float):float *float* float array =
(*print_endline ((string_of_float zmin)^" "^(string_of_float zmax));*)
if zmax -. zmin < epsilon1 then
(zmin,zmax,iterationSimple phi zmin epsilon2)
else
let z = zstart in
(*print_float z;*)
let y = iterationSimple phi z epsilon2 in
(*print_endline ("singularite= " ^ (string_of_float zmin) ^ "moyenne= " ^ (string_of_float z));*)
if diverge y epsilon2 = true then
searchSingularity phi zmin zstart epsilon1 epsilon2 ((zmin+.zstart)/.2.)
else
Expand Down
29 changes: 0 additions & 29 deletions src/Util.ml
Expand Up @@ -177,35 +177,6 @@ let ifAtLeast8Smallerin10OthersBigger (p1:int) (p2:int) (tab:int array) : bool
false


(*
let bernoulli (z:float) : bool =
let rd = Random.float 1.0 in
let afrd = string_of_float rd in
if rd < z then
true
else
false
let r = bernoulli 0.5;;
let af = string_of_bool r ;;
print_endline af ;;
"false"
let r2 = bernoulli 0.5;;
let af2 = string_of_bool r2 ;;
print_endline af2 ;;
"true" *)

(*let gra_first ((st,ru):string*rule): string = st; *)






Expand Down

0 comments on commit b6c27c4

Please sign in to comment.