Skip to content

Commit

Permalink
Fix bug in issym(A::BitMatrix)
Browse files Browse the repository at this point in the history
numnz -> countnz

backport of 7ba14fe

Add issym test for bitarrays

backport of 85b015f
  • Loading branch information
wkearn authored and tkelman committed Nov 18, 2014
1 parent 8425d55 commit c14aeab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/linalg/bitarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ end

## Structure query functions

issym(A::BitMatrix) = size(A, 1)==size(A, 2) && numnz(A - A.')==0
issym(A::BitMatrix) = size(A, 1)==size(A, 2) && countnz(A - A.')==0
ishermitian(A::BitMatrix) = issym(A)

function nonzero_chunks(chunks::Vector{Uint64}, pos0::Int, pos1::Int)
Expand Down
4 changes: 4 additions & 0 deletions test/bitarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,10 @@ b1 = triu(randbool(n1, n2))
b1 = triu(randbool(n2, n1))
@check_bit_operation istriu(b1) Bool

b1 = randbool(n1,n1)
b1 |= b1.'
@check_bit_operation issym(b1) Bool

b1 = randbool(n1)
b2 = randbool(n2)
@check_bit_operation kron(b1, b2) BitVector
Expand Down

0 comments on commit c14aeab

Please sign in to comment.