Classical and Quantum Iterative Optimization Algorithms Based on Matrix Legendre-Bregman Projections