Advertisement
Guest User

Wilkinson

a guest
Nov 8th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. subroutine wilkinson(W, n, MDIM)
  2.     integer MDIM
  3.     real W(MDIM,n) ,s
  4.     do kk  = 1, 10
  5.     s = SECNDS(0.0)
  6.     do k = 1, 1000
  7.         do i = 1, n
  8.             W(i,i) = 1   
  9.             do j = i+1 , n, 2
  10.                 W(j,i) = 1         
  11.                 W(i,j) = 0
  12.             end do
  13.             do j = i+2 , n, 2
  14.                 W(j,i) = -1        
  15.                 W(i,j) = 0
  16.             end do
  17.             W(i,n) = -W(i+1,1)
  18.             W(n,n-i) = W(i+1,1)
  19.         end do
  20.         W(n,n) = 1
  21.     end do
  22.     s = SECNDS(s)
  23.     write(*,*) s
  24.     end do
  25.     end
  26.  
  27.  
  28.  
  29.     subroutine matrix_write(A,rig, col, MDIM)
  30.     integer MDIM, rig, col
  31.     real A(MDIM,col)
  32.     do i = 1, rig
  33.         write(*,*)(A(i,j), j= 1, col)
  34.         write(*,*)
  35.     end do
  36.       end
  37.  
  38.  
  39.  
  40.     program main
  41.     parameter(MDIM = 1000)
  42.     real W(MDIM,MDIM)
  43.     write(*,*)'Inserire l''ordine della matrice:'
  44.     read(*,*) n
  45.     call wilkinson(W, n, MDIM)
  46.     write(*,*)'Matrice di Wilkinson:'
  47.     write(*,*)
  48. c   call matrix_write(W, n, n, MDIM)
  49.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement