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

[later] pair fwd and bwd operators #84

Closed
vpuri3 opened this issue Jul 7, 2022 · 4 comments · Fixed by #179
Closed

[later] pair fwd and bwd operators #84

vpuri3 opened this issue Jul 7, 2022 · 4 comments · Fixed by #179

Comments

@vpuri3
Copy link
Member

vpuri3 commented Jul 7, 2022

If you have access to a cheap inverse for an operator, A, then it would be very convenient to use that for LinearAlgebra.ldiv!, Base.\.

Trivial example: ldiv! with diagonal is ~15x slower than mul!.

julia> n=1024;

julia> u=rand(n); v=copy(u); D=Diagonal(copy(u));

julia> @btime mul!($v,$D,$u);
  129.625 ns (0 allocations: 0 bytes)

julia> @btime ldiv!($v,$D,$u);
  2.030 μs (0 allocations: 0 bytes)

This will also be useful for passing jac to SplitFunction. Maybe this could help CliMA/ClimaCore.jl#41 not sure.

I propose extending InvertibleOperator as follows:

struct InvertibleOperator
    A # fwd SciMLOperator
    F # inv
end

where F can be the inverse (SciML)Operator, or any object with 3 arg mul!, * defined.

@vpuri3 vpuri3 changed the title pair fwd and bwd operators [later] pair fwd and bwd operators Jan 30, 2023
@gaurav-arya
Copy link
Member

If we have a cheap inverse of A, we nearly always have a cheap inverse of A + kI, so the design should accomodate that case too

@vpuri3
Copy link
Member Author

vpuri3 commented Mar 18, 2023

we can create a new type for that and Sherman Morrison formula

vpuri3 added a commit to vpuri3/SciMLOperators.jl that referenced this issue May 10, 2023
@vpuri3
Copy link
Member Author

vpuri3 commented May 10, 2023

@gaurav-arya do you wanna create a new issue for #84 (comment) with a design idea?

@gaurav-arya
Copy link
Member

Just did: #180

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.

2 participants