#NEWLINE# def test_decorrelate( self ) : #NEWLINE# #INDENT# d = 30 #NEWLINE# dg = np . linspace ( 1 , 2 , d ) #NEWLINE# root = np . random . normal ( size = ( d , 4 ) ) #NEWLINE# fac = FactoredPSDMatrix ( dg , root ) #NEWLINE# mat = fac . to_matrix ( ) #NEWLINE# rmat = np . linalg . cholesky ( mat ) #NEWLINE# dcr = fac . decorrelate ( rmat ) #NEWLINE# idm = np . dot ( dcr , dcr . T ) #NEWLINE# assert_almost_equal ( idm , np . eye ( d ) ) #NEWLINE# rhs = np . random . normal ( size = ( d , 5 ) ) #NEWLINE# mat2 = np . dot ( rhs . T , np . linalg . solve ( mat , rhs ) ) #NEWLINE# mat3 = fac . decorrelate ( rhs ) #NEWLINE# mat3 = np . dot ( mat3 . T , mat3 ) #NEWLINE# assert_almost_equal ( mat2 , mat3 )