Removed length from ext_mismatch_energy to uniformize with CUDA.