Skip to content

Instantly share code, notes, and snippets.

@valexey
Created March 1, 2016 17:16
Show Gist options
  • Save valexey/d9af4f73d10198d3c568 to your computer and use it in GitHub Desktop.
Save valexey/d9af4f73d10198d3c568 to your computer and use it in GitHub Desktop.
MODULE A;
IMPORT Random, Commands, Kernel;
VAR
A, B, C : ARRAY [*,*] OF LONGREAL;
i, j : INTEGER;
S : INTEGER;
G : Random.Generator;
PROCEDURE Randomize();
BEGIN
NEW(A, S, S);
NEW(B, S, S);
NEW(C, S, S);
FOR i := 0 TO S-1 DO
FOR j :=0 TO S-1 DO
A[i][j] := G.Uniform()/10.9;
B[i][j] := G.Uniform()/10.0;
C[i][j] := 0.0;
END
END
END Randomize;
PROCEDURE Do* (context: Commands.Context);
VAR
t1, t2 : LONGINT;
BEGIN
FOR S:=10 TO 2000 BY 100 DO
Randomize();
t1 := Kernel.GetTicks();
C := A*B;
t2 := Kernel.GetTicks();
context.out.Int(t2-t1, 10);
END
END Do;
BEGIN
NEW(G);
END A.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment