Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit 4e58bc5

Browse files
authored
Merge pull request #109 from avik-pal/ap/patch_nonvec
2 parents ec8a5a4 + adc85cc commit 4e58bc5

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SimpleNonlinearSolve"
22
uuid = "727e6d20-b764-4bd8-a329-72de5adea6c7"
33
authors = ["SciML"]
4-
version = "1.0.2"
4+
version = "1.0.3"
55

66
[deps]
77
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"

src/nlsolve/lbroyden.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ end
6868
d = dot(vᵀ, δf)
6969
@bb @. δx = (δx - mvec) / d
7070

71-
selectdim(U, 2, mod1(i, η)) .= δx
72-
selectdim(Vᵀ, 1, mod1(i, η)) .= vᵀ
71+
selectdim(U, 2, mod1(i, η)) .= _vec(δx)
72+
selectdim(Vᵀ, 1, mod1(i, η)) .= _vec(vᵀ)
7373

7474
_U = selectdim(U, 2, 1:min(η, i))
7575
_Vᵀ = selectdim(Vᵀ, 1, 1:min(η, i))
@@ -93,7 +93,7 @@ function _rmatvec!!(y, xᵀU, U, Vᵀ, x)
9393
x_ = vec(x)
9494
xᵀU_ = view(xᵀU, 1:η)
9595
@bb xᵀU_ = transpose(U) × x_
96-
@bb y = transpose(Vᵀ) × xᵀU_
96+
@bb y = transpose(Vᵀ) × vec(xᵀU_)
9797
@bb @. y -= x
9898
return y
9999
end
@@ -108,7 +108,7 @@ function _matvec!!(y, Vᵀx, U, Vᵀ, x)
108108
x_ = vec(x)
109109
Vᵀx_ = view(Vᵀx, 1:η)
110110
@bb Vᵀx_ = Vᵀ × x_
111-
@bb y = U × Vᵀx_
111+
@bb y = U × vec(Vᵀx_)
112112
@bb @. y -= x
113113
return y
114114
end

test/matrix_resizing_tests.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
using SimpleNonlinearSolve
22

33
ff(u, p) = u .* u .- p
4-
u0 = rand(2, 2)
4+
u0 = ones(2, 3)
55
p = 2.0
66
vecprob = NonlinearProblem(ff, vec(u0), p)
77
prob = NonlinearProblem(ff, u0, p)
88

99
@testset "$(alg)" for alg in (SimpleKlement(), SimpleBroyden(), SimpleNewtonRaphson(),
10-
SimpleDFSane(), SimpleLimitedMemoryBroyden(), SimpleTrustRegion())
10+
SimpleDFSane(), SimpleLimitedMemoryBroyden(; threshold = Val(2)), SimpleTrustRegion())
1111
@test vec(solve(prob, alg).u) solve(vecprob, alg).u
1212
end

0 commit comments

Comments
 (0)