§
    ¹³ÙgÀ  ã                  ób   — d Z ddlmZ ddlmZmZ ddlZddlmZ ddl	m
Z
  G d„ d	e
¦  «        ZdS )
z*
Parameter Class for variable parameters.
é    )Úannotations)Úuuid4ÚUUIDN©ÚCircuitErroré   )ÚParameterExpressionc                  ó¤   ‡ — e Zd ZdZdZddœdd	„Zd
„ Zdd d„Zed„ ¦   «         Z	ed!d„¦   «         Z
d„ Zd„ Zd"d„Zd„ Zˆ fd„Zd„ Zd„ Zd„ Zd„ Zˆ xZS )#Ú	Parameteraë  A compile-time symbolic parameter.

    The value of a :class:`Parameter` must be entirely determined before a circuit begins execution.
    Typically this will mean that you should supply values for all :class:`Parameter`\ s in a
    circuit using :meth:`.QuantumCircuit.assign_parameters`, though certain hardware vendors may
    allow you to give them a circuit in terms of these parameters, provided you also pass the values
    separately.

    This is the atom of :class:`.ParameterExpression`, and is itself an expression.  The numeric
    value of a parameter need not be fixed while the circuit is being defined.

    Examples:

        Construct a variable-rotation X gate using circuit parameters.

        .. plot::
           :alt: Circuit diagram output by the previous code.
           :include-source:

           from qiskit.circuit import QuantumCircuit, Parameter

           # create the parameter
           phi = Parameter('phi')
           qc = QuantumCircuit(1)

           # parameterize the rotation
           qc.rx(phi, 0)
           qc.draw('mpl')

           # bind the parameters after circuit to create a bound circuit
           bc = qc.assign_parameters({phi: 3.14})
           bc.measure_all()
           bc.draw('mpl')
    )Ú_uuidÚ_hashN)ÚuuidÚnameÚstrr   úUUID | Nonec               ó4  — |€t          ¦   «         n|| _        t          j        |¦  «        }|| _        t          |                      ¦   «         f¦  «        | _        t          | j        | j        f¦  «        | _	        | |i| _
        d| _        g | _        d| _        dS )uê  
        Args:
            name: name of the ``Parameter``, used for visual representation. This can
                be any Unicode string, e.g. "Ï•".
            uuid: For advanced usage only.  Override the UUID of this parameter, in order to make it
                compare equal to some other parameter object.  By default, two parameters with the
                same name do not compare equal to help catch shadowing bugs when two circuits
                containing the same named parameters are spurious combined.  Setting the ``uuid``
                field when creating two parameters to the same thing (along with the same name)
                allows them to be equal.  This is useful during serialization and deserialization.
        NT)r   r   Ú	symengineÚSymbolÚ_symbol_exprÚ	frozensetÚ	_hash_keyÚ_parameter_keysÚhashr   Ú_parameter_symbolsÚ	_name_mapÚ_qpy_replayÚ_standalone_param)Úselfr   r   Úsymbols       úN/granary/edev/quantum/lib/python3.11/site-packages/qiskit/circuit/parameter.pyÚ__init__zParameter.__init__E   s�   € ð !% •U‘W”W�W°$ˆŒ
ÝÔ! $Ñ'Ô'ˆà"ˆÔÝ(¨$¯.ª.Ñ*:Ô*:Ð)<Ñ=Ô=ˆÔÝ˜4Ô/°Ô1BÐCÑDÔDˆŒ
Ø#'¨ .ˆÔØˆŒØˆÔØ!%ˆÔÐÐó    c                óÂ   — || k    r!t          dt          |¦  «        g› d�¦  «        ‚t          |t          ¦  «        r|S t          i t	          j        |¦  «        ¦  «        S )NúCannot bind Parameters (ú) not present in expression.)r   r   Ú
isinstancer	   r   Úsympify)r   Ú	parameterÚvalues      r    ÚassignzParameter.assign^   so   € Ø˜ÒÐõ ØY­C°	©N¬NÐ+;ÐYÐYÐYñô ð õ �eÕ0Ñ1Ô1ð 	àˆLõ # 2¥yÔ'8¸Ñ'?Ô'?Ñ@Ô@Ð@r"   FÚparameter_mapÚdictÚallow_unknown_parametersÚboolc                ó\   — | |v r||          S |r| S t          dd„ |D ¦   «         › d�¦  «        ‚)zFSubstitute self with the corresponding parameter in ``parameter_map``.r$   c                ó,   — g | ]}t          |¦  «        ‘ŒS © )r   )Ú.0Úps     r    ú
<listcomp>z"Parameter.subs.<locals>.<listcomp>s   s   € Ð'FÐ'FÐ'F°1­¨A©¬Ð'FÐ'FÐ'Fr"   r%   r   )r   r+   r-   s      r    ÚsubszParameter.subsl   s\   € à�=Ð Ð Ø  Ô&Ð&Ø#ð 	ØˆKÝðÐ'FÐ'F¸Ð'FÑ'FÔ'Fð ð ð ñ
ô 
ð 	
r"   c                ó   — | j         j        S )z+Returns the name of the :class:`Parameter`.)r   r   ©r   s    r    r   zParameter.namew   s   € ð Ô Ô%Ð%r"   Úreturnr   c                ó   — | j         S )zõReturns the :class:`~uuid.UUID` of the :class:`Parameter`.

        In advanced use cases, this property can be passed to the
        :class:`Parameter` constructor to produce an instance that compares
        equal to another instance.
        )r   r7   s    r    r   zParameter.uuid|   s   € ð ŒzÐr"   c                ó   — | j         S ©N)r   r7   s    r    Ú__str__zParameter.__str__†   s
   € ØŒyÐr"   c                ó   — | S r;   r1   r7   s    r    Ú__copy__zParameter.__copy__‰   ó   € Øˆr"   c                ó   — | S r;   r1   )r   Úmemos     r    Ú__deepcopy__zParameter.__deepcopy__Œ   r?   r"   c                ó0   — | j         j        › d| j        › d�S )Nú(ú))Ú	__class__Ú__name__r   r7   s    r    Ú__repr__zParameter.__repr__�   s    € Ø”.Ô)Ð8Ð8¨D¬IÐ8Ð8Ð8Ð8r"   c                óÚ   •— t          |t          ¦  «        r| j        | j        f|j        |j        fk    S t          |t          ¦  «        r!t          ¦   «                              |¦  «        S dS )NF)r&   r   r   r   r	   ÚsuperÚ__eq__)r   ÚotherrF   s     €r    rK   zParameter.__eq__’   sb   ø€ Ý�e�YÑ'Ô'ð 	Ø”J Ô 1Ð2°u´{ÀEÔDVÐ6WÒWÐWÝ˜Õ2Ñ3Ô3ð 	Ý‘7”7—>’> %Ñ(Ô(Ð(à�5r"   c                ó   — | j         | j        fS r;   )r   r   r7   s    r    r   zParameter._hash_keyš   s   € ð Ô! 4¤:Ð.Ð.r"   c                ó   — | j         S r;   )r   r7   s    r    Ú__hash__zParameter.__hash__¢   s
   € àŒzÐr"   c                ó*   — | j         | j        | j        fS r;   )r   r   r   r7   s    r    Ú__getstate__zParameter.__getstate__©   s   € Ø”	˜4œ: tÔ'8Ð9Ð9r"   c                óú   — |\  }| _         | _        t          |                      ¦   «         f¦  «        | _        t          | j        | j        f¦  «        | _        | | j        i| _        d | _        g | _	        d| _
        d S )NT)r   r   r   r   r   r   r   r   r   r   r   )r   ÚstateÚ_s      r    Ú__setstate__zParameter.__setstate__¬   sw   € Ø+0Ñ(ˆˆ4Œ:�tÔ(Ý(¨$¯.ª.Ñ*:Ô*:Ð)<Ñ=Ô=ˆÔÝ˜4Ô/°Ô1BÐCÑDÔDˆŒ
Ø#'¨Ô):Ð";ˆÔØˆŒØˆÔØ!%ˆÔÐÐr"   )r   r   r   r   )F)r+   r,   r-   r.   )r8   r   r;   )rG   Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r!   r*   r5   Úpropertyr   r   r<   r>   rB   rH   rK   r   rO   rQ   rU   Ú__classcell__)rF   s   @r    r   r      sP  ø€ € € € € ð!ð !ðF #€Ið 15ð&ð &ð &ð &ð &ð &ð2Að Að Að	
ð 	
ð 	
ð 	
ð 	
ð ð&ð &ñ „Xð&ð ðð ð ñ „Xððð ð ðð ð ðð ð ð ð9ð 9ð 9ðð ð ð ð ð/ð /ð /ðð ð ð:ð :ð :ð&ð &ð &ð &ð &ð &ð &r"   r   )rX   Ú
__future__r   r   r   r   r   Úqiskit.circuit.exceptionsr   Úparameterexpressionr	   r   r1   r"   r    ú<module>r_      sª   ððð ð #Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ð Ð Ð Ð à Ð Ð Ð à 2Ð 2Ð 2Ð 2Ð 2Ð 2à 4Ð 4Ð 4Ð 4Ð 4Ð 4ðX&ð X&ð X&ð X&ð X&Ð#ñ X&ô X&ð X&ð X&ð X&r"   