Skip to content

Commit

Permalink
Test non-vector inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Dec 22, 2023
1 parent 6604ea6 commit 831dacc
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/speedmapping.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,23 @@ using NonlinearSolve, SpeedMapping, LinearAlgebra, Test

sol = solve(prob, SpeedMappingJL(; stabilize = true))
@test sol.u' * A[:, 3] 32.91647286145264

# Non vector inputs
function power_method_nonvec!(du, u, A)
mul!(vec(du), A, vec(u))
du ./= norm(du, Inf)
du .-= u # Convert to a root finding problem
return nothing
end

prob = NonlinearProblem(power_method_nonvec!, ones(1, 3, 1), A)

sol = solve(prob, SpeedMappingJL())
@test vec(sol.u)' * A[:, 3] 32.916472867168096

sol = solve(prob, SpeedMappingJL(; orders = [3, 2]))
@test vec(sol.u)' * A[:, 3] 32.916472867168096

sol = solve(prob, SpeedMappingJL(; stabilize = true))
@test vec(sol.u)' * A[:, 3] 32.91647286145264
end

0 comments on commit 831dacc

Please sign in to comment.