Skip to content

Commit

Permalink
Rename benchmark file (baseline)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmul1114 committed Feb 29, 2024
1 parent 4bb9716 commit 9b25f93
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
File renamed without changes.
12 changes: 11 additions & 1 deletion src/gcp-opt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,18 @@ function gcp_grad_U!(
I in CartesianIndices(X)
]
# Use faster MTTKRPs algorithm
faster_mttkrps!(GU, M, Y)
#faster_mttkrps!(GU, M, Y)
#return ntuple(Val(N)) do k
# return rmul!(GU[k], Diagonal(M.λ))
#end
# MTTKRPs (inefficient but simple)
return ntuple(Val(N)) do k
Yk = reshape(PermutedDimsArray(Y, [k; setdiff(1:N, k)]), size(X, k), :)
Zk = similar(Yk, prod(size(X)[setdiff(1:N, k)]), ncomponents(M))
for j in Base.OneTo(ncomponents(M))
Zk[:, j] = reduce(kron, [view(M.U[i], :, j) for i in reverse(setdiff(1:N, k))])
end
mul!(GU[k], Yk, Zk)
return rmul!(GU[k], Diagonal(M.λ))
end
end
Expand Down

0 comments on commit 9b25f93

Please sign in to comment.