MCPcopy Create free account
hub / github.com/SINGROUP/dscribe / assert_matrix_descriptor_sorted

Function assert_matrix_descriptor_sorted

tests/conftest.py:656–671  ·  view source on GitHub ↗

Tests that sorting using row norm works as expected

(descriptor_func)

Source from the content-addressed store, hash-verified

654
655
656def 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
674def assert_matrix_descriptor_eigenspectrum(descriptor_func):

Calls 3

get_complex_finiteFunction · 0.85
unflattenMethod · 0.80
createMethod · 0.45

Tested by

no test coverage detected