swap used to avoid temporaries, until Eigen supports move semantics