added psd2ar function