Bug in Kronecker sum
This commit is contained in:
parent
d230476589
commit
98d3fe9229
|
|
@ -25,5 +25,5 @@ nearest(list::Array, ref) = list[nearestIndex(list, ref)]
|
||||||
"Simple implementation of the Kronecker sum"
|
"Simple implementation of the Kronecker sum"
|
||||||
function kron_sum(A::AbstractMatrix, B::AbstractMatrix)
|
function kron_sum(A::AbstractMatrix, B::AbstractMatrix)
|
||||||
@assert size(A, 1) == size(A, 2) && size(B, 1) == size(B, 2) "Matrices should be square"
|
@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
|
end
|
||||||
Loading…
Reference in New Issue