!      program iterativo
!	programa principal para metodos iterativos
	parameter (np=10)
	dimension a(np,np),x(np),b(np),d(np)

      open(unit=1,file='input.txt',status='old')
      open(unit=2,file='output.txt',status='unknown')        
!
!	Leitura de dados
!
      read(1,*)n,tol,maxit
      write(*,*)'n= ',n,'tol=',tol,'maxit=',maxit
	pi=4*atan(1.d0)
	write(*,*)'pi= ',pi
!	b=pi/2
	read (1,*) (b(i),i=1,n)
      write(*,*)'b(i)=', (b(i),i=1,n)
	write(*,*)'a matriz a(i,j) eh:'
	do i=1,n
		read(1,*) (a(i,j),j=1,n)
		write(*,*)(a(i,j),j=1,n)

	enddo
	call jacobi(maxit,n,np,a,x,b,tol)
	do i=1,n
		write(2,*)'a solucao e x(',i,')=',x(i)
		write(*,*)'a solucao e x(',i,')=',x(i)
	enddo
      stop
      end 
!----------------------------------
	function vnorm(x,n,np)
	dimension x(np)
	sum=0.d0
	do i=1,n
		sum=sum+x(i)*x(i)
	enddo
	vnorm=sqrt(sum)
	return
	end
