CPランクが落ちているテンソルが欲しい場合 outer(v...) = reshape(kron(reverse(v)...),length.(v)) function get_low_CP_tensor(J, R) D = length(J) v = Vector{Array}(undef, D) T = zeros(J...) for r = 1 : R for d = 1 : D v[d] = rand(J[d]) end T .+= outer(v...) end return T end