subroutine A_gen(n, Ag, job)

real(8) Ag(n,n)
character(20) job
real(8) r0, NO
real(8), allocatable :: ri(:)

Job_If: &
IF(job =='0') THEN
ag(1,1) =1
ag(1,2) =-sqrt(2.)/2
ag(1,3)=0

ag(2,1) =ag(1,2)
ag(2,2) =1.5
ag(2,3) =-2/sqrt(5.)

ag(3,1) =0
ag(3,2) =ag(2,3)
ag(3,3) =2.4

ELSEIF(job =='xxx')	THEN	! Wilkinson (Ex.: n=12):
ag =0D0
!
do i = 1, n
	do j = 1, n

    enddo
enddo

ELSEIF(job =='Lucr_Sc_Doct')	THEN
ag =0D0

NO =10.; ngl =6;
allocate(ri(0:ngl))
ri =0D0

r0 =1.25E5	! kN/m


do i=1, ngl
ri(i) =r0 +i*NO*1E3
enddo

! Gen. K = tridiagonala; Triunghiul sup.
do i =1, ngl

! diagonal:
ag(i,i) =ri(i) +ri(i-1)

! dreapta:
if(i <=ngl-1) then
ag(i,i+1) =-ri(i)
endif

enddo

! Fill lower triangle:
do i=2,n
	do j=1, i-1
	ag(i,j) =ag(j,i)
	enddo
enddo

ENDIF Job_If

END