Skip to content

Fix derivatives w.r.t. structured matrices and require DiffTests 0.1.3 - #297

Merged
devmotion merged 3 commits into
masterfrom
dependabot/julia/all-julia-packages-7d5704c315
Sep 23, 2026
Merged

devmotion merged 3 commits into
masterfrom
dependabot/julia/all-julia-packages-7d5704c315

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

DiffTests 0.1.3 (JuliaDiff/DiffTests.jl#15, fixes JuliaDiff/DiffTests.jl#13) makes its new *_lmul/*_ldiv test functions work with TrackedArrays. They exposed that the reverse pass of * wrote the full product into the derivative buffer of a Diagonal/triangular factor, which errors. Now only the structural entries are stored.

Products of Diagonal/triangular matrices and tracked arrays were ambiguous with LinearAlgebra's methods: all combinations on Julia 1.10, and Diagonal * TrackedVector on later versions. Disambiguating methods are added.

The reverse_mul! rules for Transpose/Adjoint arguments are removed. Only wrapped vectors reach the tape (other wrapped arrays are materialized when recorded), and the generic rule handles them. Three of these rules gave wrong derivatives or errored for row vectors, and the others were unreachable.

Fixes #223.

🤖 Generated with Claude Code

@dependabot dependabot Bot added dependencies Pull requests that update a dependency file julia Pull requests that update julia code labels Sep 17, 2026
@devmotion
devmotion marked this pull request as draft September 17, 2026 13:04
@devmotion

Copy link
Copy Markdown
Member

Most of it is not relevant and due to a dependabot bug that will be fixed by dependabot/dependabot-core#16315

@dependabot dependabot Bot changed the title Bump the all-julia-packages group across 1 directory with 5 updates Update DiffTests requirement from < 0.1.2 to < 0.1.2, 0.1 in the all-julia-packages group across 1 directory Sep 18, 2026
@dependabot
dependabot Bot force-pushed the dependabot/julia/all-julia-packages-7d5704c315 branch 2 times, most recently from f26b19f to f9e4154 Compare September 21, 2026 07:27
Updates the requirements on [DiffTests](https://github.com/JuliaDiff/DiffTests.jl) to permit the latest version.

Updates `DiffTests` to 0.1.2
- [Release notes](https://github.com/JuliaDiff/DiffTests.jl/releases)
- [Commits](https://github.com/JuliaDiff/DiffTests.jl/commits)

---
updated-dependencies:
- dependency-name: DiffTests
  dependency-version: 0.1.2
  dependency-type: direct:production
  dependency-group: all-julia-packages
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot
dependabot Bot force-pushed the dependabot/julia/all-julia-packages-7d5704c315 branch from f9e4154 to 3ecc294 Compare September 23, 2026 07:25
DiffTests 0.1.3 (JuliaDiff/DiffTests.jl#15, fixes JuliaDiff/DiffTests.jl#13)
makes its `*_lmul`/`*_ldiv` test functions accept `TrackedArray`s. They
exposed that the reverse pass of `*` wrote the full product into the
`Diagonal`/triangular derivative buffer of a structured factor, which errors.
Only the structural entries are stored now.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@devmotion devmotion changed the title Update DiffTests requirement from < 0.1.2 to < 0.1.2, 0.1 in the all-julia-packages group across 1 directory Fix derivatives w.r.t. structured matrices and require DiffTests 0.1.3 Sep 23, 2026
@devmotion
devmotion marked this pull request as ready for review September 23, 2026 10:41
@codecov

codecov Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.21%. Comparing base (55159d7) to head (c6fdf6d).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #297      +/-   ##
==========================================
+ Coverage   86.93%   88.21%   +1.27%     
==========================================
  Files          19       19              
  Lines        1952     1934      -18     
==========================================
+ Hits         1697     1706       +9     
+ Misses        255      228      -27     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Add `*` methods for `Diagonal` and triangular matrices times tracked
  arrays to resolve ambiguities with LinearAlgebra (all combinations on
  Julia 1.10, `Diagonal * TrackedVector` on later versions).
- Remove the `reverse_mul!` rules for `Transpose`/`Adjoint` arguments.
  Only wrapped vectors reach the tape (`capture` materializes other
  wrapped arrays), and the generic rule handles them. Three of these
  rules gave wrong derivatives or errored for row vectors, and the others
  were unreachable.
- Remove the unreachable size check in `structured_mul!(::Diagonal, ...)`.
- Test constant structured factors, products with row vectors, and
  `DiffTests.VECTOR_TO_VECTOR_FUNCS`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@devmotion
devmotion merged commit 92f263c into master Sep 23, 2026
8 checks passed
@dependabot
dependabot Bot deleted the dependabot/julia/all-julia-packages-7d5704c315 branch September 23, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file julia Pull requests that update julia code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MethodError: *(::Diagonal, ::ReverseDiff.TrackedArray) is ambiguous. DiffTests 0.1.2 broke ReverseDiff tests

1 participant