R code for CDO pricing by Yafei Xu