function A = circ(a)
    n = max(size(a));
    A = zeros(n);
    for i = 1:n
        for j=1:n
            k = mod(i-1+j,n);
            if (k == 0), k = n; end
            A(i,k)=a(j);
        end
    end
    return