! Inmultire S(stocaj triunghiul sup.)*A
subroutine compact_mul(n, s, a, b)

real(8) s(n*(n+1)/2), a(n,n), b(n,n)
real(8) row_s(n), col(n)

!b =matmul(s,a)


DO i =1,n

row_s =0.; col =0.;

! Linia "i" din S(n,n)~s:
do k =1, n
if(k >=i) then
lk =loca(i,k)
else
lk =loca(k,i)
endif

row_s(k) =s(lk)
enddo

DO j =1,n
! Coloana "j" din A:
col =a(:,j)

b(i,j) =dot_product(row_s, col)

ENDDO
ENDDO


END





