The quantum generalization of optimal statistical estimation and hypothesis testing