more fixes

git-svn-id: http://cregut.svn.enseeiht.fr/2020/1sn/pim/projets/GH-05@209146 e13453a9-b01f-0410-a051-f404c4f0c485
This commit is contained in:
lfainsin 2020-12-16 20:43:17 +00:00
parent 32aedad426
commit 84567e2dea
3 changed files with 15 additions and 12 deletions

View file

@ -1,3 +1,5 @@
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
package body Google_Naive is
function "*"(left : T_Vecteur; right : T_Google) return T_Vecteur is
@ -21,7 +23,7 @@ package body Google_Naive is
initialize(mat);
for i in 0..N-1 loop
for j in 0..N-1 loop
mat(i,j) := T_Element(left)*right(i,j);
mat(i,j) := left*right(i,j);
end loop;
end loop;
return mat;
@ -33,7 +35,7 @@ package body Google_Naive is
initialize(mat);
for i in 0..N-1 loop
for j in 0..N-1 loop
mat(i,j) := left(i,j)/T_Element(right);
mat(i,j) := left(i,j)/right;
end loop;
end loop;
return mat;
@ -110,7 +112,7 @@ package body Google_Naive is
end loop;
else -- sum == 0
for j in 0..N-1 loop
mat(i,j) := 1.0 / T_Element(N);
mat(i,j) := 1.0/T_Element(N);
end loop;
end if;
end loop;
@ -124,7 +126,7 @@ package body Google_Naive is
procedure put(vec: in T_Vecteur) is
begin
for i in 0..N-1 loop
put(Float(vec(i))); new_line;
put(vec(i)); new_line;
end loop;
end put;
@ -132,7 +134,7 @@ package body Google_Naive is
begin
for i in 0..N-1 loop
for j in 0..N-1 loop
put(Float(mat(i,j)));
put(mat(i,j));
end loop;
new_line;
end loop;
@ -141,7 +143,7 @@ package body Google_Naive is
procedure put(file: in out Ada.Text_IO.File_Type; vec: in T_Vecteur) is
begin
for i in 0..N-1 loop
put(file, Float(vec(i)));
put(file, vec(i));
new_line(file);
end loop;
end put;
@ -176,5 +178,4 @@ package body Google_Naive is
end loop;
end sort_with_index_desc;
end Google_Naive;

View file

@ -1,6 +1,4 @@
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
generic
@ -9,6 +7,11 @@ generic
package Google_Naive 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;
type T_Google is private;
type T_Vecteur is private;

View file

@ -84,8 +84,7 @@ procedure pageRank is
new Google_Naive(T_Element => T_Double, N => N);
use Google;
procedure algorithm_naif(N: in Positive;
file: in out Ada.Text_IO.File_Type;
procedure algorithm_naif(file: in out Ada.Text_IO.File_Type;
alpha: in T_Double;
ite_max: in Natural;
pi: out T_Vecteur) is
@ -149,7 +148,7 @@ procedure pageRank is
begin
if naif then
algorithm_naif(N, file, alpha, ite_max, pi);
algorithm_naif(file, alpha, ite_max, pi);
else
--algorithm_creux(N, file, alpha, ite_max, pi);
put_line("TODO");