algorithms for the cx decomposition