Skip to content
Snippets Groups Projects
Commit a5afdea5 authored by Laura Christine Kühle's avatar Laura Christine Kühle
Browse files

Vectorized '_build_basis_matrix()' in OrthonormalLegendre basis.

parent 79d4d953
No related branches found
No related tags found
No related merge requests found
...@@ -403,16 +403,15 @@ class OrthonormalLegendre(Legendre): ...@@ -403,16 +403,15 @@ class OrthonormalLegendre(Legendre):
Matrix containing the integral of basis products. Matrix containing the integral of basis products.
""" """
matrix = [] basis_row = np.array([self.basis[idx].subs(x, first_param) for idx in
for i in range(self._polynomial_degree + 1): range(self._polynomial_degree+1)])[: np.newaxis]
row = [] basis_col = np.array([self.basis[idx].subs(x, second_param) for idx in
for j in range(self._polynomial_degree + 1): range(self._polynomial_degree+1)])[: np.newaxis]
entry = integrate(self.basis[i].subs(x, first_param) basis_matrix = np.matmul(basis_row[:, np.newaxis],
* self.basis[j].subs(x, second_param), basis_col[:, np.newaxis].T)
(z, -1, 1)) basis_matrix = np.float64(np.vectorize(
row.append(np.float64(entry)) lambda y: integrate(y, (z, -1, 1)))(basis_matrix))
matrix.append(row) return basis_matrix
return np.array(matrix)
@property @property
@cache @cache
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment