Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is input arrays for the JacobianCache constructor supposed to alias sometimes? #45

Closed
pkofod opened this issue Feb 11, 2019 · 4 comments

Comments

@pkofod
Copy link
Contributor

pkofod commented Feb 11, 2019

In this constructor https://github.com/JuliaDiffEq/DiffEqDiffTools.jl/blob/4c51240b7576327f09710ff6ace5db044ca4cfdc/src/jacobians.jl#L58 fx1 is aliased, but generally it seems that input is only used to construct new arrays. So if you input and x or fx, it'll generally be used in the context of similar(x), or fill(..., size(fx1)). I'm just wondering if this is intentional (you might use fx1, the forward evaluated vector somewhere) or not.

@dextorious
Copy link
Contributor

I think the idea was that we might want to alias it somewhere but never actually got to needing to do that. It's been a while, so I don't have a firm recollection of the exact reasoning I had at the time, but it wasn't random at the time.

@ChrisRackauckas
Copy link
Member

I think the idea was that we might want to alias it somewhere but never actually got to needing to do that

DiffEq uses it.

@pkofod
Copy link
Contributor Author

pkofod commented Feb 12, 2019

I was thinking about changing this in NLSolversBase, so the constructors actually use the exact arrays you use to initialize the objective types. You could then turn it off with a copy_input kwarg

@ChrisRackauckas
Copy link
Member

Closing because it is indeed intentional. You can build the cache using pre-existing arrays, and the cache is sized so that the largest cache methods (central differencing) don't need to allocate during the runs.

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

No branches or pull requests

3 participants