Skip to content

Commit

Permalink
Revert "Revert "Avoid making two copies of K""
Browse files Browse the repository at this point in the history
Add back new version now that benchmarks have been committed.
This reverts commit 0178c48.
  • Loading branch information
dahong67 committed Mar 1, 2024
1 parent eaba07b commit 40709ec
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/gcp-opt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ 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
K[:, j] = reduce(kron, [view(A[i], :, j) for i in 1:N])
temp = reduce(kron, [view(A[i], :, j) for i in 1:N-1])
kron!(view(K, :, j), temp, view(A[N], :, j))
end
return K
end

0 comments on commit 40709ec

Please sign in to comment.