Repository navigation
Conversation
SamplingOp now returns a SamplingOpImpl wrapper that keeps the wrapped operator, the effective pattern, and the shape. Adapt and copy rebuild the operator from the effective pattern: integer indices are copied and stay on the host, the Boolean mask is copied to the target backend. The 5-arg adjoint product of the integer mode is marked broken in the tests: LinearOperators' opRestriction transpose kernel ignores α and β. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #47 +/- ##
==========================================
+ Coverage 73.01% 75.45% +2.43%
==========================================
Files 15 15
Lines 593 607 +14
==========================================
+ Hits 433 458 +25
+ Misses 160 149 -11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR fixes
SamplingOpreturns a plainLinearOperatorin both of its modes, soAdapt.adapt(target, op)cannot move it to another storage backend: the index pattern and the Boolean mask are only captured inside the operator's closures, and the image shape is not kept. This matters for MRI-style encodings such asSamplingOp ∘ FFTOp, where the FFT side can already be adapted.How it fixes it
SamplingOpnow returns aSamplingOpImpl <: SamplingOp{T}that wraps the existing operator and keeps the effective pattern and the shape. The numerical kernels, the public constructor,createLinearOperator, and the supported modes are unchanged. Properties are forwarded to the wrapped operator, as forWeightingOp.shape: the stored pattern is the vectorized index vector, or the caller's vector itself for a one-dimensional pattern, as before.Sthat the operator already used.Adapt.adapt_structureandcopyrebuild the operator throughSamplingOpfrom the stored pattern. Integer indices are copied and stay on the host, as the restriction already supports. The mask is copied to the target backend. Unsupported or abstract targets raiseArgumentErrorthrough the shared target check.Adapt.adapt.Validation
Julia 1.10 package test suite: 1430 passed, 5 explicitly broken (single-threaded; with two threads the existing
DiagOp((op, op))FFTOp race in #44 also fails). New tests cover both modes withFloat32andComplexF32forArrayandJLArraytargets: target storage and mask placement, CPU → target, same-backend and round-trip reconstruction, source isolation (caller inputs, source pattern, and initialized workspaces),copy, the factory entry point, andSamplingOp ∘ FFTOpwith its adjoint.Four broken cases are the 5-argument adjoint
mul!of the integer mode.opRestrictionin LinearOperators.jl ignoresαandβin its kernels (JuliaSmoothOptimizers/LinearOperators.jl#430), so that product neither scales nor accumulates. This predates the change and is left as is here. The remaining broken case is the existing NonuniformFFTs + JLArray gap.GPU CI results will be reported separately. No Metal lane is claimed.