diff --git a/src/google_creux.adb b/src/google_creux.adb index 4697907..a9f4bcd 100644 --- a/src/google_creux.adb +++ b/src/google_creux.adb @@ -1,3 +1,4 @@ +with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; package body Google_Creux is @@ -43,7 +44,7 @@ package body Google_Creux is col_CRS: Natural := 0; col_vec: Natural := 0; begin - initialize(new_vec, sum(vec)*(1.0-alpha)/T_Element(N)); + Vector_Element.initialize(new_vec, Vector_Element.sum(vec)*(1.0-alpha)/T_Element(N)); for i in 0..N-1 loop nb_col := mat.rows(i+1) - mat.rows(i); if nb_col = 0 then diff --git a/src/google_creux.ads b/src/google_creux.ads index 67dc2e4..a341f47 100644 --- a/src/google_creux.ads +++ b/src/google_creux.ads @@ -1,4 +1,3 @@ -with Ada.Text_IO; use Ada.Text_IO; with Vector; generic @@ -18,15 +17,6 @@ generic package Google_Creux is - -- on permet l'affichage direct des T_Element - package Text_T_Element is - new Ada.Text_IO.Float_IO(Num => T_Element); - use Text_T_Element; - - -- on utilise les modules Vector - use Vector_Element; - use Vector_Link; - type T_Rows is array (0..N) of Natural; type T_Cols is array (0..N_links-1) of Natural; type T_Google is record diff --git a/src/google_naive.adb b/src/google_naive.adb index 65f7714..ca19dcb 100644 --- a/src/google_naive.adb +++ b/src/google_naive.adb @@ -1,5 +1,3 @@ -with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; - package body Google_Naive is function "*"(left : Vector_Element.T_Vecteur; right : T_Google) return Vector_Element.T_Vecteur is diff --git a/src/google_naive.ads b/src/google_naive.ads index 110e687..9960e61 100644 --- a/src/google_naive.ads +++ b/src/google_naive.ads @@ -22,10 +22,6 @@ package Google_Naive is package Text_T_Element is new Ada.Text_IO.Float_IO(Num => T_Element); - -- on utilise les modules Vector - use Vector_Element; - use Vector_Link; - type T_Google is array (0..N-1, 0..N-1) of T_Element; function "*"(left: Vector_Element.T_Vecteur; right: T_Google) return Vector_Element.T_Vecteur; diff --git a/src/test_tri.adb b/src/test_tri.adb index 89617f2..d0d9aed 100644 --- a/src/test_tri.adb +++ b/src/test_tri.adb @@ -59,7 +59,7 @@ begin vec_natural(2) := 21; vec_natural(3) := 3; vec_natural(4) := 13; - vec_natural(5) := 2855030208059; + vec_natural(5) := 2855059; vec_natural(6) := 3; vec_natural(7) := 5; vec_natural(8) := 6; diff --git a/src/vector.adb b/src/vector.adb index 3ce7e28..199cc4c 100644 --- a/src/vector.adb +++ b/src/vector.adb @@ -1,8 +1,10 @@ +with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; + package body Vector is package body Entier is - procedure initialize(vec: in out T_Vecteur; value: in Long_Natural) is + procedure initialize(vec: in out T_Vecteur; value: in Natural) is begin for i in 0..Capacite-1 loop vec(i) := value; @@ -12,12 +14,12 @@ package body Vector is procedure identity(vec: in out T_Vecteur) is begin for i in 0..Capacite-1 loop - vec(i) := Long_Natural(i); + vec(i) := i; end loop; end identity; procedure flip(vec: in out T_Vecteur) is - tmp: Long_Natural; + tmp: Natural; begin for i in 0..Capacite/2-1 loop tmp := vec(i); @@ -44,13 +46,13 @@ package body Vector is procedure quicksort(vec: in out T_Vecteur; low: Natural := 0; high: Natural := Capacite-1) is procedure swap(left, right: Natural) is - tmp : constant Long_Natural := vec(left); + tmp : constant Natural := vec(left); begin vec(left) := vec(right); vec(right) := tmp; end swap; - pivot : constant Long_Natural := vec(low); + pivot : constant Natural := vec(low); right : Natural := high; left : Natural := low; @@ -181,7 +183,7 @@ package body Vector is procedure swap(left, right: Natural) is tmp : constant T_Digit := vec(left); - tmp_index : constant Long_Natural := vec_index(left); + tmp_index : constant Natural := vec_index(left); begin vec(left) := vec(right); vec(right) := tmp; diff --git a/src/vector.ads b/src/vector.ads index 23d29d2..df9ccbe 100644 --- a/src/vector.ads +++ b/src/vector.ads @@ -1,6 +1,4 @@ with Ada.Text_IO; use Ada.Text_IO; -with Ada.Integer_Text_IO; -with Ada.Long_Integer_Text_IO; package Vector is @@ -10,14 +8,9 @@ package Vector is package Entier is - subtype Long_Natural is Long_Integer range 0 .. Long_Integer'Last; -- plus nécéssaire après implèm Links, TODO - - -- on permet l'affichage des entiers. - use Ada.Long_Integer_Text_IO; + type T_Vecteur is array (0..Capacite-1) of Natural; - type T_Vecteur is array (0..Capacite-1) of Long_Natural; - - procedure initialize(vec: in out T_Vecteur; value: in Long_Natural); + procedure initialize(vec: in out T_Vecteur; value: in Natural); procedure identity(vec: in out T_Vecteur); procedure flip(vec: in out T_Vecteur); @@ -41,10 +34,7 @@ package Vector is -- on permet l'affichage direct des T_Digit package Text_T_Element is new Ada.Text_IO.Float_IO(Num => T_Digit); - use Text_T_Element; - - -- on importe les vecteurs d'entiers - use Vector_Entier; + use Text_T_Element; type T_Vecteur is array (0..Capacite-1) of T_Digit; @@ -74,9 +64,6 @@ package Vector is from: Natural; to: Natural; end record; - - -- on permet l'affichage des entiers. - use Ada.Integer_Text_IO; type T_Vecteur is array (0..Capacite-1) of T_Link;