Update functions2.R

replace Lmatrix with Amatrix