mtimes(p,q) --- p*q is the meet of the partitions p and q
0001 function r = mtimes(p,q) 0002 % mtimes(p,q) --- p*q is the meet of the partitions 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 m1 = np(p); 0012 m2 = np(q); 0013 0014 mat = sparse(0,0); 0015 0016 for i=1:m1 0017 for j=1:m2 0018 a = p.array(i,:) & q.array(j,:); 0019 if sum(a) > 0 0020 mat = [mat;a]; 0021 end 0022 end 0023 end 0024 0025 mat = sortrows(mat); 0026 mat = unique(mat,'rows'); 0027 r.array = mat; 0028 0029 r = class(r,'partition');