quara.interface.forest.api module
- calc_coefficient_matrix(pauli_strings, povm)[source]
Calculates coefficient matrix for calculatig empi dist from observables.
- Parameters
pauli_strings (List[str]) – List of pauli strings which are considered as operators of observables.
povm (Povm) – POVM that is the target of generating probability distribution.
- Returns
2d matrix that converts a list of observables to a probability distribution.
- Return type
np.ndarray
- calc_coefficients(pauli_string, povm)[source]
Calculates a list of coefficients that correspond observables to a probability of a POVM item.
- Parameters
pauli_string (str) – Pauli string which corresponds to an operator of the obtained expectation.
povm (Povm) – POVM that is the targeto of generating probability distribution.
- Returns
List of coefficients for calculating a probability from Pauli observables.
- Return type
List[int]
- calc_empi_dist_from_observables(observables, num_shots, pauli_strings, povm)[source]
Calculates the empirical distribution of POVM from observables.
- Parameters
observable (List[float]) – List of observables measured by the Forest SDK.
num_shots (int) – Number of measurement shots performed per observable.
pauli_strings (List[str]) – List of strings that expresses a pauli operator which was used in the measurement.
povm (Povm) – Quara’s povm object which correspond to given pauli_strings.
observables (List[float]) –
- Returns
Empirical distribution that is compatible with Quara’s tomography features.
- Return type
Tuple[int, List[np.ndarray]]
- generate_pauli_operator_from_pauli_string(pauli_string)[source]
Generates QuTip Qobj from given Pauli string in Forest SDK format.
- Parameters
pauli_string (str) – A Pauli string which is considered as operator of an observable.
- Returns
QuTip Qobj that corresponds to the given Pauli string.
- Return type
Qobj
- generate_pauli_strings_from_povm_name(povm_name)[source]
Generates Pauli strings from given POVM name to construct a tomographical experiment.
- Parameters
povm_name (str) – Name of a POVM which is the target of the experiment.
- Returns
List of Pauli strings for observation that covers sufficient information of the given POVM.
- Return type
List[str]
- generate_preprocess_program(qubits, state_name)[source]
Generates a pyquil program for the state preparation of the qubit system.
- Parameters
qubits (List[int]) – Index configuration of the qubit system.
state_name (str) – Name of the desired state.
Returs –
------ –
Program – Program for the state preparation of the system
- Return type
pyquil.quil.Program
- generate_program_for_1qubit(qubit, state_name)[source]
Generates a pyquil program that prepares the desired for 1 qubit.
- Parameters
qubit (int) – Index of the target qubit.
state_name (str) – Name of the desired state which is z0, x0 or y0.
- Returns
Program for state preparation for the specific qubit
- Return type
Program