JuliaDiff / SparseDiffTools.jl

Fast jacobian computation through sparsity exploitation and matrix coloring
MIT License
237 stars 41 forks source link

Floating point arithmetic 101 - it doesn't add up! aka Don't touch user input without telling them the rules #265

Closed pkofod closed 6 months ago

pkofod commented 8 months ago

For in-place methods my own mental picture is that it's expected that the cache arrays are touched, but that other input is left intact. That's why in-place methods often allow for extra cache variables when things should not allocate at all. However, these lines directly modify the input state, and as a result the parameter can drift simply from evaluations of Hv. If this is intentional, I think it should be documented. https://github.com/JuliaDiff/SparseDiffTools.jl/blob/7b271eddbe4394fb63d10ddeb157be843051bd6b/src/differentiation/jaches_products.jl#L97C4-L101C18