Skip to main content
IBM Quantum Platform

BaseEstimatorV1

class qiskit.primitives.BaseEstimatorV1(*, options=None)

GitHub

Bases: BasePrimitiveV1, Generic[T]

EstimatorV1 구현을 위한 베이스 클래스입니다.

키스킷의 참조 추정기는 EstimatorV2 인터페이스 사양을 대신 따른다는 점에 유의하세요.

추정기는 제공된 양자 회로와 관측 가능한 조합에 대한 기대값을 계산합니다.

의 구현은 BaseEstimatorV1BaseEstimatorV1._run() 의 구현은 공개적으로 호출되는 qiskit.primitives.BaseEstimatorV1.run()메서드를 정의해야 하며, 이 메서드는 다음 입력을 받습니다:

  • 양자 회로 ( ψi(θ)\psi_i(\theta) ): (매개변수가 지정된) 양자 회로 목록 (객체 목록 QuantumCircuit ).
  • 관찰 가능 ( HjH_j ): 객체 목록 SparsePauliOp 객체의 목록입니다.
  • 파라미터 값 ( θk\theta_k ): 양자 회로의 파라미터에 바인딩할 값의 집합 목록(실수 목록 목록).

이 메서드는 객체를 JobV1 반환합니다. 이 함수를 호출하면 기대값 목록과 함께, 추정치의 신뢰 qiskit.providers.JobV1.result() 구간과 같은 선택적 메타데이터가 반환됩니다.

ψi(θk)Hjψi(θk)\langle\psi_i(\theta_k)|H_j|\psi_i(\theta_k)\rangle

다음은 BaseEstimatorV1 를 사용하는 예는 다음과 같습니다:

# This is a fictional import path.
# There are currently no EstimatorV1 implementations in Qiskit.
from estimator_v1_location import EstimatorV1
from qiskit.circuit.library import RealAmplitudes
from qiskit.quantum_info import SparsePauliOp

psi1 = RealAmplitudes(num_qubits=2, reps=2)
psi2 = RealAmplitudes(num_qubits=2, reps=3)

H1 = SparsePauliOp.from_list([("II", 1), ("IZ", 2), ("XI", 3)])
H2 = SparsePauliOp.from_list([("IZ", 1)])
H3 = SparsePauliOp.from_list([("ZI", 1), ("ZZ", 1)])

theta1 = [0, 1, 1, 2, 3, 5]
theta2 = [0, 1, 1, 2, 3, 5, 8, 13]
theta3 = [1, 2, 3, 4, 5, 6]

estimator = EstimatorV1()

# calculate [ <psi1(theta1)|H1|psi1(theta1)> ]
job = estimator.run([psi1], [H1], [theta1])
job_result = job.result() # It will block until the job finishes.
print(f"The primitive-job finished with result {job_result}")

# calculate [ <psi1(theta1)|H1|psi1(theta1)>,
#             <psi2(theta2)|H2|psi2(theta2)>,
#             <psi1(theta3)|H3|psi1(theta3)> ]
job2 = estimator.run([psi1, psi2, psi1], [H1, H2, H3], [theta1, theta2, theta3])
job_result = job2.result()
print(f"The primitive-job finished with result {job_result}")

초기화 EstimatorV1.

매개변수

options (dict | None) – 기본 옵션.


속성

options

추정기에 대한 옵션 값을 반환합니다.

리턴

옵션


메소드

run

run(circuits, observables, parameter_values=None, **run_options)

GitHub

기대값 추정 작업을 실행합니다.

circuits, observables, parameter_values 의 길이가 같아야 합니다. 결과의 i 번째 요소는 관찰 가능한 기대치입니다

obs = observables[i]

에 의해 준비된 상태에 대해

circ = circuits[i]

바인딩된 매개변수 포함

values = parameter_values[i]

매개변수

  • circuits (Sequence[QuantumCircuit] | QuantumCircuit) – 하나 이상의 회로 객체.
  • observables (Sequence[BaseOperator | str] | BaseOperator | str) – 하나 이상의 관측 가능한 객체. 여러 형식이 허용됩니다. 중요한 점은 객체의 Pauli 문자열 표현 형식을 따라야 한다는 것입니다 str .
  • parameter_values (Sequence[Sequence[float]] | Sequence[float] | float | None) – 구속될 구체적인 매개변수들.
  • 실행_옵션 - 회로 실행에 사용되는 런타임 옵션입니다.

리턴

EstimatorResult 의 작업 개체입니다.

레이즈

  • TypeError - 잘못된 인수 유형이 지정되었습니다.
  • ValueError - 잘못된 인수 값이 지정되었습니다.

리턴 유형

T

set_options

set_options(**fields)

GitHub

추정기의 옵션 값을 설정합니다.

매개변수

**필드 - 옵션을 업데이트할 필드입니다

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