triqs.utility.comparison_tests.assert_array_close_to_scalar
- triqs.utility.comparison_tests.assert_array_close_to_scalar(a, x, precision=1e-06)[source]
Assert that a square matrix equals
xtimes the identity.Compares
aagainst \(x\, \mathbb{1}_n\) wherenisa.shape[0], viaassert_arrays_are_close().- Parameters:
- anumpy.ndarray
Two-dimensional square array.
- xscalar
Scalar value to compare
aagainst, after multiplication by the identity matrix.- precisionfloat, optional
Maximum allowed element-wise absolute difference. Default
1e-6.
- Raises:
- AssertionError
If
adiffers fromx * identity(a.shape[0])by more thanprecisionin any entry.