build prior matrix and whiten method