Be a Matrix:
bb=replicate(3, rnorm(3))
[,1] [,2] [,3]
[1,] 0.5556358 1.6611142 0.2374830
[2,] -0.6672456 -0.5038430 0.9814712
[3,] -0.1391022 -1.2072500 -0.6219965
How can I return a second array with all possible column multiplications?
The resulting array would be:
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
[1,] [1,1]*[1,1] [1,1]*[1,2] [1,1]*[1,3] [1,1]*[1,2] [1,2]*[1,2] [1,3]*[1,2] [1,1]*[1,3] [1,2]*[1,3] [1,3]*[1,3]
[2,] [2,1]*[2,1] [2,1]*[2,2] [2,1]*[2,3] [2,1]*[2,2] [2,2]*[2,2] [2,3]*[2,2] [2,1]*[2,3] [2,2]*[2,3] [2,3]*[2,3]
[3,] [3,1]*[3,1] [3,1]*[3,2] [3,1]*[3,3] [3,1]*[3,2] [3,2]*[3,2] [3,3]*[3,2] [3,1]*[3,3] [3,2]*[3,3] [3,3]*[3,3]