Skip to content

Explicitly assemble the interpolate adjoint matrix#4576

Merged
pbrubeck merged 16 commits intomainfrom
pbrubeck/interp-adjoint-explicit
Sep 30, 2025
Merged

Explicitly assemble the interpolate adjoint matrix#4576
pbrubeck merged 16 commits intomainfrom
pbrubeck/interp-adjoint-explicit

Conversation

@pbrubeck
Copy link
Contributor

@pbrubeck pbrubeck commented Sep 19, 2025

Description

Enables code generation for all possible argument combinations in Interpolate:

  1. Forward 2-form: Interpolate(Argument(1), Coargument(0))
  2. Adjoint 2-form: Interpolate(Argument(0), Coargument(1))
  3. Forward 1-form: Interpolate({Function | Expr}, Coargument(0))
  4. Adjoint 1-form: Interpolate(Argument(0), Cofunction)
  5. 0-form: Interpolate({Function | Expr}, Cofunction)

Previously we indirectly obtained 2 and 4 from the transpose of 1, and 5 via a dot product involving 3.

The big win is that code generation does not deal with these 5 cases as special cases, and we always do matrix-free computations (unless a 2-form is explicitly requested).

Depends on #4552 which mainly addresses 4 and 5.

@pbrubeck pbrubeck force-pushed the pbrubeck/interp-adjoint-explicit branch 6 times, most recently from 0a4ed77 to f82b140 Compare September 21, 2025 16:33
Copy link
Contributor

@connorjward connorjward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please can you provide more detail in the PR descriptions for this and #4552? I don't know why these changes need to be made.

@pbrubeck pbrubeck force-pushed the pbrubeck/interp-adjoint-explicit branch 2 times, most recently from 2f4554a to ea997ea Compare September 24, 2025 18:18
Copy link
Contributor

@connorjward connorjward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is really close now. Definitely much much happier with this. You have deleted a lot of complicated code and replaced it with things that I can actually understand!

dham
dham previously approved these changes Sep 30, 2025
Base automatically changed from pbrubeck/interp-adjoint to main September 30, 2025 18:42
@pbrubeck pbrubeck dismissed dham’s stale review September 30, 2025 18:42

The base branch was changed.

@pbrubeck pbrubeck enabled auto-merge (squash) September 30, 2025 18:42
@pbrubeck pbrubeck disabled auto-merge September 30, 2025 20:34
@pbrubeck pbrubeck closed this Sep 30, 2025
@pbrubeck pbrubeck force-pushed the pbrubeck/interp-adjoint-explicit branch from 8d631f8 to 210bae0 Compare September 30, 2025 20:55
@pbrubeck pbrubeck mentioned this pull request Sep 30, 2025
@pbrubeck pbrubeck reopened this Sep 30, 2025
@pbrubeck pbrubeck enabled auto-merge (squash) September 30, 2025 22:07
@pbrubeck pbrubeck disabled auto-merge September 30, 2025 23:10
@pbrubeck pbrubeck merged commit 61ff76a into main Sep 30, 2025
7 of 14 checks passed
@pbrubeck pbrubeck deleted the pbrubeck/interp-adjoint-explicit branch September 30, 2025 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants