§
    º³Ùg  ã                  ór   — d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
mZ ddlmZ  G d	„ d
e¦  «        ZdS )z The Lie-Trotter product formula.é    )Úannotations)ÚCallable)ÚAny)ÚQuantumCircuit)ÚSparsePauliOpÚPaulié   )ÚSuzukiTrotterc                  óJ   ‡ — e Zd ZdZ	 	 	 	 	 	 ddˆ fd„Zedd„¦   «         Zˆ xZS )Ú
LieTrotterak  The Lie-Trotter product formula.

    The Lie-Trotter formula approximates the exponential of two non-commuting operators
    with products of their exponentials up to a second order error:

    .. math::

        e^{A + B} \approx e^{A}e^{B}.

    In this implementation, the operators are provided as sum terms of a Pauli operator.
    For example, we approximate

    .. math::

        e^{-it(XI + ZZ)} = e^{-it XI}e^{-it ZZ} + \mathcal{O}(t^2).

    References:

        [1]: D. Berry, G. Ahokas, R. Cleve and B. Sanders,
        "Efficient quantum algorithms for simulating sparse Hamiltonians" (2006).
        `arXiv:quant-ph/0508139 <https://arxiv.org/abs/quant-ph/0508139>`_
        [2]: N. Hatano and M. Suzuki,
        "Finding Exponential Product Formulas of Higher Orders" (2005).
        `arXiv:math-ph/0506007 <https://arxiv.org/pdf/math-ph/0506007.pdf>`_
    r	   FÚchainNTÚrepsÚintÚinsert_barriersÚboolÚcx_structureÚstrÚatomic_evolutionú€Callable[[Pauli | SparsePauliOp, float], QuantumCircuit] | Callable[[QuantumCircuit, Pauli | SparsePauliOp, float], None] | NoneÚwrapÚpreserve_orderÚreturnÚNonec           	     óX   •— t          ¦   «                              d||||||¬¦  «         dS )aô  
        Args:
            reps: The number of time steps.
            insert_barriers: Whether to insert barriers between the atomic evolutions.
            cx_structure: How to arrange the CX gates for the Pauli evolutions, can be
                ``"chain"``, where next neighbor connections are used, or ``"fountain"``,
                where all qubits are connected to one. This only takes effect when
                ``atomic_evolution is None``.
            atomic_evolution: A function to apply the evolution of a single :class:`.Pauli`, or
                :class:`.SparsePauliOp` of only commuting terms, to a circuit. The function takes in
                three arguments: the circuit to append the evolution to, the Pauli operator to
                evolve, and the evolution time. By default, a single Pauli evolution is decomposed
                into a chain of ``CX`` gates and a single ``RZ`` gate.
                Alternatively, the function can also take Pauli operator and evolution time as
                inputs and returns the circuit that will be appended to the overall circuit being
                built.
            wrap: Whether to wrap the atomic evolutions into custom gate objects. This only takes
                effect when ``atomic_evolution is None``.
            preserve_order: If ``False``, allows reordering the terms of the operator to
                potentially yield a shallower evolution circuit. Not relevant
                when synthesizing operator with a single term.
        r	   )r   N)ÚsuperÚ__init__)Úselfr   r   r   r   r   r   Ú	__class__s          €ú\/granary/edev/quantum/lib/python3.11/site-packages/qiskit/synthesis/evolution/lie_trotter.pyr   zLieTrotter.__init__4   sF   ø€ õF 	‰Œ×ÒØØØØØØØ)ð 	ñ 	
ô 	
ð 	
ð 	
ð 	
ó    údict[str, Any]c                ód   — | j         �t          d¦  «        ‚| j        | j        | j        | j        dœS )a)  Return the settings in a dictionary, which can be used to reconstruct the object.

        Returns:
            A dictionary containing the settings of this product formula.

        Raises:
            NotImplementedError: If a custom atomic evolution is set, which cannot be serialized.
        NzBCannot serialize a product formula with a custom atomic evolution.)r   r   r   r   )Ú_atomic_evolutionÚNotImplementedErrorr   r   Ú_cx_structureÚ_wrap)r   s    r   ÚsettingszLieTrotter.settingsa   sI   € ð Ô!Ð-Ý%ØTñô ð ð
 ”IØ#Ô3Ø Ô.Ø”Jð	
ð 
ð 	
r    )r	   Fr   NFT)r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r   r!   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úpropertyr'   Ú__classcell__)r   s   @r   r   r      sƒ   ø€ € € € € ðð ð8 Ø %Ø#ð
 ØØ#ð+
ð +
ð +
ð +
ð +
ð +
ð +
ðZ ð
ð 
ð 
ñ „Xð
ð 
ð 
ð 
ð 
r    r   N)r+   Ú
__future__r   Úcollections.abcr   Útypingr   Úqiskit.circuit.quantumcircuitr   Úqiskit.quantum_info.operatorsr   r   Úsuzuki_trotterr
   r   © r    r   ú<module>r5      s½   ðð 'Ð &à "Ð "Ð "Ð "Ð "Ð "à $Ð $Ð $Ð $Ð $Ð $Ø Ð Ð Ð Ð Ð Ø 8Ð 8Ð 8Ð 8Ð 8Ð 8Ø >Ð >Ð >Ð >Ð >Ð >Ð >Ð >à )Ð )Ð )Ð )Ð )Ð )ð\
ð \
ð \
ð \
ð \
�ñ \
ô \
ð \
ð \
ð \
r    