Algorithmic Ground-State Cooling of Weakly Coupled Oscillators Using Quantum Logic