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

Drop first arg for OOP update_coefficients #202

Open
gaurav-arya opened this issue Jun 11, 2023 · 4 comments · May be fixed by #206
Open

Drop first arg for OOP update_coefficients #202

gaurav-arya opened this issue Jun 11, 2023 · 4 comments · May be fixed by #206

Comments

@gaurav-arya
Copy link
Member

For OOP update coefficients, perhaps the first argument (e.g matrix for MatrixOperator) should not be part of the signature since it isn't overwritten and its old values are not relevant.

@ChrisRackauckas
Copy link
Member

Yes it probably shouldn't be there.

@vpuri3
Copy link
Member

vpuri3 commented Jun 11, 2023

yeah i agree. Then we can simplify the API from MatrixOp(A; update_func = .., update_func! = ..), to just having one kwarg MatrixOp(A; update_func = ..), where update_func can have a (u, p, t), and a (A, u, p, t) method.

@vpuri3
Copy link
Member

vpuri3 commented Jun 11, 2023

Also, I'd like to remove u dependence in update_coefficients/update_func for the reason below.

https://github.com/SciML/SciMLOperators.jl/blob/master/src/interface.jl#L42-L54

It leads to unsafe behaviour that we have no way to protect against. Removing u from update_coeffs won't lead to any depletion in use cases as u is still available at operator evaluation time.

# OOP signature
L = update_coefficients(L, p, t; kw...)
L(u, p, t)

@ChrisRackauckas
Copy link
Member

ChrisRackauckas commented Jun 11, 2023

It's very useful for defining operators used in Magnus methods though, i.e. u' = A(u)*u operations. See https://docs.sciml.ai/DiffEqDocs/stable/solvers/nonautonomous_linear_ode/#State-Dependent-Solvers . Also Jacobian-vector products and Vector-Jacobian products. This comes up in exponential Rosenbrock methods because you want to split u' = f into u' = f'u + g where g = f - f'u, and f' needs to be u-dependent. So I think it's generally a requirement to be able to have operators that are u-dependent. But I cannot see a case where a past immutable operator is used, and the update_coefficients! would only have the old operator representation to mutate it.

@vpuri3 vpuri3 linked a pull request Jun 18, 2023 that will close this issue
3 tasks
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 a pull request may close this issue.

3 participants