Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
35
Task/Identity-matrix/Component-Pascal/identity-matrix.pas
Normal file
35
Task/Identity-matrix/Component-Pascal/identity-matrix.pas
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
MODULE Algebras;
|
||||
IMPORT StdLog,Strings;
|
||||
|
||||
TYPE
|
||||
Matrix = POINTER TO ARRAY OF ARRAY OF INTEGER;
|
||||
|
||||
PROCEDURE NewIdentityMatrix(n: INTEGER): Matrix;
|
||||
VAR
|
||||
m: Matrix;
|
||||
i: INTEGER;
|
||||
BEGIN
|
||||
NEW(m,n,n);
|
||||
FOR i := 0 TO n - 1 DO
|
||||
m[i,i] := 1;
|
||||
END;
|
||||
RETURN m;
|
||||
END NewIdentityMatrix;
|
||||
|
||||
PROCEDURE Show(m: Matrix);
|
||||
VAR
|
||||
i,j: INTEGER;
|
||||
BEGIN
|
||||
FOR i := 0 TO LEN(m,0) - 1 DO
|
||||
FOR j := 0 TO LEN(m,1) - 1 DO
|
||||
StdLog.Int(m[i,j]);
|
||||
END;
|
||||
StdLog.Ln
|
||||
END
|
||||
END Show;
|
||||
|
||||
PROCEDURE Do*;
|
||||
BEGIN
|
||||
Show(NewIdentityMatrix(5));
|
||||
END Do;
|
||||
END Algebras.
|
||||
Loading…
Add table
Add a link
Reference in a new issue