aiida_quantumespresso.utils.linalg
#
Utilities related to linear algebra operations.
Module Contents#
Functions#
|
Return whether matrix_a and matrix_b can be considered equal. |
- aiida_quantumespresso.utils.linalg.are_matrices_equal(matrix_a, matrix_b, swap_sign_matrix_b=False, tolerance=1e-05)[source]#
Return whether matrix_a and matrix_b can be considered equal.
The matrices will be cast to a numpy array and the difference will then be defined as the sum of all elements of the absolute difference between the two. If that sum is less than the tolerance, the function will return True. In all other cases it will be False
- Parameters:
matrix_a – a (nested) list
matrix_b – a (nested) list
swap_sign_matrix_b – when True will swap the sign of matrix_b before comparison
tolerance – the tolerance within which the matrix difference is considered negligible
- Returns:
True if the sum of the absolute difference elements is less than the tolerance, False otherwise