Skip to content

Conversation

@ChrisRackauckas-Claude
Copy link

Summary

This PR adds resize! methods for DiffCache and FixedSizeDiffCache structs to fix resize! operations in downstream packages like Trixi.jl.

Fixes the error seen in https://github.com/trixi-framework/Trixi.jl/actions/runs/16993514504/job/48178504581?pr=2522#step:7:2026

Changes

  • Added Base.resize! methods for both DiffCache and FixedSizeDiffCache
  • The methods resize the internal arrays (du, dual_du, any_du) appropriately
  • Only resizes vector arrays (throws informative error for non-vectors since resize! doesn't work on matrices)
  • Added ForwardDiff to weakdeps in Project.toml (was missing from weakdeps but was in extensions)

Test plan

  • Added comprehensive tests for resize! functionality in test/core_resizing.jl
  • Tests verify resizing to both larger and smaller sizes
  • Tests confirm the method returns the cache object itself
  • Code formatted with JuliaFormatter using SciMLStyle

🤖 Generated with Claude Code

This commit adds resize! methods for DiffCache and FixedSizeDiffCache structs
to fix resize! operations in downstream packages like Trixi.jl. The implementation
resizes the internal arrays (du, dual_du, any_du) appropriately, with proper
handling for vector vs non-vector arrays.

- Added Base.resize! methods for both DiffCache and FixedSizeDiffCache
- Only resizes vector arrays (throws error for non-vectors since resize! doesn't work on matrices)
- Added ForwardDiff to weakdeps in Project.toml (was missing)
- Added comprehensive tests for resize! functionality
- Formatted code with JuliaFormatter using SciMLStyle

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@ChrisRackauckas ChrisRackauckas merged commit 3eb3884 into SciML:master Aug 15, 2025
11 of 15 checks passed
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.

2 participants