quara.loss_function.standard_qtomography_based_weighted_relative_entropy module

class StandardQTomographyBasedWeightedRelativeEntropy(num_var=None, prob_dists_q=None, weights=None)[source]

Bases: quara.loss_function.weighted_relative_entropy.WeightedRelativeEntropy

Constructor of StandardQTomography based WeightedRelativeEntropy.

Parameters
  • num_var (int, optional) – number of variables, by default None

  • prob_dists_q (List[np.ndarray], optional) – vectors of q, by default None.

  • weights (Union[List[float], List[np.float64]], optional) – weights, by default None

gradient(var, validate=False)[source]

returns the gradient of Weighted Relative Entropy.

see gradient()

Parameters
  • var (numpy.ndarray) –

  • validate (bool) –

Return type

numpy.ndarray

hessian(var, validate=False)[source]

returns the Hessian of Weighted Relative Entropy.

see hessian()

Parameters
  • var (numpy.ndarray) –

  • validate (bool) –

Return type

numpy.ndarray

set_func_gradient_prob_dists_from_standard_qt(qt)[source]

sets the gradient of probability distributions from StandardQTomography.

Parameters

qt (StandardQTomography) – StandardQTomography to set the gradient of probability distributions.

Return type

None

set_func_prob_dists_from_standard_qt(qt)[source]

sets the function of probability distributions from StandardQTomography.

Parameters

qt (StandardQTomography) – StandardQTomography to set the function of probability distributions.

Return type

None

set_prob_dists_q(prob_dists_q)[source]

sets vectors of q, by default None.

Parameters

prob_dists_q (List[np.ndarray]) – vectors of q, by default None.

Return type

None

value(var, validate=False)[source]

returns the value of Weighted Relative Entropy.

see value()

Parameters
  • var (numpy.ndarray) –

  • validate (bool) –

Return type

numpy.float64

class StandardQTomographyBasedWeightedRelativeEntropyOption(mode_weight=None, weights=None, weight_name=None)[source]

Bases: quara.loss_function.weighted_relative_entropy.WeightedRelativeEntropyOption

Constructor

mode_weight should be the following value:

  • “identity” then uses identity matrices for weights.

  • “custom” then uses user custom matrices for weights.

Parameters
  • mode_weight (str, optional) – mode weight, by default None

  • weights (List, optional) – list of weight, by default None

  • weight_name (str, optional) – weight name for reporting, by default None