%m-th order u x u x n x ... x n identity tensor
%s must be an m-vector [u u n ... n], where u may exceed n
function C=eyete(s)
C=zeros(s);
m=length(s);
N=prod(s);
ind=cell(1,m);
for i=1:N
    [ind{:}]=ind2sub(s,i);
    indi=[ind{:}];
    if indi(1)==indi(2)
        indC=num2cell(indi);
        C(indC{:})=1;
    end
end

