Skip to main content
IBM Quantum Platform

ExcitationPreserving

class qiskit.circuit.library.ExcitationPreserving(num_qubits=None, mode='iswap', entanglement='full', reps=3, skip_unentangled_qubits=False, skip_final_rotation_layer=False, parameter_prefix='θ', insert_barriers=False, initial_state=None, name='ExcitationPreserving', flatten=None)

GitHub

베이스: TwoLocal

휴리스틱 여기 보존 파동 함수 안사츠.

ExcitationPreserving 회로는 00|00\rangle, 01+10|01\rangle + |10\rangle11|11\rangle 상태의 비율을 유지합니다. 이를 위해 이 회로는 다음과 같은 형식의 2-큐비트 상호작용을 사용합니다

(10000cos(θ/2)isin(θ/2)00isin(θ/2)cos(θ/2)0000eiϕ)\providecommand{\rotationangle}{\theta/2} \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & \cos\left(\rotationangle\right) & -i\sin\left(\rotationangle\right) & 0 \\ 0 & -i\sin\left(\rotationangle\right) & \cos\left(\rotationangle\right) & 0 \\ 0 & 0 & 0 & e^{-i\phi} \end{pmatrix}

모드의 경우 'fsim' 또는 eiϕ=1e^{-i\phi} = 1 모드의 경우 'iswap'.

UCC-안사츠와 같은 다른 파동 함수도 여기 보존 기능이 있다는 점에 유의하세요. 그러나 이러한 회로는 빠르게 복잡해질 수 있는 반면, 휴리스틱 동기에 의한 회로는 더 단순한 패턴을 따릅니다.

이 시험용 파동 함수는 2-큐비트 얽힘을 가진 ZZ 회전 층들로 구성되어 있습니다. 이 얽힘은 XX+YYXX+YY 회전을 사용하여 생성되며, 선택적으로 모드에 대해 위상 제어 'fsim'게이트를 적용하기도 합니다.

얽힘이 없는 큐비트를 건너뛰는 것과 같은 가능한 인자와 옵션에 대한 자세한 내용은 RealAmplitudes [여기]를 참조하십시오. 이 내용들은 여기에도 적용됩니다.

ExcitationPreserving 안사츠의 회전은 다음과 같이 작성할 수 있습니다

예제

>>> ansatz = ExcitationPreserving(3, reps=1, insert_barriers=True, entanglement='linear')
>>> print(ansatz.decompose())  # show the circuit
     ┌──────────┐ ░ ┌────────────┐┌────────────┐                             ░ ┌──────────┐
q_0:RZ(θ[0]) ├─░─┤0           ├┤0           ├─────────────────────────────░─┤ RZ(θ[5])
     ├──────────┤ ░ │  RXX(θ[3]) ││  RYY(θ[3]) │┌────────────┐┌────────────┐ ░ ├──────────┤
q_1:RZ(θ[1]) ├─░─┤1           ├┤1           ├┤0           ├┤0           ├─░─┤ RZ(θ[6])
     ├──────────┤ ░ └────────────┘└────────────┘│  RXX(θ[4]) ││  RYY(θ[4]) │ ░ ├──────────┤
q_2:RZ(θ[2]) ├─░─────────────────────────────┤1           ├┤1           ├─░─┤ RZ(θ[7])
     └──────────┘ ░                             └────────────┘└────────────┘ ░ └──────────┘
>>> ansatz = ExcitationPreserving(2, reps=1, flatten=True)
>>> qc = QuantumCircuit(2)  # create a circuit and append the RY variational form
>>> qc.cry(0.2, 0, 1)  # do some previous operation
>>> qc.compose(ansatz, inplace=True)  # add the excitation-preserving
>>> qc.draw()
                ┌──────────┐┌────────────┐┌────────────┐┌──────────┐
q_0: ─────■─────┤ RZ(θ[0]) ├┤0           ├┤0           ├┤ RZ(θ[3])
     ┌────┴────┐├──────────┤│  RXX(θ[2]) ││  RYY(θ[2]) │├──────────┤
q_1:RY(0.2) ├┤ RZ(θ[1]) ├┤1           ├┤1           ├┤ RZ(θ[4])
     └─────────┘└──────────┘└────────────┘└────────────┘└──────────┘
>>> ansatz = ExcitationPreserving(3, reps=1, mode='fsim', entanglement=[[0,2]],
... insert_barriers=True, flatten=True)
>>> print(ansatz.decompose())
     ┌──────────┐ ░ ┌────────────┐┌────────────┐        ░ ┌──────────┐
q_0:RZ(θ[0]) ├─░─┤0           ├┤0           ├─■──────░─┤ RZ(θ[5])
     ├──────────┤ ░ │            ││            │ │      ░ ├──────────┤
q_1:RZ(θ[1]) ├─░─┤  RXX(θ[3]) ├┤  RYY(θ[3]) ├─┼──────░─┤ RZ(θ[6])
     ├──────────┤ ░ │            ││            │ │θ[4]  ░ ├──────────┤
q_2:RZ(θ[2]) ├─░─┤1           ├┤1           ├─■──────░─┤ RZ(θ[7])
     └──────────┘ ░ └────────────┘└────────────┘        ░ └──────────┘
관련 참조

함수는 excitation_preserving() 함수는 기능적으로 동등한 회로를 구성하지만 더 빠릅니다.

버전부터 사용되지 않음 2.1

qiskit.circuit.library.n_local.excitation_preserving.ExcitationPreserving 클래스는 키스킷 2.1 에서 더 이상 사용되지 않습니다. 키스킷 3.0 에서 제거됩니다. 대신 qiskit.circuit.library.excitation_preserving 함수를 사용하세요.

매개변수

  • num_qubits (int | None) – ExcitationPreserving 회로의 큐비트 수입니다.
  • mode (str) – 인탱글러 모드를 선택하면 'iswap' 또는 'fsim' 중 하나를 선택할 수 있습니다.
  • reps (int) – 회전 레이어와 얽힘 레이어의 구조가 얼마나 자주 반복되는지 지정합니다.
  • entanglement (str |list[list[int]] | Callable[[int], list[int]]) – 얽힘 구조를 지정합니다. 문자열('full', 'linear' 또는 'sca'), 서로 얽힌 큐비트의 인덱스를 지정하는 정수 쌍의 목록 또는 얽힘 계층의 인덱스와 함께 제공된 이러한 목록을 반환하는 콜러블일 수 있습니다. 의 예시 섹션을 참조하세요 TwoLocal 의 예제 섹션을 참조하세요.
  • initial_state (QuantumCircuit | None) – 회로 앞에 추가할 QuantumCircuit 객체.
  • skip_unentangled_qubits (bool) – True이면 단일 큐비트 게이트는 다른 큐비트와 얽혀 있는 큐비트에만 적용됩니다. False인 경우, 단일 큐비트 게이트가 Ansatz의 각 큐비트에 적용됩니다. 기본값은 False입니다.
  • skip_final_rotation_layer (bool) – True이면 회전 레이어가 안사츠의 끝에 추가됩니다. False이면 회전 레이어가 추가되지 않습니다. true로 기본값이 지정됩니다.
  • parameter_prefix (str) – 파라미터화된 게이트는 파라미터를 정의해야 하며, 이를 위해 ParameterVector.
  • insert_barriers (bool) – True를 선택하면 각 레이어 사이에 장벽이 삽입됩니다. False이면 장벽이 삽입되지 않습니다.
  • flatten (bool | None) – 여러 개의 게이트 오브젝트 레이어 안에 중첩하는 대신 평면 회로를 출력하려면 True 으로 설정합니다. 현재 기본적으로 출력 회로의 내용은 보다 깔끔한 시각화를 위해 중첩된 객체로 래핑됩니다. 그러나 시각화 이외의 다른 용도로 이 회로를 사용하는 경우 매개변수 바인딩으로 인한 성능 오버헤드가 크지 않도록 이 플래그를 True 로 설정하는 것이 좋습니다.
  • name (str) – 회로 이름.

레이즈

ValueError - 선택한 모드가 지원되지 않는 경우.


속성

parameter_bounds

매개변수 바운드를 반환합니다.

리턴

매개변수 바운드입니다.

name

유형: str

사람이 읽을 수 있는 회로의 이름입니다.

예제

from qiskit import QuantumCircuit

qc = QuantumCircuit(2, 2, name="my_circuit")
print(qc.name)
my_circuit
이 페이지가 도움이 되었습니까?
GitHub에서 버그, 오타를 보고하거나 컨텐츠를 요청하십시오.