Program T_tridig

use std_type
use VstupVystup
use LinEqu

implicit none

integer :: n
real(Kind=DP),dimension(:),allocatable :: a,b,c,f
character(len=20) :: FmtRetez
logical :: res

call cti_cislo("Pocet rovnic = ",n)
allocate(a(n))
Allocate(b(n))
allocate(c(n))
allocate(f(n))

print *, "Zadej hlavni diagonalu "
call cti_vektor(n,c)
print *, "Zadej spodni vedlejsi diagonalu s OPACNYM znamenkem A a(1)=0 !!!"
call cti_vektor(n,a)
print *, "Zadej horni vedlejsi diagonalu s OPACNYM znamenkem A b(n)=0 !!!"
call cti_vektor(n,b)

if (a(1)/=0 .or. b(n)/=0) then
    print *,"Chybne zadani a(1) nebo b(n) !!!"
    stop
end if

print *
Print *,"Hlavni diagonala:"
FmtRetez = "(f10.3)"
call pis_vektor(n,c,FmtRetez)
Print *,"Spodni vedlejsi diagonala:"
FmtRetez = "(f10.3)"
call pis_vektor(n,a,FmtRetez)
Print *,"Horni vedlejsi diagonala:"
FmtRetez = "(f10.3)"
call pis_vektor(n,b,FmtRetez)


print *, "Zadej pravou stranu"
call cti_vektor(n,f)

call Tridig(n,a,c,b,f,res)

print *,char(10)//"Reseni:"
FmtRetez = "(es12.4e2)"
call pis_vektor(n,f,FmtRetez)
print "(/,a4,l3)","res=",res

end program T_tridig
