
    z	i              
          S r SSKJr  SSKJr  SSKJr  SSKJrJ	r	  SSK
Jr  SSKJr  SS	KJrJr  SS
KJr  S/r " S S\5      r\	\\\   \\\4   \\\\	\S4   4   4   rg)z
Sampler Pub class
    )annotations)Mapping)Integral)TupleUnion)QuantumCircuit)CircuitInstruction   )BindingsArrayBindingsArrayLike)ShapedMixinSamplerPubLikec                     ^  \ rS rSrSr   S
       SU 4S jjjr\SS j5       r\SS j5       r\SS j5       r	\
SSS jj5       rS rS	rU =r$ )
SamplerPub"   zPub (Primitive Unified Bloc) for a Sampler.

Pub is composed of tuple (circuit, parameter_values, shots).

If shots are provided this number of shots will be run with the sampler,
if ``shots=None`` the number of run shots is determined by the sampler.
c                   > [         TU ]  5         Xl        U=(       d
    [        5       U l        X0l        U R                  R                  U l        U(       a  U R                  5         gg)a?  Initialize a sampler pub.

Args:
    circuit: A quantum circuit.
    parameter_values: A bindings array.
    shots: A specific number of shots to run with. This value takes
        precedence over any value owed by or supplied to a sampler.
    validate: If ``True``, the input data is validated during initialization.
N)	super__init___circuitr   _parameter_values_shotsshape_shapevalidate)selfcircuitparameter_valuesshotsr   	__class__s        b/home/james-whalen/.local/lib/python3.13/site-packages/qiskit/primitives/containers/sampler_pub.pyr   SamplerPub.__init__+   sM      	!1!D]_,,22MMO     c                    U R                   $ )zA quantum circuit.)r   r   s    r    r   SamplerPub.circuitC   s     }}r"   c                    U R                   $ )zA bindings array.)r   r$   s    r    r   SamplerPub.parameter_valuesH   s     %%%r"   c                    U R                   $ )zAn specific number of shots to run with (optional).

This value takes precedence over any value owed by or supplied to a sampler.
)r   r$   s    r    r   SamplerPub.shotsM   s     {{r"   c                   UbF  [        U[        5      (       a  [        U[        5      (       a  [        S5      eUS::  a  [	        S5      e[        U[
        5      (       a/  UR                  c   Ub  U " UR                  UR                  USS9$ U$ [        U[        5      (       a  U " XSS9$ [        U[        5      (       a  [	        S	[        U5       S
35      e[        U5      S;  a  [	        S[        U5       S35      eUS   n[        U5      S:  aT  US   bN  US   n[        U[        [        45      (       d  [        UR                   5      U0n[        R"                  " U5      nOSn[        U5      S:  a  US   b  US   nU " X5USS9$ )a  Coerce a :class:`~.SamplerPubLike` object into a :class:`~.SamplerPub` instance.

Args:
    pub: An object to coerce.
    shots: An optional default number of shots to use if not
           already specified by the pub-like object.

Returns:
    A coerced sampler pub.
Nshots must be an integerr   shots must be positiveF)r   r   r   r   T)r   r   r   z'An invalid Sampler pub-like was given (z). If you want to run a single circuit, you need to wrap it with `[]` like `sampler.run([circuit])` instead of `sampler.run(circuit)`.)r
         z0The length of pub must be 1, 2 or 3, but length z
 is given.r
   r-   )
isinstancer   bool	TypeError
ValueErrorr   r   r   r   r   r	   typelenr   r   tuple
parameterscoerce)clspubr   r   valuesr   s         r    r7   SamplerPub.coerceU   s    eX..*UD2I2I :;;z !9::c:&&yy U%6KK%(%9%9"	  Jc>**s$??c-..9$s) E5 5  s89$B3s8*JW  a&s8a<CF.VFf}g&>?? 2 23V<,33F;#s8a<CF.FE7U]abbr"   c                2   [        U R                  [        5      (       d  [        S5      eU R                  R                  5         U R                  bd  [        U R                  [        5      (       a  [        U R                  [        5      (       a  [        S5      eU R                  S::  a  [        S5      eU R                  R                  nXR                  R                  :w  a3  SU SU R                  R                   S3nUS:X  a  US	-  n[        U5      eg)
zValidate the pub.zcircuit must be QuantumCircuit.Nr+   r   r,   zThe number of values (z+) does not match the number of parameters (z) for the circuit.z Note that if you want to run a single pub, you need to wrap it with `[]` like `sampler.run([(circuit, param_values)])` instead of `sampler.run((circuit, param_values))`.)r/   r   r   r1   r   r   r   r   r0   r2   num_parameters)r   r=   messages      r    r   SamplerPub.validate   s    $,,77=>>&&(::!djj(33z$**d7S7S :;;zzQ !9:: ..==\\888((8 9--1\\-H-H,II[]  ">
 W%% 9r"   )r   r   r   r   )NNT)r   r   r   zBindingsArray | Noner   
int | Noner   r0   )returnr   )rA   r   )rA   r@   )N)r9   r   r   r@   rA   r   )__name__
__module____qualname____firstlineno____doc__r   propertyr   r   r   classmethodr7   r   __static_attributes____classcell__)r   s   @r    r   r   "   s     26  / 	
  0   & &   7c 7cr& &r"   r   N)rF   
__future__r   collections.abcr   numbersr   typingr   r   qiskitr   qiskit.circuitr	   bindings_arrayr   r   r   r   __all__r   r    r"   r    <module>rT      s    # #   ! - <  
G& G&T 	.	.+
+,	.+U8T>-B
BCEr"   