Skip to content

Commit

Permalink
Merge pull request #54 from firedrakeproject/pbrubeck/simplify-lagrange
Browse files Browse the repository at this point in the history
Simplify LagrangeLineExpansionSet symbolic derivative tabulation
  • Loading branch information
ReubenHill authored Nov 22, 2023
2 parents d571bcc + 1b2c89c commit f6287d4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions FIAT/barycentric_interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,18 @@ def tabulate(self, n, pts):
results[results != results] = 1.0
if results.dtype == object:
from sympy import simplify
results = numpy.array(list(map(simplify, results)))
results = numpy.vectorize(simplify)(results)
return results

def _tabulate(self, n, pts, order=0):
results = [self.tabulate(n, pts)]
vals = self.tabulate(n, pts)
results = [vals]
for r in range(order):
results.append(numpy.dot(self.dmat, results[-1]))
vals = numpy.dot(self.dmat, vals)
if vals.dtype == object:
from sympy import simplify
vals = numpy.vectorize(simplify)(vals)
results.append(vals)
for r in range(order+1):
shape = results[r].shape
shape = shape[:1] + (1,)*r + shape[1:]
Expand Down

0 comments on commit f6287d4

Please sign in to comment.