Direct calculation of off-diagonal matrix elements