qml.devices.default_gaussian.poly_quad_expectations

poly_quad_expectations(mu, cov, wires, device_wires, params, hbar=2.0)[source]

Calculates the expectation and variance for an arbitrary polynomial of quadrature operators.

Parameters
  • mu (array) – vector of means

  • cov (array) – covariance matrix

  • wires (Wires) – wires to calculate the expectation for

  • device_wires (Wires) – corresponding wires on the device

  • params (array) – a \((2N+1)\times (2N+1)\) array containing the linear and quadratic coefficients of the quadrature operators \((\I, \x_0, \p_0, \x_1, \p_1,\dots)\)

  • hbar (float) – (default 2) the value of \(\hbar\) in the commutation relation \([\x,\p]=i\hbar\)

Returns

the mean and variance of the quadrature-polynomial observable

Return type

tuple

Contents

Using PennyLane

Development

API