c=========================================================== c Test program for subroutine 'dmfrom', 'dmto' and c 'dmmmult' (see 'dmroutines.f') c c Program expects one argument, the name of a file which c contains a real*8 square matrix written as descibed c in the documentation for 'dmfrom' in 'dmroutines.f' c Use '-' to read from stdin. Program then computes c square of matrix and outputs result to stdout. c=========================================================== program tdm implicit none integer iargc character*256 fname c----------------------------------------------------------- c Maximum size for input and output arrays (matrices). c----------------------------------------------------------- integer maxsize parameter ( maxsize = 100 000 ) real*8 a(maxsize), asq(maxsize) integer d1a, d2a if( iargc() .ne. 1 ) go to 900 call getarg(1,fname) c----------------------------------------------------------- c Read matrix ... c----------------------------------------------------------- call dmfrom(fname,a,d1a,d2a,maxsize) if( d1a .gt. 0 .and. d2a .gt. 0 ) then if( d1a .eq. d2a ) then c----------------------------------------------------------- c Compute square ... c----------------------------------------------------------- call dmmmult(a,a,asq,d1a,d1a) c----------------------------------------------------------- c ... and output. c----------------------------------------------------------- call dmto('-',asq,d1a,d1a) else write(0,*) 'tdm: Input array not square' end if else write(0,*) 'tdm: dmfrom() failed' end if stop 900 continue write(0,*) 'usage: tdm ' write(0,*) write(0,*) ' Use ''tdm -'' to read ', & 'from standard input' stop end