home *** CD-ROM | disk | FTP | other *** search
- Program Test_Sparse_Matrix_Library;
- {$I SPARSE.LIB }
-
- Procedure Testit;
- VAR
- A : NodePtr;
- r : real;
- i,j : integer;
-
- BEGIN
- ClrScr;
- Writeln(' This program tests the sparse matrix library in SPARSE.LIB. ');
- Writeln(' The program will first create an unfilled 150 by 150 matrix. ');
- Writeln(' Next, the program will enter elements on the leading, and ');
- Writeln(' first major and minor diagonals. Finally, the program reads the');
- Writeln(' Nonzero elements from A[120,120] to A[150,150] ');
- GoToXY(1,10);
- Writeln(' Press any key to continue...');
- REPEAT UNTIL KeyPressed;
- ClrScr;
- GoToXY(1,5);
- A := CreateArray(150,150);
- writeln(' Begin to fill matrix ');
- EnterElement(A,1,1,3.0);
- For j := 2 to 150 do
- BEGIN
- { entering a tridiagonal matrix }
- EnterElement(A,j,j,3.0);
- EnterElement(A,j,j-1,1.0);
- EnterElement(A,j-1,j,1.0);
- END;
- Writeln(' finished filling matrix ');
- Writeln(' Press return to continue ');
- REPEAT UNTIL KeyPressed;
- For i := 120 to 150 do
- For j := 120 to 150 do
- BEGIN
- r := ReadElement(A,i,j);
- If (r <> 0.0) then
- Writeln('A[',i:3,'-',j:3,'] := ',r:2:0);
- END;
- END;
-
-
-
-
- BEGIN
- Testit;
- END.