I would like to get the sums of all unique possible combinations of the values of a vector.
B = [10 20 30 (10+20) (10+30) (20+30) (10+20+30)]
If possible, I would also like to get the indices of the values used to get the sum, so:
C = [1 2 3 (1,2) (1,3) (2,3) (1,2,3)]
The output does not necessarily have to be a vector.
The length of the input vector (A) will vary from iterations to iterations, so I'm looking for a way to calculate B and C based on a changing vector A
All help would be greatly appreciated!