Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic general estimator creation #293

Merged
merged 17 commits into from
Dec 26, 2023
Merged

Conversation

dchung0741
Copy link
Contributor

@dchung0741 dchung0741 commented Dec 26, 2023

In this PR, we introduce the new GeneralEstimator object. It is a callable dataclass that holds all

  • QuantumEstimator
  • ConcurrentQuantumEstimator
  • ParametricQuantumEstimator
  • ConcurrentParametricQuantumEstimator

and performs expectation value estimation for generic input argument.

Creation:

Two functions are provided to create a general estimator from (concurrent) estimators automatically

  • create_general_estimator_from_estimator
  • create_general_estimator_from_concurrent_estimator

Usage: Create a general estimator that performs sampling estimation

# create general estimator from a sampling estimator
sampling_estimator = create_sampling_estimator(...)
general_estimator = create_general_estimator_from_estimator(sampling_estimator)

# operator
op1 = Operator({pauli_label("X0 Z1"): 1, PAULI_IDENTITY: 8 + 9j})
op2 = pauli_label("Z0 Z1")

# state
state_1 = quantum_state(n_qubits = 2, bits = 1)
state_2 = quantum_state(n_qubits = 2, bits = 2)

param_circuit = LinearMappedUnboundParametricQuantumCircuit(2)
theta = param_circuit.add_parameter("theta")
param_circuit.add_ParametricRX_gate(0, theta)
param_state = quantum_state(n_qubits = 2, circuit = param_circuit)


# estimate
general_estimator(op1, state1)

# concurrent estimate
general_estimator(op1, [state1, state2])
general_estimator([op1], [state1, state2])
general_estimator([op1, op2], state1)
general_estimator([op1, op2], [state1])
general_estimator([op1, op2], [state1, state2])

# parametric estimate
general_estimator(op1, param_state, [1, 2, 3])


# concurrent parametric estimate
general_estimator(op1, param_state, [[1, 2, 3], [4, 5, 6]])

Other related functions

  • create_concurrent_parametric_estimator_from_concurrent_estimator
  • create_parametric_estimator_from_concurrent_estimator
  • create_concurrent_estimator_from_estimator
  • create_estimator_from_concurrent_estimator

@dchung0741 dchung0741 changed the title Automatic estimator creation Automatic general estimator creation Dec 26, 2023
Copy link

@github-actions github-actions bot temporarily deployed to pull request December 26, 2023 03:46 Inactive
@toru4838 toru4838 merged commit 18dec61 into main Dec 26, 2023
8 checks passed
@toru4838 toru4838 deleted the automatic_estimator_creation branch December 26, 2023 06:02
@github-actions github-actions bot locked and limited conversation to collaborators Dec 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants