Skip to content

Commit 831dacc

Browse files
committed
Test non-vector inputs
1 parent 6604ea6 commit 831dacc

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/speedmapping.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,23 @@ using NonlinearSolve, SpeedMapping, LinearAlgebra, Test
2424

2525
sol = solve(prob, SpeedMappingJL(; stabilize = true))
2626
@test sol.u' * A[:, 3] 32.91647286145264
27+
28+
# Non vector inputs
29+
function power_method_nonvec!(du, u, A)
30+
mul!(vec(du), A, vec(u))
31+
du ./= norm(du, Inf)
32+
du .-= u # Convert to a root finding problem
33+
return nothing
34+
end
35+
36+
prob = NonlinearProblem(power_method_nonvec!, ones(1, 3, 1), A)
37+
38+
sol = solve(prob, SpeedMappingJL())
39+
@test vec(sol.u)' * A[:, 3] 32.916472867168096
40+
41+
sol = solve(prob, SpeedMappingJL(; orders = [3, 2]))
42+
@test vec(sol.u)' * A[:, 3] 32.916472867168096
43+
44+
sol = solve(prob, SpeedMappingJL(; stabilize = true))
45+
@test vec(sol.u)' * A[:, 3] 32.91647286145264
2746
end

0 commit comments

Comments
 (0)