tfq.util.exponential

Return a Cirq circuit with exponential operator forms.

Used in the notebooks

Used in the tutorials

Construct an exponential form of given operators and coefficients. Operators to be exponentiated are specified in operators as cirq.PauliSum or cirq.PauliString. Parameters are given by coefficients.

Note that only operators whose standard representations consist of terms which all commute can be exponentiated. This allows use of the identity exp(A+B+...) = exp(A)exp(B)... else there would need to be automatic handling of Trotterization and convergence, which is not supported yet.

operators Python list or tuple of cirq.PauliSum or cirq.PauliString objects to be exponentiated. Here are simple examples. Let q = cirq.GridQubit(0, 0) E.g. operator = 0.5 * X(q) -> exp(-i * 0.5 * X(q)) operator = 0.5 * cirq.PauliString({q: cirq.I}) -> exp(-i * 0.5)*np.eye(2) Be careful of the negation and the PauliString of the identity gate.
coefficients (Optional) Python list of Python str, float or sympy.Symbol object of parameters. Defaults to None, then all coefficients of operators are set to 1.0.

A cirq.Circuit containing exponential form of given operators and coefficients.

TypeError If operators (or its terms) is/are of an invalid type.