Repository navigation
Support complex filters in Convolve1D adjoints - #817
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
Thanks @antonsoo for this. I would say this is more of an enhancement than a bug per se, as we never really support complex valued filters (no tests or examples with it) mostly because I am not aware of any real application that would benefit from it - although, of course we also don't have any guardrail in place to check for the dtype and raise an error otherwise. Looks like the fix is very minor though, so I am going to have a closer look soon and let you know if I have any comment before merging 😄 |
|
Classifying this as a small support enhancement makes sense. The speech/guitar inverse was a constructed numerical validation; I don't have an existing production PyLops use case for complex filters to point to. I've updated the title and description to make that scope clear. The implementation and real-filter controls are unchanged. |
mrava87
left a comment
There was a problem hiding this comment.
@antonsoo thanks for the contribution. I think adding support for complex-valued filters in Convolved1D is a good enhancement, however quite a few things don't follow the standards in the rest of the library... left comments for you to adjust before I can merge 😄
1c5c666 to
cbd256d
Compare
|
Updated the tests to extend test_Convolve1D_1d with h + 1j*h, both complex precisions, and the existing dot/dtype/inversion checks. The example now repeats the plotted inverse with / and real/imaginary panels; it contains no assertions. I also removed the changelog entry. For the time-domain equation I kept t+tau using the equivalent correlation form h(tau)^* y(t+tau); this preserves the conjugate adjoint of the forward convolution. Rebased on current dev. CPU checks, lint, the example and documentation build pass. The recorded CPU/GPU inverses still agree with independent dense references, with all real-filter controls unchanged. |
Convolve1Dreverses the filter for its adjoint but does not conjugate it. This extends the operator to complex filters: the forward result is already correct, and the added conjugation supplies the corresponding Hermitian adjoint for short and long filters. Complex-filter use was previously unsupported.Conjugate the reversed filter before the existing contiguous copy, preserving the CuPy stride handling from #797. Extend the existing dot-test, dtype and inversion cases to complex64/complex128 with
h + 1j*h, add the conjugation to the adjoint equations, and repeat the plotted example with a complex filter.For example, this adjoint error is about 42.85 on
devand near machine precision with the fix:Validation:
dev. A broader integration run encountered a randomized float32 ChirpRadon dot-test tolerance failure; a 500-seed comparison gives identical results on unmodifieddevand the patched tree, including two failing seeds.The recorded-audio workload is a constructed numerical validation. It does not establish an existing production PyLops use case or demand for complex filters.
AI disclosure: Codex was used to investigate the failure, implement the change, write and run the independent checks, and prepare the documentation and PR text.