part2_solutions - solutions.txt Tue Mar 21 16:10:03 2006 1...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
solutions.txt Tue Mar 21 16:10:03 2006 1 PROGRAM part2 !*** the result in mat3. ie "mat3 = mat1 X mat2" where "X" represents !*** matrix multiplication. IMPLICIT NONE INTEGER, PARAMETER :: m=3,n=4,k=3 REAL, DIMENSION(m,n) :: mat1 REAL, DIMENSION(n,k) :: mat2 REAL, DIMENSION(m,k) :: mat3,mat4 !**** Input the two matrices from the keyboard !**** Press return after each row !**** matrix one then matrix two mat1=getmat(m,n) mat2=getmat(n,k) !**** Use our matrix mult. function to calc. mat3 mat3=mulmat(mat1,mat2) !**** Perform the matrix multiplication !**** using Fortran’s MATMUL(A,B) function mat4=MATMUL(mat1,mat2) !**** Print out each matrix to the screen !**** NOTE the use of / to create a blank line PRINT ’(/,"Matrix One",/)’ CALL outmat(mat1) PRINT ’(/,"Matrix Two",/)’ CALL outmat(mat2) PRINT ’(/,"Matrix1 * Matrx2 (My Answer)",/)’ CALL outmat(mat3) PRINT ’(/,"Matrix1 * Matrx2 (Fortran Answer)",/)’ CALL outmat(mat4)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/13/2012 for the course MATH 5806 taught by Professor Brooks during the Fall '10 term at Minnesota.

Ask a homework question - tutors are online