Skip to content

Commit

Permalink
fix a few issues raised by dr. louboutin
Browse files Browse the repository at this point in the history
  • Loading branch information
ziyiyin97 committed Jan 6, 2023
1 parent 8594806 commit 6c693a2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/TimeModeling/LinearOperators/lazy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ end
size(jA::jAdjoint) = (jA.op.n, jA.op.m)
display(P::jAdjoint) = println("Adjoint($(P.op))")
display(P::judiProjection{D}) where D = println("JUDI projection operator $(repr(P.n)) -> $(repr(P.m))")
display(P::judiWavelet{T}) where T = println("JUDI wavelet injected at every grid point")
display(P::judiWavelet{T}) where T = println("JUDI wavelet")

############################################################################################################################
# Indexing
Expand Down
5 changes: 2 additions & 3 deletions src/rrules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ function eval_prop(F::LazyPropagation)
return F.post(F.val)
end
Base.collect(F::LazyPropagation) = eval_prop(F)
LazyPropagation(post, F::judiPropagator, q) = LazyPropagation(post, F, q, nothing)
LazyPropagation(F::judiPropagator, q) = LazyPropagation(identity, F, q)
LazyPropagation(post::Function, F::judiPropagator, q) = LazyPropagation(post, F, q, nothing)
LazyPropagation(F::judiPropagator, q) = LazyPropagation(identity, F, q, nothing)

# Only a few arithmetic operation are supported

Expand Down Expand Up @@ -78,7 +78,6 @@ dot(x::AbstractArray, F::LazyPropagation) = dot(x, eval_prop(F))
dot(F::LazyPropagation, x::AbstractArray) = dot(x, F)
norm(F::LazyPropagation, p::Real=2) = norm(eval_prop(F), p)
adjoint(F::JUDI.LazyPropagation) = F
length(F::JUDI.LazyPropagation) = size(F.F, 1)

############################ Two params rules ############################################
function rrule(F::judiPropagator{T, O}, m::AbstractArray{T}, q::AbstractArray{T}) where {T, O}
Expand Down
2 changes: 1 addition & 1 deletion test/test_rrules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ perturb(x::judiVector) = judiVector(x.geometry, [randx(x.data[i]) for i=1:x.nsrc
reverse(x::judiVector) = judiVector(x.geometry, [x.data[i][end:-1:1, :] for i=1:x.nsrc])

misfit_objective_2p(d_obs, q0, m0, F) = .5f0*norm(F(m0, q0) - d_obs)^2
misfit_objective_1p(d_obs, q0, m0, F) = .5f0*norm(F(1f0*m0)*q0 - d_obs)^2
misfit_objective_1p(d_obs, q0, m0, F) = .5f0*norm(F(1f0.*m0)*q0 - d_obs)^2

function loss(misfit, d_obs, q0, m0, F)
local ϕ
Expand Down

0 comments on commit 6c693a2

Please sign in to comment.