Skip to main content
IBM Quantum Platform

구성 요소 풀에 페르미온 전이를 추가합니다

여기서는 각 전자 배열에 전이 연산자가 작용함으로써 얻어지는 전자 배열의 집합을 확장하는 기능들을 설명한다.

우리는 다음과 같은 유형의 단일 전자 도약 과정을 추가하는 방법을 보여줍니다:

cpσ†cqσ∣x⟩c^\dagger_{p\sigma} c_{q\sigma} |\textbf{x} \rangle

p,q=1,...,Norbp, q = 1, ..., N_\textrm{orb} 및 σ∈{↑,↓}\sigma \in \{ \uparrow, \downarrow\} 의 경우, 그리고 전자 배열 그룹에 속하는 모든 ∣x⟩|\textbf{x} \rangle 의 경우.

먼저 무작위 전자 배열을 한 번에 여러 개 생성하는 것으로 시작합니다:

import numpy as np

n_qubits = 8
n_orb = n_qubits // 2

rand_seed = 22
np.random.seed(rand_seed)


# Generate some random bitstrings for testing
def random_bitstrings(n_samples, n_qubits):
    return (
        np.round(np.random.rand(n_samples, n_qubits))
        .astype("int")
        .astype("bool")
    )


bitstring_matrix = random_bitstrings(100, n_qubits)

여기 연산자는 길이가 페르미온 노드(또는 큐비트)의 개수와 동일한 numpy 배열 내에 지정됩니다. 배열의 각 요소는 다음 값을 가질 수 있는 문자열이어야 합니다:

  • 'I': 정체성
  • '+': 생성 연산자
  • '-': 소멸 연산자

우리는 (동일한 스핀을 가진 종들 사이에서) 가능한 모든 단일 전자 전이를 생성합니다.

transitions_single = np.array(
    [
        ["I" for i in range(2 * n_orb)]
        for j in range(4 * (n_orb**2 - n_orb) // 2 + 1)
    ]
)
count = 1
for i in range(n_orb):
    for j in range(i + 1, n_orb):
        # spin up
        transitions_single[count, i] = "+"
        transitions_single[count, j] = "-"
        count += 1
        transitions_single[count, i] = "-"
        transitions_single[count, j] = "+"
        count += 1

        # spin down
        transitions_single[count, i + n_orb] = "+"
        transitions_single[count, j + n_orb] = "-"
        count += 1
        transitions_single[count, i + n_orb] = "-"
        transitions_single[count, j + n_orb] = "+"
        count += 1

print(transitions_single)

Output:

[['I' 'I' 'I' 'I' 'I' 'I' 'I' 'I']
 ['+' '-' 'I' 'I' 'I' 'I' 'I' 'I']
 ['-' '+' 'I' 'I' 'I' 'I' 'I' 'I']
 ['I' 'I' 'I' 'I' '+' '-' 'I' 'I']
 ['I' 'I' 'I' 'I' '-' '+' 'I' 'I']
 ['+' 'I' '-' 'I' 'I' 'I' 'I' 'I']
 ['-' 'I' '+' 'I' 'I' 'I' 'I' 'I']
 ['I' 'I' 'I' 'I' '+' 'I' '-' 'I']
 ['I' 'I' 'I' 'I' '-' 'I' '+' 'I']
 ['+' 'I' 'I' '-' 'I' 'I' 'I' 'I']
 ['-' 'I' 'I' '+' 'I' 'I' 'I' 'I']
 ['I' 'I' 'I' 'I' '+' 'I' 'I' '-']
 ['I' 'I' 'I' 'I' '-' 'I' 'I' '+']
 ['I' '+' '-' 'I' 'I' 'I' 'I' 'I']
 ['I' '-' '+' 'I' 'I' 'I' 'I' 'I']
 ['I' 'I' 'I' 'I' 'I' '+' '-' 'I']
 ['I' 'I' 'I' 'I' 'I' '-' '+' 'I']
 ['I' '+' 'I' '-' 'I' 'I' 'I' 'I']
 ['I' '-' 'I' '+' 'I' 'I' 'I' 'I']
 ['I' 'I' 'I' 'I' 'I' '+' 'I' '-']
 ['I' 'I' 'I' 'I' 'I' '-' 'I' '+']
 ['I' 'I' '+' '-' 'I' 'I' 'I' 'I']
 ['I' 'I' '-' '+' 'I' 'I' 'I' 'I']
 ['I' 'I' 'I' 'I' 'I' 'I' '+' '-']
 ['I' 'I' 'I' 'I' 'I' 'I' '-' '+']]

bitstring_matrix이제 다음의 구성에 전이 연산자를 적용해 보겠습니다:

from qiskit_addon_sqd.fermion import enlarge_batch_from_transitions

bitstring_matrix_aug = enlarge_batch_from_transitions(
    bitstring_matrix, transitions_single
)

print(bitstring_matrix_aug.shape)
print(bitstring_matrix_aug)

Output:

(723, 8)
[[False False False ... False False  True]
 [False  True False ...  True False False]
 [ True  True  True ...  True False  True]
 ...
 [ True False  True ... False False  True]
 [ True  True  True ...  True False  True]
 [False False False ... False False  True]]
이 페이지가 도움이 되었습니까?
GitHub에서 버그, 오타를 보고하거나 컨텐츠를 요청하십시오.