Home > matgraph > @partition > plus.m

plus

PURPOSE ^

plus --- p+q is the join of p and q

SYNOPSIS ^

function r = plus(p,q)

DESCRIPTION ^

 plus --- p+q is the join of p and q

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function r = plus(p,q)
0002 % plus --- p+q is the join of p and q
0003 
0004 n1 = nv(p);
0005 n2 = nv(q);
0006 
0007 if n1 ~= n2
0008     error('+ only defined for partitions on the same ground set');
0009 end
0010 
0011 r = q;
0012 
0013 n = n1;
0014 
0015 for i=1:n-1
0016     idx = find(p.array(:,i));
0017     irow = p.array(idx,:);
0018     for j=find(irow)
0019         r=merge(r,i,j);
0020     end
0021 end
0022 r.array = sortrows(r.array);

Generated on Thu 13-Mar-2008 14:23:52 by m2html © 2003