Skip to content

Commit debae4d

Browse files
committed
added: dispatch on repeatdiag to preserve Diagonnals
1 parent e34f4ed commit debae4d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/general.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ isdifferent(x, y) = any(xi !== yi for (xi, yi) in zip(x, y))
6565

6666
"Generate a block diagonal matrix repeating `n` times the matrix `A`."
6767
repeatdiag(A, n::Int) = kron(I(n), A)
68+
function repeatdiag(A::Hermitian{NT, Diagonal{NT, Vector{NT}}}, n::Int) where {NT<:Real}
69+
return Hermitian(repeatdiag(A.data, n), :L) # to return hermitian of a `Diagonal`
70+
end
6871

6972
"In-place version of `repeat` but for vectors only."
7073
function repeat!(Y::Vector, a::Vector, n::Int)

0 commit comments

Comments
 (0)