Skip to content

Commit

Permalink
Eagerly create permutedims array
Browse files Browse the repository at this point in the history
reshape will not be lazy in this case
  • Loading branch information
dahong67 committed Nov 15, 2023
1 parent 244c398 commit 0b164ca
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 = collect(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 0b164ca

Please sign in to comment.