Active set and generalized PAVA for isotone optimization