MULTI_ADDITION
Contents
function [RES,I_sum1,I_sum2] = multi_addition(SUMMAND1,SUMMAND2)
Addition of multi-indices
The output is a matrix, containing all columns of added to all columns of that do not lead to columns with negative entries. The matrix contains in position the column index of corresponding to the column of . The same holds for .
- SUMMAND1: matrix containing the first set of multi-indices in its columns
- SUMMAND2: matrix containing the second set of multi-indices in its columns
- RES: matrix containing all subtracted multi-index pairs with nonnegative entries
- I_sum1: indices SUMMAND1 leading to RES
- I_sum2: indices SUMMAND2 leading to RES
Example:
, implies that .
sz_sum1 = size(SUMMAND1,2); sz_sum2 = size(SUMMAND2,2); % Index of the first summand I_sum1 = repmat(1:sz_sum1,1,sz_sum2); % Index of the second summand I_sum2 = reshape(repmat(1:sz_sum2,sz_sum1,1),1,[]); RES = SUMMAND1(:,I_sum1)+SUMMAND2(:,I_sum2);
end