qml.devices.default_gaussian.poly_quad_expectations¶
- poly_quad_expectations(cov, mu, wires, device_wires, params, hbar=2.0)[source]¶
Calculates the expectation and variance for an arbitrary polynomial of quadrature operators.
- Parameters
cov (array) – covariance matrix
mu (array) – vector of means
wires (Wires) – wires to calculate the expectation for
device_wires (Wires) – corresponding wires on the device
params (array) – a (2N+1)×(2N+1) array containing the linear and quadratic coefficients of the quadrature operators (ˆ1,ˆx0,ˆp0,ˆx1,ˆp1,…)
hbar (float) – (default 2) the value of ℏ in the commutation relation [ˆx,ˆp]=iℏ
- Returns
the mean and variance of the quadrature-polynomial observable
- Return type
tuple