Extended functions in PLA.R

to meet the requirements of external calls from LinReg codes (HW2)