def _check_with_col_sign_flipping(A, B, tol=0.0):
 sign = True
 for column_idx in range(A.shape[1]):
  sign = (sign and ((((A[:, column_idx] - B[:, column_idx]) ** 2).mean() <= (tol ** 2)) or (((A[:, column_idx] + B[:, column_idx]) ** 2).mean() <= (tol ** 2))))
  if (not sign):
   return False
 return True

def _check_with_col_sign_flipping ( A , B , tol = 0.0 ) : sign = True for column_idx in range ( A . shape [ 1 ] ) : sign = ( sign and ( ( ( ( A [ : , column_idx ] - B [ : , column_idx ] ) ** 2 ) . mean ( ) <= ( tol ** 2 ) ) or ( ( ( A [ : , column_idx ] + B [ : , column_idx ] ) ** 2 ) . mean ( ) <= ( tol ** 2 ) ) ) ) if ( not sign ) : return False return True
check array a and b are equal with possible sign flipping on each columns .