
Program T_Choleski

use std_type
use VstupVystup
use LinEqu

implicit none

integer :: dimA
real(Kind=DP),dimension(:),allocatable :: A1
logical :: JePosDef
character(len=20) :: FmtRetez
real(kind=DP),dimension(:),allocatable :: b

call cti_cislo("Pocet rovnic = ",dimA)
allocate(A1(dimA*(dimA+1)/2))
allocate(b(dimA))

print *, "Zadej matici A1 po radcich"
call cti_vektor(dimA*(dimA+1)/2,A1)

print *
Print *,"Zadany trojuhelnik matice A1:"
FmtRetez = "(f10.3)"
call pis_t_matici(dimA,A1,FmtRetez,"s")

call Chodec(dimA,A1,JePosDef)

print *,char(10)//"Matice A1 po Chodec:"
FmtRetez = "(f12.4)"
call pis_t_matici(dimA,A1,FmtRetez,"s")
print "(a,l2)",char(10)//"Je positivne definitni? ",JePosDef

if (JePosDef) THEN
    print *, char(10)//"Zadej vektor prave strany: "
    call cti_vektor(dimA,b)
    
    call Chosol(dimA,A1,b)
    
    print *, "Reseni je :"
    call pis_vektor(dimA,b,"(es15.6e3)")
end if

end program T_Choleski
