Skip to content

Commit

Permalink
Use kron with multiple arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
dahong67 committed Mar 1, 2024
1 parent 40709ec commit 21bebdb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/gcp-opt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ function khatrirao(A::Vararg{T,N}) where {T<:AbstractMatrix,N}
r = (only unique)(size.(A, 2))
K = similar(A[1], prod(size.(A, 1)), r)
for j in 1:r
temp = reduce(kron, [view(A[i], :, j) for i in 1:N-1])
temp = (N == 2) ? view(A[1], :, j) : kron([view(A[i], :, j) for i in 1:N-1]...)
kron!(view(K, :, j), temp, view(A[N], :, j))
end
return K
Expand Down

0 comments on commit 21bebdb

Please sign in to comment.