Tests that sorting using row norm works as expected
(descriptor_func)
| 654 | |
| 655 | |
| 656 | def assert_matrix_descriptor_sorted(descriptor_func): |
| 657 | """Tests that sorting using row norm works as expected""" |
| 658 | system = get_complex_finite() |
| 659 | desc = descriptor_func(permutation="sorted_l2")([system]) |
| 660 | features = desc.create(system) |
| 661 | features = desc.unflatten(features) |
| 662 | |
| 663 | # Check that norms are ordered correctly |
| 664 | lens = np.linalg.norm(features, axis=1) |
| 665 | old_len = lens[0] |
| 666 | for length in lens[1:]: |
| 667 | assert length <= old_len |
| 668 | old_len = length |
| 669 | |
| 670 | # Check that the matrix is symmetric |
| 671 | assert np.allclose(features, features.T, rtol=0, atol=1e-13) |
| 672 | |
| 673 | |
| 674 | def assert_matrix_descriptor_eigenspectrum(descriptor_func): |
no test coverage detected