program T_jacobi


use std_type
use VstupVystup
use eigen

implicit none

integer :: dimA, etap
real(kind=DP),dimension(:,:),allocatable :: A,V

call cti_cislo("Dimenze matice = ",dimA)
Allocate(A(dimA,dimA))
Allocate(V(dimA,dimA))

print *,"Zadej spodni trojuhelnik A po radcich"
call cti_s_matici(dimA,A)

print *,char(10)//"Zadana matice A"
call pis_matici(dimA,dimA,A,"(f10.3)")

etap = 30

call jacobi(dimA,A,V,etap)

print *,char(10)//"Matice A po vystupu z jacobi"
call pis_matici(dimA,dimA,A,"(es12.3e3)")

print *,char(10)//"Matice V po vystupu z jacobi"
call pis_matici(dimA,dimA,V,"(es12.3e3)")

print "(/,a,i3)","Pocet provedenych etap =",etap


contains

subroutine cti_s_matici(dimA,A)
	integer,intent(in) :: dimA
	real(kind=DP),dimension(:,:),intent(out) :: A
	integer :: i,j
    
	do i=1,dimA
	    read (unit=*,fmt=*) (A(i,j),j=1,i)
	end do
    do i=1,dimA
        do j=i+1,dimA
            A(i,j)=A(j,i)
        end do
    end do
	

end subroutine cti_s_matici



end program T_jacobi
