Skip to content

Commit

Permalink
Add test for throwing error
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarmesin committed Nov 14, 2024
1 parent 56dcb1c commit 8dcf245
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/exp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ function exponential!(A, method::ExpMethodNative, cache = nothing)
end

function exponential!(A::AbstractSparseArray, method=nothing, cache=nothing)
throw("exp(A) on a sparse matrix is generally dense. This operation is "*
throw(ErrorException("exp(A) on a sparse matrix is generally dense. This operation is "*
"not allowed with exponential. If you wished to compute exp(At)*v, see expv. "*
"Otherwise to override this error, densify the matrix before calling, "*
"i.e. exponential!(Matrix(A))")
"i.e. exponential!(Matrix(A))"))
end
2 changes: 1 addition & 1 deletion test/basictests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ end
if VERSION >= v"1.9"
@testset "exponential! sparse" begin
A = sparse([1, 2, 1], [2, 1, 1], [1.0, 2.0, 3.0])
exponential!(copy(A), ExpMethodGeneric()) exp(Array(A))
@test_throws ErrorException exponential!(A)
end
end

Expand Down

0 comments on commit 8dcf245

Please sign in to comment.