{ Copyright (C) 1986 Adam Fritz, 133 Main St., Afton, N.Y. 13730 } program PRDR ; { } { PROGRAM: } { } { Pan-Reif driver. } { } { VERSION: DATE: } { } { TURBO Pascal 1.1 April 25, 1986 } { } { DESCRIPTION: } { } { Initialize } { Get control parameters } { Generate and display test matrix } { Compute and display inverse matrix } { Compute and display residuals } { } { AUTHOR: } { } { Adam Fritz (TURBO Pascal) } { } const lda = 10 ; iterxx = 100 ; type MATRIX = array[1..lda,1..lda] of real ; VECTOR = array[1..lda] of real ; RowPointer = ^Row ; Row = record s : VECTOR end ; var n : integer ; { dimension } iterx : integer ; { maximum number of iterations } residx : real ; { convergence control } a : MATRIX ; { matrix to invert } b : MATRIX ; { approximate inverse } r : MATRIX ; { residual matrix } x : MATRIX ; { working matrix } i,j : integer ; { loop indices } {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} {$I HilGen.pas Hilbert test matrix generator } {-$I RanGen.pas Random test matrix generator } {$I BLAS.pas Basic Linear Algebra routines } {$I PR.pas Pan-Reif procedure } {$I OUT.pas Formatted output routine } {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} procedure Initialize ; begin { get control parameters } repeat Write ('Dimension = ') ; Readln (n) until ((n > 0) and (n <= lda)) ; repeat Write ('Iterations = ') ; Readln (iterx) until ((iterx > 0) and (iterx <= iterxx)) ; repeat Write ('Residual = ') ; Readln (residx) until (residx > 0.0) end ; {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} begin writeln ('Pan-Reif Test Program.') ; writeln ; { initialize } Initialize ; { compute and display test matrix } MatGen (a,lda,n) ; writeln ; writeln ('Original Matrix (by column):') ; writeln ; OUT (a[1,1],lda,n,n) ; { compute and display inverse } PanReif (a,b,r,x,lda,n,iterx,residx) ; writeln ('Iterations: ',iterx:3) ; writeln ; writeln ('Inverse (by column):') ; writeln ; OUT (b[1,1],lda,n,n) ; { Display Residuals } writeln('Residuals (by column):') ; writeln ; OUT(r[1,1],lda,n,n) ; writeln ('End of Test.') end. { Copyright (C) 1986 Adam Fritz, 133 Main St., Afton, N.Y. 13730 }