I have array N-M dimension array -A. I need to generate the combinations of one element from each string and determine their sum.
Example, A=[[1,2],[3,4],[5,6]]. k=[1,3,5],[1,4,5],[1,4,6],[2,3,5],[2,3,6],[2,4,5],[2,4,6].
Thus k has three indexes for each combination. The summ=9, 10, 11, 10, 11, 11, 12. Using python, I can do it with
sums = ((vs,sum(vs)) for vs in itertools.product(*A))
for k,v in sums:
print v
print k
How to do it using Julia?
seems pretty close.