0001 function A = createDeltaMatchMatrix(set1,set2)
0002
0003
0004
0005
0006
0007 nRxns1 = length(set1);
0008 nRxns2 = length(set2);
0009
0010 [isInSet2,set2Match] = ismember(set1,set2);
0011
0012 ind1 = find(isInSet2);
0013 ind2 = set2Match(isInSet2 == 1);
0014
0015 nCommon = length(ind1);
0016
0017 A = sparse(2*nCommon,nRxns1+nRxns2+2*nCommon);
0018 for i = 1:nCommon
0019 A(i,ind1(i)) = -1;
0020 A(i,nRxns1+ind2(i)) = 1;
0021 A(i,nRxns1+nRxns2+i) = 1;
0022 A(nCommon+i,ind1(i)) = 1;
0023 A(nCommon+i,nRxns1+ind2(i)) = -1;
0024 A(nCommon+i,nRxns1+nRxns2+nCommon+i) = 1;
0025 end