diff --git a/scripts/tcd/Basis_Function.py b/scripts/tcd/Basis_Function.py index 758dc2a32ca782e2cdd5fbb357edbce6387d3e57..35701b09241055fa7e22e2d2149bcf44503df374 100644 --- a/scripts/tcd/Basis_Function.py +++ b/scripts/tcd/Basis_Function.py @@ -356,17 +356,14 @@ class OrthonormalLegendre(Legendre): ndarray Inverse mass matrix. + Notes + ----- + To increase speed, this function uses that for the orthonormal Legendre + polynomial basis the inverse mass matrix is equal to the identity + matrix. + """ - mass_matrix = [] - for i in range(self._polynomial_degree+1): - new_row = [] - for j in range(self._polynomial_degree+1): - new_entry = 0.0 - if i == j: - new_entry = 1.0 - new_row.append(new_entry) - mass_matrix.append(new_row) - return np.array(mass_matrix) + return np.identity(self._polynomial_degree+1) @property @cache