Skip to content

Commit

Permalink
Added diagm for vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
eulerkochy committed Feb 20, 2019
1 parent 842fc10 commit 07f9d59
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions stdlib/LinearAlgebra/src/dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ function diagm_container(kv::Pair{<:Integer,<:BitVector}...)
return falses(n, n)
end

# Defining diagm() for an AbstractVector

diagm(v::AbstractVector) = diagm(0=>v)


function tr(A::Matrix{T}) where T
n = checksquare(A)
Expand Down

0 comments on commit 07f9d59

Please sign in to comment.