part4_solutions

part4_solutions - solutions Fri:51:18 2011 1 1 2...

This preview shows pages 1–2. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: solutions.txt Fri Dec 16 12:51:18 2011 1 1: 2:******************************************* 3:./part4.f90 4: 5:PROGRAM part4 6: 7: USE part4_mod 8: 9: IMPLICIT NONE 10: 11: INTEGER, PARAMETER :: m=3,n=3 12: REAL, DIMENSION(m,n) :: mat1 13: REAL, DIMENSION(m,n) :: mat2 14: REAL, DIMENSION(m) :: eigvec 15: REAL :: tol=0.000001,eigval 16: LOGICAL :: flag 17: 18: !mat1=getmat(m,n) !*** Input matrix1 from the keyboard 19: 20: mat1(1,:)=(/1,5,3/) 21: mat1(2,:)=(/6,3,5/) 22: mat1(3,:)=(/2,8,5/) 23: 24: !** mat1(1,:)=(/-4,14,0/) 25: !** mat1(2,:)=(/-5,13,0/) 26: !** mat1(3,:)=(/-1,0,2/) 27: 28: PRINT*, "Original Matrix" 29: PRINT*, "" 30: CALL outmat(mat1) 31: 32: mat2=transmat2(mat1) 33: 34: PRINT*, "" 35: PRINT*, "Matrix Transpose" 36: PRINT*, "" 37: 38: CALL outmat(mat2) 39: 40: 41:END PROGRAM part4 42:******************************************* 43: 44: 45:******************************************* 46:./part4_mod.f90 47: 48:MODULE part4_mod 49: 50: IMPLICIT NONE 51: 52: CONTAINS 53: 54: ! *********************************************************************** 55: 56: FUNCTION infnorm(vec) 57: !** Calculates the infinity norm of vector vec. 58: 59: !*** Dummy declarations 60: REAL, DIMENSION(:), INTENT(IN) :: vec 61: 62: !*** Local declarations 63: REAL :: infnorm 64: 65: infnorm=MAXVAL(ABS(vec)) 66: 67: END FUNCTION infnorm solutions.txt Fri Dec 16 12:51:18 2011 2 68: 69: ! *********************************************************************** 70: 71: FUNCTION twonorm(vec) 72: !** Calculates the Euclidean norm of vector vec. 73: 74: !*** Dummy declarations 75: REAL, DIMENSION(:), INTENT(IN) :: vec 76: 77: !*** Local declarations 78: REAL :: twonorm 79: 80: twonorm=SQRT(SUM(vec**2)) 81: 82: END FUNCTION twonorm 83: 84: ! *********************************************************************** 85: 86: FUNCTION cont(y,x,tol) 87: !*** Returns a logical type. If . TRUE . then the tolerance has been met or 88: !*** the maximum number of iterations has been exceeded.!...
View Full 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.

Page1 / 3

part4_solutions - solutions Fri:51:18 2011 1 1 2...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online