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)\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