<s> """<STR_LIT>""" <EOL> import numpy <EOL> import time <EOL> from pyRMSD . condensedMatrix import CondensedMatrix <EOL> from pyproct . algorithms . spectral . spectralClusteringAlgorithm import SpectralClusteringAlgorithm <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> MAX_ELEMENTS = <NUM_LIT> <EOL> DATA_LEN = ( MAX_ELEMENTS * ( MAX_ELEMENTS - <NUM_LIT:1> ) ) / <NUM_LIT:2> <EOL> numpy_matrix_data = numpy . abs ( numpy . random . rand ( DATA_LEN ) ) <EOL> matrix = CondensedMatrix ( numpy_matrix_data ) <EOL> W = SpectralClusteringAlgorithm . calculate_adjacency_matrix ( matrix , <NUM_LIT:1> ) <EOL> W_tmp = numpy . array ( W ) <EOL> t1 = time . time ( ) <EOL> L_PYTHON = SpectralClusteringAlgorithm . calculate_laplacian ( W_tmp , matrix , "<STR_LIT>" ) [ <NUM_LIT:0> ] <EOL> t2 = time . time ( ) <EOL> print '<STR_LIT>' % ( t2 - t1 ) <EOL> W_tmp = numpy . array ( W ) <EOL> t1 = time . time ( ) <EOL> L_NUMPY = SpectralClusteringAlgorithm . calculate_laplacian ( W_tmp , matrix , "<STR_LIT>" ) [ <NUM_LIT:0> ] <EOL> t2 = time . time ( ) <EOL> print '<STR_LIT>' % ( t2 - t1 ) <EOL> W_tmp = numpy . array ( W ) <EOL> t1 = time . time ( ) <EOL> L_NUMPY_PURE = SpectralClusteringAlgorithm . calculate_laplacian ( W_tmp , matrix , "<STR_LIT>" ) [ <NUM_LIT:0> ] <EOL> t2 = time . time ( ) <EOL> print '<STR_LIT>' % ( t2 - t1 ) <EOL> numpy . testing . assert_almost_equal ( L_NUMPY , L_NUMPY_PURE , <NUM_LIT:10> ) <EOL> numpy . testing . assert_almost_equal ( L_PYTHON , L_NUMPY , <NUM_LIT:3> ) <EOL> numpy . testing . assert_almost_equal ( L_PYTHON , L_NUMPY_PURE , <NUM_LIT:3> ) </s>
