Matrix Multiply


      program mmult
      parameter(nmax=256,ntot=nmax*nmax)
      dimension a(nmax,nmax),b(nmax,nmax),c(nmax,nmax)
c   initialize the c-matrix to zero
      data c/ntot*0.0/
c   define the value of pi
      pi = acos(-1.0)
c   build the matrices a and b
      dx = pi/(float(nmax)+1.0)
      y = 1.0
      do 31 j = 1,nmax
      x = dx
      do 32 i = 1,nmax
      b(i,j) = sin(x*y)
      a(j,i) = b(i,j)
      x = x +dx
32    continue
      y = y+1.0
31    continue
c   perform a matrix multiply
      do 1 i = 1,nmax
      do 2 j = 1,nmax
      do 3 k = 1,nmax
3     c(i,j) = c(i,j) + a(i,k)*b(k,j)
2     continue
1     continue
      end