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

Lazy W operator support #443

Merged
merged 43 commits into from
Jul 29, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
71147ee
`WOperator` and test
MSeeker1340 Jul 19, 2018
42ce8c5
Merge remote-tracking branch 'origin/master' into lazy-W
MSeeker1340 Jul 20, 2018
a4addeb
Adjust position for `WOperator`
MSeeker1340 Jul 20, 2018
197fc40
Update `calc_W!` for constant cache
MSeeker1340 Jul 20, 2018
1a1f5ad
Scalar `WOperator` compatibility
MSeeker1340 Jul 20, 2018
2f17963
Mass matrix for finite differece `calc_W!`
MSeeker1340 Jul 20, 2018
df84f70
Fix non-scalar adaptive `ImplicitEuler`
MSeeker1340 Jul 20, 2018
c57604b
Merge remote-tracking branch 'origin/master' into lazy-W
MSeeker1340 Jul 20, 2018
9f40d55
Support transformed W
MSeeker1340 Jul 20, 2018
66c62aa
Merge remote-tracking branch 'origin/master' into lazy-W
MSeeker1340 Jul 20, 2018
2c5850e
Merge remote-tracking branch 'origin/master' into lazy-W
MSeeker1340 Jul 22, 2018
f7e425e
Add constructor with uninitiated `mass_matrix`
MSeeker1340 Jul 22, 2018
4bd3617
Add `WOperator` support to in-place `calc_W!`
MSeeker1340 Jul 22, 2018
bb185eb
Update `J` and `W` allocation for `ImplicitEulerCache`
MSeeker1340 Jul 22, 2018
d175f9b
Use `mass_matrix` from `ODEFunction`
MSeeker1340 Jul 24, 2018
7b7a1cd
Merge remote-tracking branch 'origin/master' into lazy-W
MSeeker1340 Jul 24, 2018
08f460d
Merge remote-tracking branch 'origin/master' into lazy-W
MSeeker1340 Jul 25, 2018
54b9029
Safer lazy W predicate
MSeeker1340 Jul 25, 2018
fcc937f
Non-allocating `convert` method
MSeeker1340 Jul 25, 2018
9fe4202
Use lazy cache for `mul!`
MSeeker1340 Jul 25, 2018
e6f639c
Bugfix
MSeeker1340 Jul 26, 2018
5cedc29
Remove `lazy_W` and always use `WOperator`
MSeeker1340 Jul 26, 2018
bf600ea
Constructor using `f`
MSeeker1340 Jul 26, 2018
c48a0de
W_transform consistency
MSeeker1340 Jul 26, 2018
7983293
Update test script
MSeeker1340 Jul 26, 2018
21b1a5b
Improve handling of out-of-place jacobian
MSeeker1340 Jul 26, 2018
be258f8
Merge remote-tracking branch 'origin/master' into lazy-W
MSeeker1340 Jul 28, 2018
66a38fb
Update sdirk methods
MSeeker1340 Jul 28, 2018
f01872d
Update ABM methods
MSeeker1340 Jul 28, 2018
e3c1505
Update bdf methods
MSeeker1340 Jul 28, 2018
3f8cefe
Update EulerIMEX
MSeeker1340 Jul 28, 2018
c4437ea
Update Kencarp Kvaerno methods
MSeeker1340 Jul 28, 2018
1eba5e9
Update Rosenbrock methods
MSeeker1340 Jul 28, 2018
b8ae169
Add back concrete W for functions without `jac`
MSeeker1340 Jul 29, 2018
e0eea48
Bugfix
MSeeker1340 Jul 29, 2018
72cde28
Fix invW
MSeeker1340 Jul 29, 2018
80d072b
Fix differentiation traits tests
MSeeker1340 Jul 29, 2018
87e174d
Fix test scripts
MSeeker1340 Jul 29, 2018
90f377b
Address `jac_prototype=nothing` case
MSeeker1340 Jul 29, 2018
e2beccb
Merge remote-tracking branch 'origin/master' into lazy-W
MSeeker1340 Jul 29, 2018
b520fe0
Integration test
MSeeker1340 Jul 29, 2018
c1e53da
Update REQUIRE
ChrisRackauckas Jul 29, 2018
284fa70
Update utility_tests.jl
ChrisRackauckas Jul 29, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/caches/sdirk_caches.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function alg_cache(alg::ImplicitEuler,u,rate_prototype,uEltypeNoUnits,uBottomElt
if DiffEqBase.has_jac(f)
J = deepcopy(f.jac_prototype)
if isa(J, DiffEqBase.AbstractDiffEqLinearOperator)
W = WOperator(dt, J)
W = WOperator(f.mass_matrix, dt, J)
else
W = similar(J)
end
Expand Down
16 changes: 2 additions & 14 deletions src/derivative_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ internal cache (can be specified in the constructor; default to regular `Vector`
It supports all of `AbstractDiffEqLinearOperator`'s interface.
"""
mutable struct WOperator{T,
MType,
MType <: Union{UniformScaling,AbstractMatrix},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

diffeqoperators are <: AbstractMatrix?

GType <: Real,
JType <: DiffEqBase.AbstractDiffEqLinearOperator{T},
CType <: AbstractVector
Expand All @@ -100,15 +100,6 @@ mutable struct WOperator{T,
end
new{T,typeof(mass_matrix),typeof(gamma),typeof(J),typeof(cache)}(mass_matrix,gamma,J,cache,transform)
end
# Partial constructor with unitialized mass matrix
function WOperator(gamma, J; cache=nothing, transform=false)
T = eltype(J)
# Construct the cache, default to regular vector
if cache == nothing
cache = Vector{T}(undef, size(J, 1))
end
new{T,Any,typeof(gamma),typeof(J),typeof(cache)}(nothing,gamma,J,cache,transform)
end
end
set_gamma!(W::WOperator, gamma) = (W.gamma = gamma; W)
DiffEqBase.update_coefficients!(W::WOperator,u,p,t) = (update_coefficients!(W.J,u,p,t); W)
Expand Down Expand Up @@ -214,10 +205,7 @@ function calc_W!(integrator, cache::OrdinaryDiffEqMutableCache, dtgamma, repeat_
abs(dt - (t-integrator.tprev)) > 100eps(typeof(integrator.t))))
if DiffEqBase.has_jac(f) && isa(f.jac_prototype, DiffEqBase.AbstractDiffEqLinearOperator)
set_gamma!(W, dtgamma)
## Reset mass matrix and W_transform
## This is a temporary hack, and should not be required after the *DEFunction update
W.mass_matrix = mass_matrix
W.transform = W_transform
# W.transform = W_transform # necessary?
else # compute W as a dense matrix
if W_transform
for j in 1:length(u), i in 1:length(u)
Expand Down