
    z	i                         S r SSKJr  SSKJr  SSKJrJrJr  SSK	J
r
  SSKJrJr   " S S\5      r\" \R                   " 5       5      \" \R                   " 5       5      -   / S	Q-   rSS
 jrS rg)zBReplace each sequence of Clifford gates by a single Clifford gate.    )partial)QiskitError)CollectAndCollapsecollect_using_filter_functioncollapse_to_operationClifford)	_BASIS_1Q	_BASIS_2Qc                   >   ^  \ rS rSrSr       SU 4S jjrSrU =r$ )CollectCliffords   zhCollects blocks of Clifford gates and replaces them by a :class:`~qiskit.quantum_info.Clifford`
object.
c           
         > [        [        [        [        US9UUUUUS9n[        [        [        S9n	[
        T
U ]  UU	US9  g)a  CollectCliffords initializer.

Args:
    do_commutative_analysis (bool): if True, exploits commutativity relations
        between nodes.
    split_blocks (bool): if True, splits collected blocks into sub-blocks
        over disjoint qubit subsets.
    min_block_size (int): specifies the minimum number of gates in the block
        for the block to be collected.
    split_layers (bool): if True, splits collected blocks into sub-blocks
        over disjoint qubit subsets.
    collect_from_back (bool): specifies if blocks should be collected started
        from the end of the circuit.
    matrix_based (bool): specifies whether to collect unitary gates
       which are Clifford gates only for certain parameters (based on their unitary matrix).
    max_block_width (int | None): specifies the maximum width of the block
        (that is, the number of qubits over which the block is defined)
        for the block to be collected.
)matrix_based)filter_functionsplit_blocksmin_block_sizesplit_layerscollect_from_backmax_block_width)collapse_function)collect_functionr   do_commutative_analysisN)r   r   _is_clifford_gater   _collapse_to_cliffordsuper__init__)selfr   r   r   r   r   r   r   r   r   	__class__s             q/home/james-whalen/.local/lib/python3.13/site-packages/qiskit/transpiler/passes/optimization/collect_cliffords.pyr   CollectCliffords.__init__"   sY    < #)#$5LQ%)%/+
 $$9Mbc-/$; 	 	
     )FT   FFFN)__name__
__module____qualname____firstlineno____doc__r   __static_attributes____classcell__)r   s   @r    r   r      s)     !&-
 -
r"   r   )cliffordlinear_functionpaulipermutationc                     [        U R                  SS5      b  gU R                  R                  [        ;   a  gU(       d  g [	        U R                  5        g! [
         a     gf = f)z/Specifies whether a node holds a clifford gate.
_conditionNFT)getattropnameclifford_gate_namesr	   r   )noder   s     r    r   r   Y   sX    twwd+7ww||** s   A 
A%$A%c                     [        U 5      $ )zlSpecifies how to construct a ``Clifford`` from a quantum circuit (that must
consist of Clifford gates only).r   )circuits    r    r   r   j   s     Gr"   N)F)r)   	functoolsr   qiskit.exceptionsr   :qiskit.transpiler.passes.optimization.collect_and_collapser   r   r   qiskit.quantum_info.operatorsr	   :qiskit.quantum_info.operators.symplectic.clifford_circuitsr
   r   r   listkeysr5   r   r   r#   r"   r    <module>r@      sm    I  )  3 [2
) 2
l 		
9>>=> "r"   