Skip to content

Commit

Permalink
Set jacobian of Fun to ZeroOperator (#909)
Browse files Browse the repository at this point in the history
* jacobian of Fun is ZeroOperator

* Decrease maxiterations for independent variable newton test
  • Loading branch information
LucasAschenbach authored Aug 28, 2023
1 parent 74b6fe0 commit 615ad03
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Extras/autodifferentiation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ last(d::DualFun) = DualFun(last(d.f),Evaluation(rangespace(d.J),rightendpoint)*d

jacobian(d::DualFun) = d.J
jacobian(a::Number) = zero(a)
jacobian(f::Fun) = Operator(I,space(f))
jacobian(f::Fun) = zero(Operator(I,space(f)))

promote_rule(::Type{DF},::Type{T}) where {DF<:DualFun,T<:Number}=DualFun
convert(::Type{DualFun},b::Number) = DualFun(b,0)
Expand Down
3 changes: 1 addition & 2 deletions test/ExtrasTest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ include(joinpath(@__DIR__, "testutils.jl"))
u2' - u2*u2;
]

# note takes a few more iterations to converge to accuracy
u1,u2 = newton(N_ind, [u1,u2], maxiterations=25)
u1,u2 = newton(N_ind, [u1,u2])

u1_exact = -1 / (x - 2)
u2_exact = -1 / (x + 2)
Expand Down

0 comments on commit 615ad03

Please sign in to comment.