§
    º³ÙgR  ã                  ó„   — d Z ddlmZ ddlmZmZ ddlmZmZ ddl	Z
ddlmZ  G d„ dee¦  «        Z G d	„ d
e¦  «        ZdS )z3Base classes for an approximate circuit definition.é    )Úannotations)ÚABCÚabstractmethod)ÚOptionalÚSupportsFloatN)ÚQuantumCircuitc                  óf   ‡ — e Zd ZdZddˆ fd	„Zeedd„¦   «         ¦   «         Zedd„¦   «         Zˆ xZ	S )ÚApproximateCircuitz4A base class that represents an approximate circuit.NÚ
num_qubitsÚintÚnameúOptional[str]ÚreturnÚNonec                óN   •— t          ¦   «                              ||¬¦  «         dS )z€
        Args:
            num_qubits: number of qubit this circuit will span.
            name: a name of the circuit.
        )r   N)ÚsuperÚ__init__)Úselfr   r   Ú	__class__s      €ú^/granary/edev/quantum/lib/python3.11/site-packages/qiskit/synthesis/unitary/aqc/approximate.pyr   zApproximateCircuit.__init__   s(   ø€ õ 	‰Œ×Ò˜¨$ÐÑ/Ô/Ð/Ð/Ð/ó    ú
np.ndarrayc                ó   — t           ‚)z«
        The property is not implemented and raises a ``NotImplementedException`` exception.

        Returns:
            a vector of parameters of this circuit.
        ©ÚNotImplementedError©r   s    r   ÚthetaszApproximateCircuit.thetas    ó
   € õ "Ð!r   r   c                ó   — t           ‚)zç
        Constructs this circuit out of the parameters(thetas). Parameter values must be set before
            constructing the circuit.

        Args:
            thetas: a vector of parameters to be set in this circuit.
        r   )r   r   s     r   ÚbuildzApproximateCircuit.build+   r   r   ©N)r   r   r   r   r   r   ©r   r   )r   r   r   r   )
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úpropertyr   r   r    Ú__classcell__)r   s   @r   r
   r
      s’   ø€ € € € € Ø>Ð>ð0ð 0ð 0ð 0ð 0ð 0ð 0ð Øð"ð "ð "ñ „^ñ „Xð"ð ð"ð "ð "ñ „^ð"ð "ð "ð "ð "r   r
   c                  ó¬   — e Zd ZdZdd„Zedd„¦   «         Zedd	„¦   «         Zedd
„¦   «         Z	e	j
        dd„¦   «         Z	eedd„¦   «         ¦   «         ZdS )ÚApproximatingObjectivea/  
    A base class for an optimization problem definition. An implementing class must provide at least
    an implementation of the ``objective`` method. In such case only gradient free optimizers can
    be used. Both method, ``objective`` and ``gradient``, preferable to have in an implementation.
    r   r   c                ó   — d | _         d S r!   ©Ú_target_matrixr   s    r   r   zApproximatingObjective.__init__>   s   € à15ˆÔÐÐr   Úparam_valuesr   r   c                ó   — t           ‚)a  
        Computes a value of the objective function given a vector of parameter values.

        Args:
            param_values: a vector of parameter values for the optimization problem.

        Returns:
            a float value of the objective function.
        r   ©r   r.   s     r   Ú	objectivez ApproximatingObjective.objectiveB   ó
   € õ "Ð!r   c                ó   — t           ‚)a  
        Computes a gradient with respect to parameters given a vector of parameter values.

        Args:
            param_values: a vector of parameter values for the optimization problem.

        Returns:
            an array of gradient values.
        r   r0   s     r   ÚgradientzApproximatingObjective.gradientO   r2   r   c                ó   — | j         S )zB
        Returns:
            a matrix being approximated
        r,   r   s    r   Útarget_matrixz$ApproximatingObjective.target_matrix\   s   € ð Ô"Ð"r   r6   c                ó   — || _         dS )zi
        Args:
            target_matrix: a matrix to approximate in the optimization procedure.
        Nr,   )r   r6   s     r   r6   z$ApproximatingObjective.target_matrixd   s   € ð ,ˆÔÐÐr   r   c                ó   — t           ‚)z^

        Returns:
            the number of parameters in this optimization problem.
        r   r   s    r   Ú
num_thetasz!ApproximatingObjective.num_thetasl   s
   € õ "Ð!r   N)r   r   )r.   r   r   r   )r.   r   r   r   r"   )r6   r   r   r   )r   r   )r#   r$   r%   r&   r   r   r1   r4   r'   r6   Úsetterr9   © r   r   r*   r*   7   sà   € € € € € ðð ð6ð 6ð 6ð 6ð ð
"ð 
"ð 
"ñ „^ð
"ð ð
"ð 
"ð 
"ñ „^ð
"ð ð#ð #ð #ñ „Xð#ð Ôð,ð ,ð ,ñ Ôð,ð Øð"ð "ð "ñ „^ñ „Xð"ð "ð "r   r*   )r&   Ú
__future__r   Úabcr   r   Útypingr   r   ÚnumpyÚnpÚqiskit.circuit.quantumcircuitr   r
   r*   r;   r   r   ú<module>rB      sÎ   ðð :Ð 9Ø "Ð "Ð "Ð "Ð "Ð "Ø #Ð #Ð #Ð #Ð #Ð #Ð #Ð #Ø *Ð *Ð *Ð *Ð *Ð *Ð *Ð *Ø Ð Ð Ð à 8Ð 8Ð 8Ð 8Ð 8Ð 8ð"ð "ð "ð "ð "˜¨ñ "ô "ð "ðD="ð ="ð ="ð ="ð ="˜Sñ ="ô ="ð ="ð ="ð ="r   