
    z	i#                     8    S r SSKJrJr  SSKJr   " S S5      rg)zAParameter Vector Class to simplify management of parameter lists.    )uuid4UUID)ParameterVectorElementc                       \ rS rSrSrSrSS jr\S 5       r\S 5       r	S r
S rS	 rS
 rS rS rS rS rS rS rSrg)ParameterVector   a  A container of many related :class:`Parameter` objects.

This class is faster to construct than constructing many :class:`Parameter` objects
individually, and the individual names of the parameters will all share a common stem (the name
of the vector).  For a vector called ``v`` with length 3, the individual elements will have
names ``v[0]``, ``v[1]`` and ``v[2]``.

The elements of a vector are sorted by the name of the vector, then the numeric value of their
index.

This class fulfill the :class:`collections.abc.Sequence` interface.
)_name_params
_root_uuidc                     Xl         [        5       U l        U R                  R                  n[	        U5       Vs/ s H  n[        X[        X4-   S95      PM     snU l        g s  snf )Nint)r	   r   r   r   ranger   r   r
   )selfnamelengthroot_uuid_intis        X/home/james-whalen/.local/lib/python3.13/site-packages/qiskit/circuit/parametervector.py__init__ParameterVector.__init__$   sV    
'++RWX^R_
R_Q"4D]5F,GHR_
 
s   A!c                     U R                   $ )z)The name of the :class:`ParameterVector`.)r	   r   s    r   r   ParameterVector.name,   s     zz    c                     U R                   $ )zgA list of the contained :class:`ParameterVectorElement` instances.

It is not safe to mutate this list.)r
   r   s    r   paramsParameterVector.params1   s    
 ||r   c                 8    U R                   R                  U5      $ )zFind the index of a :class:`ParameterVectorElement` within the list.

It is typically much faster to use the :attr:`ParameterVectorElement.index` property.)r
   index)r   values     r   r    ParameterVector.index8   s     ||!!%((r   c                      U R                   U   $ N)r   )r   keys     r   __getitem__ParameterVector.__getitem__>   s    {{3r   c                 ,    [        U R                  5      $ r$   )iterr   r   s    r   __iter__ParameterVector.__iter__A   s    DKK  r   c                 ,    [        U R                  5      $ r$   )lenr
   r   s    r   __len__ParameterVector.__len__D   s    4<<  r   c                 v    U R                    SU R                   Vs/ s H  n[        U5      PM     sn 3$ s  snf )Nz, )r   r   str)r   items     r   __str__ParameterVector.__str__G   s2    ))BdkkBkdD	kBCDDBs   6c                 x    U R                   R                   S[        U R                  5       S[	        U 5       S3$ )Nz(name=z	, length=))	__class____name__reprr   r-   r   s    r   __repr__ParameterVector.__repr__J   s4    ..))*&dii0A3t9+UVWWr   c                 D    U R                   [        U R                  5      4$ r$   )r	   r-   r
   r   s    r   __getnewargs__ParameterVector.__getnewargs__M   s    

C-..r   c                     U R                    Vs/ s H  oR                  5       PM     nnU R                  X R                  4$ s  snf r$   )r
   __getstate__r	   r   )r   pr   s      r   r@   ParameterVector.__getstate__P   s7    ,0LL9Lq.."L9

FOO44 :s   Ac                 h    Uu  U l         o l        U Vs/ s H  n[        U6 PM     snU l        g s  snf r$   )r	   r   r   r
   )r   stater   rA   s       r   __setstate__ParameterVector.__setstate__T   s/    .3+
FO<BCFq.2FCCs   /c                 D   U[        U R                  5      :  as  U R                  R                  nU R                  R	                  [        [        U R                  5      U5       Vs/ s H  n[        X[        X#-   S95      PM     sn5        gU R                  US2	 gs  snf )a  Resize the parameter vector.  If necessary, new elements are generated.

Note that the UUID of each :class:`.Parameter` element will be generated
deterministically given the root UUID of the ``ParameterVector`` and the index
of the element.  In particular, if a ``ParameterVector`` is resized to
be smaller and then later resized to be larger, the UUID of the later
generated element at a given index will be the same as the UUID of the
previous element at that index.
This is to ensure that the parameter instances do not change.

>>> from qiskit.circuit import ParameterVector
>>> pv = ParameterVector("theta", 20)
>>> elt_19 = pv[19]
>>> rv.resize(10)
>>> rv.resize(20)
>>> pv[19] == elt_19
True
r   N)r-   r
   r   r   extendr   r   r   )r   r   r   r   s       r   resizeParameterVector.resizeX   s    & C%% OO//MLL #3t||#4f== +4D]=N4OP= VW%s   &BN)r   )r8   
__module____qualname____firstlineno____doc__	__slots__r   propertyr   r   r    r&   r*   r.   r3   r:   r=   r@   rE   rI   __static_attributes__ r   r   r   r      sp     3I
    ) !!EX/5D&r   r   N)rN   uuidr   r   qiskit._accelerate.circuitr   r   rR   r   r   <module>rU      s    H  =`& `&r   