Commit 2bcca7a
Fix copy method for StatefulJacobianOperator with Tuple parameters (#753)
* Fix copy method for StatefulJacobianOperator with Tuple parameters
- Add `_safe_copy` helper functions to handle immutable types (Tuple,
NamedTuple, Number) that don't need copying
- Fix the `Base.copy` method for `StatefulJacobianOperator` to use
`_safe_copy(J.p)` instead of `applicable(copy, J.p) ? copy(J.p) : J.p`
which fails for Tuple types
- Fix typo: `nohting` -> `nothing` in `JacobianOperator.copy`
This fixes the JFNK (Jacobian-Free Newton-Krylov) example from the
documentation which was failing with:
MethodError: no method matching copy(::NTuple{4, Float64})
Fixes #752
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>
* Add regression test for issue #752 and fix stale ForwardDiff dependency
- Add regression test for copy(StatefulJacobianOperator) with Tuple and
NamedTuple parameters to prevent future regressions
- Test the _safe_copy helper functions for Tuple, NamedTuple, Number,
and Array types
- Remove ForwardDiff from main deps (it's only needed for tests, already
in extras)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>
---------
Co-authored-by: ChrisRackauckas <[email protected]>
Co-authored-by: Claude Opus 4.5 <[email protected]>1 parent 22728ed commit 2bcca7a
File tree
3 files changed
+104
-6
lines changed- lib/SciMLJacobianOperators
- src
- test
3 files changed
+104
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
404 | 404 | | |
405 | 405 | | |
406 | 406 | | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
407 | 415 | | |
408 | | - | |
| 416 | + | |
409 | 417 | | |
410 | 418 | | |
411 | 419 | | |
412 | 420 | | |
413 | 421 | | |
414 | | - | |
| 422 | + | |
415 | 423 | | |
416 | 424 | | |
417 | 425 | | |
418 | 426 | | |
419 | 427 | | |
420 | 428 | | |
421 | 429 | | |
422 | | - | |
| 430 | + | |
423 | 431 | | |
424 | 432 | | |
425 | 433 | | |
| |||
429 | 437 | | |
430 | 438 | | |
431 | 439 | | |
432 | | - | |
433 | 440 | | |
434 | 441 | | |
435 | | - | |
436 | 442 | | |
437 | 443 | | |
438 | 444 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
0 commit comments