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

support kwargs in update_coefficients! #87

Closed
vpuri3 opened this issue Jul 18, 2022 · 2 comments
Closed

support kwargs in update_coefficients! #87

vpuri3 opened this issue Jul 18, 2022 · 2 comments

Comments

@vpuri3
Copy link
Member

vpuri3 commented Jul 18, 2022

CalculustJL/CalculustCore.jl#26

@ChrisRackauckas
Copy link
Member

That wouldn't be possible, because nothing could pass kwargs 😅

@vpuri3
Copy link
Member Author

vpuri3 commented Jul 18, 2022

i dont follow. would the following not work?

update_coefficients!(L, u, p, t; kwargs...) = nothing
DEFAULT_UPDATE_FUNC(A, u, p, t; kwargs...) = A
function update_coefficients!(L::AbstractSciMLOperator, u, p, t; kwargs...)
    for op in getops(L)
        update_coefficients!(op, u, p, t; kawgs...)
    end
    nothing
end
struct MatrixOperator{T,AType<:AbstractMatrix{T},F} <: AbstractSciMLLinearOperator{T}
    A::AType
    update_func::F
    MatrixOperator(A::AType; update_func=DEFAULT_UPDATE_FUNC) where{AType} =
        new{eltype(A),AType,typeof(update_func)}(A, update_func)
end

update_coefficients!(L::MatrixOperator,u,p,t;kwargs...) = (L.update_func(L.A,u,p,t;kwargs...); nothing)
M = MatrixOperator(zeros(N,N); update_func=(A,u,p,t;val=ones(N,N)) -> copy!(A, val))

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

2 participants