Skip to content

Commit

Permalink
Merge pull request #31 from dahong67/mttkrp-collect
Browse files Browse the repository at this point in the history
Eagerly instantiate the matricized tensor in mttkrp
  • Loading branch information
dahong67 authored Nov 15, 2023
2 parents 1859ee2 + 0b164ca commit 6a796a5
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 @@ -181,7 +181,7 @@ function mttkrp(X, U, n)
(N == ndims(X) && I == size(X)) || throw(DimensionMismatch("`X` and `U` do not have matching dimensions"))

# Matricized tensor (in mode n)
Xn = reshape(PermutedDimsArray(X, [n; setdiff(1:N, n)]), size(X, n), :)
Xn = reshape(permutedims(X, [n; setdiff(1:N, n)]), size(X, n), :)

# Khatri-Rao product (in mode n)
Zn = similar(U[1], prod(I[setdiff(1:N, n)]), r)
Expand Down

0 comments on commit 6a796a5

Please sign in to comment.