Skip to content

Commit

Permalink
Generic _axpy!
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Oct 24, 2023
1 parent 30f7873 commit 02cf007
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/broyden.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function perform_step!(cache::GeneralBroydenCache{true})

mul!(_vec(du), J⁻¹, -_vec(fu))
α = perform_linesearch!(cache.lscache, u, du)
axpy!(α, du, u)
_axpy!(α, du, u)
f(fu2, u, p)

Check warning on line 82 in src/broyden.jl

View check run for this annotation

Codecov / codecov/patch

src/broyden.jl#L79-L82

Added lines #L79 - L82 were not covered by tests

cache.internalnorm(fu2) < cache.abstol && (cache.force_stop = true)
Expand Down
2 changes: 1 addition & 1 deletion src/klement.jl
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function perform_step!(cache::GeneralKlementCache{true})

# Line Search
α = perform_linesearch!(cache.lscache, u, du)
axpy!(α, du, u)
_axpy!(α, du, u)
f(cache.fu2, u, p)

Check warning on line 119 in src/klement.jl

View check run for this annotation

Codecov / codecov/patch

src/klement.jl#L117-L119

Added lines #L117 - L119 were not covered by tests

cache.internalnorm(cache.fu2) < cache.abstol && (cache.force_stop = true)
Expand Down
2 changes: 1 addition & 1 deletion src/lbroyden.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function perform_step!(cache::LimitedMemoryBroydenCache{true})
T = eltype(u)

Check warning on line 93 in src/lbroyden.jl

View check run for this annotation

Codecov / codecov/patch

src/lbroyden.jl#L91-L93

Added lines #L91 - L93 were not covered by tests

α = perform_linesearch!(cache.lscache, u, du)
axpy!(α, du, u)
_axpy!(α, du, u)
f(cache.fu2, u, p)

Check warning on line 97 in src/lbroyden.jl

View check run for this annotation

Codecov / codecov/patch

src/lbroyden.jl#L95-L97

Added lines #L95 - L97 were not covered by tests

cache.internalnorm(cache.fu2) < cache.abstol && (cache.force_stop = true)
Expand Down
2 changes: 1 addition & 1 deletion src/raphson.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function perform_step!(cache::NewtonRaphsonCache{true})

# Line Search
α = perform_linesearch!(cache.lscache, u, du)
axpy!(-α, du, u)
_axpy!(-α, du, u)

Check warning on line 100 in src/raphson.jl

View check run for this annotation

Codecov / codecov/patch

src/raphson.jl#L100

Added line #L100 was not covered by tests
f(cache.fu1, u, p)

cache.internalnorm(fu1) < cache.abstol && (cache.force_stop = true)
Expand Down
5 changes: 5 additions & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,11 @@ _try_factorize_and_check_singular!(::Nothing, x) = _issingular(x), false
_reshape(x, args...) = reshape(x, args...)
_reshape(x::Number, args...) = x

Check warning on line 261 in src/utils.jl

View check run for this annotation

Codecov / codecov/patch

src/utils.jl#L260-L261

Added lines #L260 - L261 were not covered by tests

@generated function _axpy!(α, x, y)
hasmethod(axpy!, Tuple{typeof(α), typeof(x), typeof(y)}) && return :(axpy!(α, x, y))
return :(y .= α * x)

Check warning on line 265 in src/utils.jl

View check run for this annotation

Codecov / codecov/patch

src/utils.jl#L263-L265

Added lines #L263 - L265 were not covered by tests
end

# Needs Square Matrix
"""
needs_square_A(alg)
Expand Down

0 comments on commit 02cf007

Please sign in to comment.