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:
parent
32aedad426
commit
84567e2dea
|
@ -1,3 +1,5 @@
|
||||||
|
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
|
||||||
|
|
||||||
package body Google_Naive is
|
package body Google_Naive is
|
||||||
|
|
||||||
function "*"(left : T_Vecteur; right : T_Google) return T_Vecteur is
|
function "*"(left : T_Vecteur; right : T_Google) return T_Vecteur is
|
||||||
|
@ -21,7 +23,7 @@ package body Google_Naive is
|
||||||
initialize(mat);
|
initialize(mat);
|
||||||
for i in 0..N-1 loop
|
for i in 0..N-1 loop
|
||||||
for j 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;
|
||||||
end loop;
|
end loop;
|
||||||
return mat;
|
return mat;
|
||||||
|
@ -33,7 +35,7 @@ package body Google_Naive is
|
||||||
initialize(mat);
|
initialize(mat);
|
||||||
for i in 0..N-1 loop
|
for i in 0..N-1 loop
|
||||||
for j 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;
|
||||||
end loop;
|
end loop;
|
||||||
return mat;
|
return mat;
|
||||||
|
@ -110,7 +112,7 @@ package body Google_Naive is
|
||||||
end loop;
|
end loop;
|
||||||
else -- sum == 0
|
else -- sum == 0
|
||||||
for j in 0..N-1 loop
|
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 loop;
|
||||||
end if;
|
end if;
|
||||||
end loop;
|
end loop;
|
||||||
|
@ -124,7 +126,7 @@ package body Google_Naive is
|
||||||
procedure put(vec: in T_Vecteur) is
|
procedure put(vec: in T_Vecteur) is
|
||||||
begin
|
begin
|
||||||
for i in 0..N-1 loop
|
for i in 0..N-1 loop
|
||||||
put(Float(vec(i))); new_line;
|
put(vec(i)); new_line;
|
||||||
end loop;
|
end loop;
|
||||||
end put;
|
end put;
|
||||||
|
|
||||||
|
@ -132,7 +134,7 @@ package body Google_Naive is
|
||||||
begin
|
begin
|
||||||
for i in 0..N-1 loop
|
for i in 0..N-1 loop
|
||||||
for j in 0..N-1 loop
|
for j in 0..N-1 loop
|
||||||
put(Float(mat(i,j)));
|
put(mat(i,j));
|
||||||
end loop;
|
end loop;
|
||||||
new_line;
|
new_line;
|
||||||
end loop;
|
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
|
procedure put(file: in out Ada.Text_IO.File_Type; vec: in T_Vecteur) is
|
||||||
begin
|
begin
|
||||||
for i in 0..N-1 loop
|
for i in 0..N-1 loop
|
||||||
put(file, Float(vec(i)));
|
put(file, vec(i));
|
||||||
new_line(file);
|
new_line(file);
|
||||||
end loop;
|
end loop;
|
||||||
end put;
|
end put;
|
||||||
|
@ -176,5 +178,4 @@ package body Google_Naive is
|
||||||
end loop;
|
end loop;
|
||||||
end sort_with_index_desc;
|
end sort_with_index_desc;
|
||||||
|
|
||||||
|
|
||||||
end Google_Naive;
|
end Google_Naive;
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
with Ada.Text_IO; use Ada.Text_IO;
|
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
|
generic
|
||||||
|
|
||||||
|
@ -9,6 +7,11 @@ generic
|
||||||
|
|
||||||
package Google_Naive is
|
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_Google is private;
|
||||||
type T_Vecteur is private;
|
type T_Vecteur is private;
|
||||||
|
|
||||||
|
|
|
@ -84,8 +84,7 @@ procedure pageRank is
|
||||||
new Google_Naive(T_Element => T_Double, N => N);
|
new Google_Naive(T_Element => T_Double, N => N);
|
||||||
use Google;
|
use Google;
|
||||||
|
|
||||||
procedure algorithm_naif(N: in Positive;
|
procedure algorithm_naif(file: in out Ada.Text_IO.File_Type;
|
||||||
file: in out Ada.Text_IO.File_Type;
|
|
||||||
alpha: in T_Double;
|
alpha: in T_Double;
|
||||||
ite_max: in Natural;
|
ite_max: in Natural;
|
||||||
pi: out T_Vecteur) is
|
pi: out T_Vecteur) is
|
||||||
|
@ -149,7 +148,7 @@ procedure pageRank is
|
||||||
begin
|
begin
|
||||||
|
|
||||||
if naif then
|
if naif then
|
||||||
algorithm_naif(N, file, alpha, ite_max, pi);
|
algorithm_naif(file, alpha, ite_max, pi);
|
||||||
else
|
else
|
||||||
--algorithm_creux(N, file, alpha, ite_max, pi);
|
--algorithm_creux(N, file, alpha, ite_max, pi);
|
||||||
put_line("TODO");
|
put_line("TODO");
|
Loading…
Reference in a new issue