rand.random_povm ================ .. py:module:: rand.random_povm .. autoapi-nested-parse:: Generates a random POVM. Functions --------- .. autoapisummary:: rand.random_povm.random_povm Module Contents --------------- .. py:function:: random_povm(dim, num_inputs, num_outputs, seed = None) Generate random positive operator valued measurements (POVMs) :footcite:`WikiPOVM`. .. rubric:: Examples We can generate a set of `dim`-by-`dim` POVMs consisting of a specific dimension along with a given number of measurement inputs and measurement outputs. As an example, we can construct a random set of :math:`2`-by-:math:`2` POVMs of dimension with :math:`2` inputs and :math:`2` outputs. .. jupyter-execute:: import numpy as np from toqito.rand import random_povm dim, num_inputs, num_outputs = 2, 2, 2 povms = random_povm(dim, num_inputs, num_outputs) povms We can verify that this constitutes a valid set of POVM elements as checking that these operators all sum to the identity operator. .. jupyter-execute:: np.round(povms[:, :, 0, 0] + povms[:, :, 0, 1]) It is also possible to add a seed for reproducibility. .. jupyter-execute:: import numpy as np from toqito.rand import random_povm dim, num_inputs, num_outputs = 2, 2, 2 povms = random_povm(dim, num_inputs, num_outputs, seed=42) povms We can once again verify that this constitutes a valid set of POVM elements as checking that these operators all sum to the identity operator. .. jupyter-execute: np.round(povms[:, :, 0, 0] + povms[:, :, 0, 1]) .. rubric:: References .. footbibliography:: :param dim: The dimensions of the measurements. :param num_inputs: The number of inputs for the measurement. :param num_outputs: The number of outputs for the measurement. :param seed: A seed used to instantiate numpy's random number generator. :return: A set of `dim`-by-`dim` POVMs of shape `(dim, dim, num_inputs, num_outputs)`.