Update functions.R

add function getLmat: get Lmatrix from Amatrix