tfq.util.exponential  |  TensorFlow Quantum (original) (raw)

tfq.util.exponential

Stay organized with collections Save and categorize content based on your preferences.

Return a Cirq circuit with exponential operator forms.

tfq.util.exponential(
    operators, coefficients=None
)

Used in the notebooks

Used in the tutorials
Quantum data

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

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.

Args
operators Python list or tuple of cirq.PauliSum orcirq.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 orsympy.Symbol object of parameters. Defaults to None, then all coefficients of operators are set to 1.0.
Returns
A cirq.Circuit containing exponential form of given operatorsand coefficients.
Raises
TypeError If operators (or its terms) is/are of an invalid type.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-05-17 UTC.