Optimized getAtilde.m.