Tabulate high-order expansion derivatives by recurrence#256
Conversation
|
Updated verification after the HCT degree-14 follow-up. What changed:
Verification:
AI tool used: Codex. |
| return pts | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("degree, space_dimension", [(13, 127), (14, 144)]) |
There was a problem hiding this comment.
These are rather expensive tests, maybe we don't want them
There was a problem hiding this comment.
We could use a lower-degree version of the tests? But are they causing any problems in run-time on the test suite?
| @@ -95,7 +142,7 @@ def dubiner_recurrence(dim, n, order, ref_pts, Jinv, scale, variant=None): | |||
| results = [numpy.zeros((num_members,) + (dim,)*k + phi0.shape[1:], dtype=phi0.dtype) | |||
There was a problem hiding this comment.
Storage blows up for large k, we need to exploit symmetry
There was a problem hiding this comment.
Didn't we already have that problem? Or is this intermediate storage as a result of doing Leibniz instead of hand-coding?
There was a problem hiding this comment.
We only ran recurrences for k<=2
| ddphi[inext] += fprev * ddphi[iprev] | ||
| cur = [result[icur] for result in results] | ||
| prev = [result[iprev] for result in results] | ||
| for rank in range(1, order+1): |
There was a problem hiding this comment.
We should only take the k-th derivative if the polynomial degree >= k
There was a problem hiding this comment.
We know the answer for degree < k without computing.
rckirby
left a comment
There was a problem hiding this comment.
After we resolve the comments, I think this makes sense to do. The derivative matrices are kind of clunky and tend to go unstable at high order.
| @@ -95,7 +142,7 @@ def dubiner_recurrence(dim, n, order, ref_pts, Jinv, scale, variant=None): | |||
| results = [numpy.zeros((num_members,) + (dim,)*k + phi0.shape[1:], dtype=phi0.dtype) | |||
There was a problem hiding this comment.
Didn't we already have that problem? Or is this intermediate storage as a result of doing Leibniz instead of hand-coding?
| for axis in range(rank)) | ||
| product = product.transpose(permutation + tuple(range(rank, product.ndim))) | ||
| product = product.reshape((dim,) * rank + operand.shape[operand_rank:]) | ||
|
|
There was a problem hiding this comment.
What if not rank? Do we handle None being returned correctly?
| ddphi[inext] += fprev * ddphi[iprev] | ||
| cur = [result[icur] for result in results] | ||
| prev = [result[iprev] for result in results] | ||
| for rank in range(1, order+1): |
There was a problem hiding this comment.
We know the answer for degree < k without computing.
| return sum(ai != bi for ai, bi in zip(alpha, beta)) | ||
|
|
||
| # Only use dmats if tabulate failed | ||
| # Use dmats only for derivatives above the configured recurrence order. |
There was a problem hiding this comment.
Do we have cases (outside of tests) where recurrence_order isn't infinite?
| return pts | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("degree, space_dimension", [(13, 127), (14, 144)]) |
There was a problem hiding this comment.
We could use a lower-degree version of the tests? But are they causing any problems in run-time on the test suite?
Fixes firedrakeproject/firedrake#4152
Summary
Tests
AI tool used: Codex.