Skip to content

Commit

Permalink
at-deprecate diagm(A::BitMatrix) diagm(vec(A)) (#23373)
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre authored Aug 23, 2017
1 parent 086eca1 commit 6d38500
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,8 @@ Deprecated or removed
* `diagm(A::SparseMatrixCSC)` has been deprecated in favor of
`spdiagm(sparsevec(A))` ([#23341]).

* `diagm(A::BitMatrix)` has been deprecated, use `diagm(vec(A))` instead ([#23373]).

Command-line option changes
---------------------------

Expand Down
3 changes: 3 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1716,6 +1716,9 @@ export hex2num
# PR 23341
@deprecate diagm(A::SparseMatrixCSC) spdiagm(sparsevec(A))

# PR #23373
@deprecate diagm(A::BitMatrix) diagm(vec(A))

# END 0.7 deprecations

# BEGIN 1.0 deprecations
Expand Down
3 changes: 1 addition & 2 deletions base/linalg/bitarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ function diag(B::BitMatrix)
v
end

function diagm(v::Union{BitVector,BitMatrix})
isa(v, BitMatrix) && size(v,1)==1 || size(v,2)==1 || throw(DimensionMismatch())
function diagm(v::BitVector)
n = length(v)
a = falses(n, n)
for i=1:n
Expand Down
3 changes: 0 additions & 3 deletions test/bitarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1395,9 +1395,6 @@ timesofar("cat")
b1 = bitrand(v1)
@check_bit_operation diagm(b1) BitMatrix

b1 = bitrand(n1, n2)
@test_throws DimensionMismatch diagm(b1)

b1 = bitrand(n1, n1)
@check_bit_operation diag(b1)
end
Expand Down

0 comments on commit 6d38500

Please sign in to comment.