matprod.f
c<html>
c<head><title>matprod.f</title></head>
c<body>
c<pre>
program dimtest
c
c test the Matrix multiply and other matrix
c aritmetic
c
c John Mahaffy 3/31/96
c
real a(3,3), b(3,3), c(3,3),x(3),y(3)
data a/1,2,3,1,2,3,1,2,3/
data b/1,1,1,2,2,2,3,3,3/
data x/1,2,3/,y/2,2,2/
c <a name=2><font color=FF0000>
c = matmul(a,b)
y = matmul(a,x)
c </font>
write(*,*) ' a = '
write( *, 2000) ((a(i,j),j=1,3),i=1,3)
write(*,*) ' b = '
write( *, 2000) ((b(i,j),j=1,3),i=1,3)
write(*,*) ' c = a b ='
write( *, 2000) ((c(i,j),j=1,3),i=1,3)
write( *, 2001) "x", x
write(*,*) ' y = a x '
write(*,2001) 'y', y
c <a name=1><font color=FF0000>
dotpro = dot_product(x,y)
c </font>
write(*,*) 'Evaluate the dot product of x and y'
write(*,'(a,f8.1)') 'Result of DOT_PRODUCT function =', dotpro
dotpro = sum(x*y)
write(*,'(a,f8.1)') 'Dot Product using SUM function =', dotpro
2000 format(4x,3f8.1)
2001 format (/, 1x,a1,' = ', f8.1,/, (5x,f8.1))
stop
end
c</pre>
c</body>
c</html>