MULTI_SUBTRACTION
Contents
function [RES,I_minu,I_subt] = multi_subtraction(MINUEND,SUBTRAHEND,type)
Subtraction of multi-indices
The output is a matrix, containing all columns of subtracted by 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 .
- type: 'Arbitrary' - generic multi-indices that are subtracted 'Identity' - Subtrahend is the identity matrix 'Unit' - Subtrahend is collection of unit vectors
- RES: matrix containing all subtracted multi-index pairs with nonnegative entries
- I_minu: indices minuends leading to RES
- I_subt: indices subtrahends leading to RES
Example:
, implies that .
different functionalities for parametrisation multi indices and forcing multi indices
switch type case 'Parametrised' minu_sz = size(MINUEND,2); subt_sz = size(SUBTRAHEND,2); % Index of the subtrahends I_subt = reshape(repmat(1:subt_sz,minu_sz,1),1,[]); % Index of the minuends I_minu = repmat(1:minu_sz,1,subt_sz); RES = MINUEND(:,I_minu)-SUBTRAHEND(:,I_subt); [~,neg] = find(RES<0); RES(:,neg) = []; %delete columns with negative entries I_subt(:,neg) = []; I_minu(:,neg) = []; case 'Physical' %subtrahend is always identity matrix [I_minu,I_subt] = find(MINUEND.'); RES = (MINUEND(:,I_minu)-SUBTRAHEND(:,I_subt)); end % Output indices as row vector if size(I_minu,1)>1 I_minu = I_minu.'; end if size(I_subt,1)>1 I_subt = I_subt.'; end
end