Bug in Kronecker sum

This commit is contained in:
ysyapa 2024-06-04 21:23:38 +00:00
parent d230476589
commit 98d3fe9229
1 changed files with 1 additions and 1 deletions

View File

@ -25,5 +25,5 @@ nearest(list::Array, ref) = list[nearestIndex(list, ref)]
"Simple implementation of the Kronecker sum"
function kron_sum(A::AbstractMatrix, B::AbstractMatrix)
@assert size(A, 1) == size(A, 2) && size(B, 1) == size(B, 2) "Matrices should be square"
return kron(A, I(size(B, 1))) + kron(B, I(size(A, 1)))
return kron(A, I(size(B, 1))) + kron(I(size(A, 1)), B)
end