I want to generate a rank-1 tensor with Julia for some tensor decomposition. As for SVD and linear combination of singular values and orthogonal basis vectors, one can decompose a matrix by a sum like the sum of singular values * u * vā.

I can generate a 10x20x30 matrix like this. (the original code is inspired by GitHub - yunjhongwu/TensorDecompositions.jl: A Julia implementation of tensor decomposition algorithms)

```
u = randn(10); v = randn(20); w = randn(30)
# Generate a noisy rank-1 tensor
T = cat(map(x -> x * u * v', w)...; dims=3) + 0.2 * randn(10, 20, 30)
```

I am not sure why I have to use ā¦ in the formula. I concatenate over the third dimension.

Following code is only giving me a 10x20 matrix:

```
Su = randn(10); Sv = randn(20); Sw = randn(30)
ST = map(x -> x * Su * Sv', Sw)
```