% Modified to accommodate multi-channel images and be circulant

function res = adjD(y)

inds = arrayfun(@(x) 1:x,size(y),'UniformOutput',false);
res = adjDx(y(inds{1:end-1},1)) + adjDy(y(inds{1:end-1},2));

return;


function res = adjDy(x)

res = x(:,[end,1:end-1],:) - x;

function res = adjDx(x)

res = x([end,1:end-1],:,:) - x;

