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

Method sort

dscribe/descriptors/descriptormatrix.py:137–153  ·  view source on GitHub ↗

Sorts the given matrix by using the L2 norm. Args: matrix(np.ndarray): The matrix to sort. Returns: np.ndarray: The sorted matrix.

(self, matrix)

Source from the content-addressed store, hash-verified

135 return matrix
136
137 def sort(self, matrix):
138 """Sorts the given matrix by using the L2 norm.
139
140 Args:
141 matrix(np.ndarray): The matrix to sort.
142
143 Returns:
144 np.ndarray: The sorted matrix.
145 """
146 # Sort the atoms such that the norms of the rows are in descending
147 # order
148 norms = np.linalg.norm(matrix, axis=1)
149 sorted_indices = np.argsort(-norms, kind="stable", axis=0)
150 sorted_matrix = matrix[sorted_indices]
151 sorted_matrix = sorted_matrix[:, sorted_indices]
152
153 return sorted_matrix
154
155 def get_eigenspectrum(self, matrix):
156 """Calculates the eigenvalues of the matrix and returns a list of them

Callers 3

create_singleMethod · 0.95
create_parallelMethod · 0.45
derivatives_parallelMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected