Skip to content

Commit

Permalink
add input check for incidencematrix input
Browse files Browse the repository at this point in the history
  • Loading branch information
benlorenz committed Feb 4, 2025
1 parent 18146fe commit 3ef243f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/incidencematrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ end

function IncidenceMatrix{NonSymmetric}(mat::AbstractMatrix)
res = IncidenceMatrix{NonSymmetric}(undef, size(mat)...)
if eltype(mat) != Bool && any(x->!isone(x) && !iszero(x), mat)
throw(ArgumentError("matrix entries must be 0 or 1"))

Check warning on line 15 in src/incidencematrix.jl

View check run for this annotation

Codecov / codecov/patch

src/incidencematrix.jl#L15

Added line #L15 was not covered by tests
end
@inbounds res .= mat
return res
end
Expand Down

0 comments on commit 3ef243f

Please sign in to comment.