#NEWLINE# def check_pca_svd( pcares , pcasvdres ) : #NEWLINE# #INDENT# ( xreduced , factors , evals , evecs ) = pcares #NEWLINE# ( xred_svd , factors_svd , evals_svd , evecs_svd ) = pcasvdres #NEWLINE# assert_array_almost_equal ( evals_svd , evals , 14 ) #NEWLINE# msign = ( evecs / evecs_svd ) [ 0 ] #NEWLINE# assert_array_almost_equal ( ( msign * evecs_svd ) , evecs , 13 ) #NEWLINE# assert_array_almost_equal ( ( pcasvdres * factors_svd ) , factors , 13 ) #NEWLINE# assert_array_almost_equal ( xred_svd , xreduced , 13 )