ab-swap now uses the convention (S_1,...,S_N,L) for the shape of D