#NEWLINE# @ staticmethod #NEWLINE# def checkSymmetric( A , tol = ( 10 ** ( - 6 ) ) , softCheck = False , arrayInfo = '?' ) : #NEWLINE# #INDENT# '\n        Takes as input a matrix A and checks if it is symmetric by verifying whether\n        ||A - A.T||_F < tol.\n        ' #NEWLINE# if ( ( type ( A ) == numpy . ndarray ) and ( ( ( A . T - A ) ** 2 ) . sum ( ) > ( tol ** 2 ) ) ) : #NEWLINE# #INDENT# return Parameter . whatToDo ( ( ( ( 'A=' + arrayInfo ) + ' is not a symmetric matrix, ||A.T - A||_F^2 = ' ) + str ( ( ( A . T - A ) ** 2 ) . sum ( ) ) ) , softCheck ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( scipy . sparse . issparse ( A ) and ( ( A . T - A ) . multiply ( ( A . T - A ) ) . sum ( ) > ( tol ** 2 ) ) ) : #NEWLINE# #INDENT# return Parameter . whatToDo ( ( ( ( 'A=' + arrayInfo ) + ' is not a symmetric matrix, ||A.T - A||_F^2 = ' ) + str ( ( A . T - A ) . multiply ( ( A . T - A ) ) . sum ( ) ) ) , softCheck ) #NEWLINE# #UNINDENT# #UNINDENT# return True