bath_mapper.linear_chain_optimisation
Linear chain optimisation module
|
Given a device and the length of a chain, this function finds all of the simple chains with the given number of system qubits (length of the chain), where each system qubit has an associated bath qubit. |
|
Given a device and the length of a chain, this function finds all of the simple chains with the given number of system qubits (length of the chain), where each system qubit has two associated bath qubits. |
|
Given a device and a list of of candidates, this function selects the best chain of system qubits with associated bath qubits in the list of candidates. |
|
Given a device and a list of of candidates, this function selects the best chain of system qubits with associated bath qubits in the list of candidates. |
|
Given a device and a vector of bath qubits, this function returns a HashMap of the bath qubits and their corresponding broadening. |
|
Create the logical to physical mapping for system qubits and bath qubits, for a bilinear chain. |
|
Create the logical to physical mapping for system qubits and bath qubits, for a trilinear chain. |
|
Given a device which implements the ChainWithEnvironmentDevice trait, a length of chain required and the ratio of bath to system qubits required, this function finds all of the chains with the given number of system qubits (length of the chain), where each system qubit has an associated bath qubit. |
Functions
|
Given a device and a vector of bath qubits, this function returns a HashMap of the bath qubits and their corresponding broadening. |
|
Given a device which implements the ChainWithEnvironmentDevice trait, a length of chain required and the ratio of bath to system qubits required, this function finds all of the chains with the given number of system qubits (length of the chain), where each system qubit has an associated bath qubit. |
|
Given a device and the length of a chain, this function finds all of the simple chains with the given number of system qubits (length of the chain), where each system qubit has an associated bath qubit. |
|
Given a device and the length of a chain, this function finds all of the simple chains with the given number of system qubits (length of the chain), where each system qubit has two associated bath qubits. |
|
Create the logical to physical mapping for system qubits and bath qubits, for a bilinear chain. |
|
Create the logical to physical mapping for system qubits and bath qubits, for a trilinear chain. |
|
Given a device and a list of of candidates, this function selects the best chain of system qubits with associated bath qubits in the list of candidates. |
|
Given a device and a list of of candidates, this function selects the best chain of system qubits with associated bath qubits in the list of candidates. |
- bath_mapper.linear_chain_optimisation.broadenings(bath_qubits, device, noise_models=None)
Given a device and a vector of bath qubits, this function returns a HashMap of the bath qubits and their corresponding broadening.
For each bath qubit, the broadening $ b $ is calculated according to: $ b = gamma_{damp} / 2 + gamma_{depol} + 2 gamma_{deph} $ where $ gamma_{damp} $ is the damping rate of the qubit, $ gamma_{depol} $ is the depolarising rate of the qubit, and $ gamma_{deph} $ is the dephasing rate of the qubit. Note that the bath mapping framework generally assumes that gamma_{depol}=0. A finite depolarising rate will introduce an error in the mapping, which is assumed to be reduced when using this formula.
- Parameters:
bath_qubits -- The bath qubits for which to calculate the broadenings.
device -- The device of the bath qubits.
noise_models -- The qoqo NoiseModels to use to calculate the broadenings.
- Returns:
The dictionary of qubits and their corresponding broadenings.
- Return type:
Dict[int, float]
- Raises:
TypeError -- Could not convert device to SquareLatticeDevice.
TypeError -- Could not convert noise models to ContinuousDecoherenceModel.
ValueError -- No decoherence rates in device for a given qubit.
- bath_mapper.linear_chain_optimisation.chain_with_environment_candidates(device, chain_length, ratio)
Given a device which implements the ChainWithEnvironmentDevice trait, a length of chain required and the ratio of bath to system qubits required, this function finds all of the chains with the given number of system qubits (length of the chain), where each system qubit has an associated bath qubit.
The candidates for this selection read from the environment_chains function of the given device.
- Parameters:
device (Device) -- The device on which to find all the chains of a given length and with a given ratio.
chain_length (int) -- The number of qubits in the system part of the chain, which corresponds to the length of the chain.
ratio (Tuple[int, int]) -- The ratio of (number_bath_qubits, number_system_qubits) to be used in the chain selection.
- Returns:
The vector of candidates, where each element in the vector is a tuple, containing the vector of system qubits in the chain and the system-bath connectivity.
- Return type:
(List[Tuple[List[int], dict[int, List[int]]]])
- Raises:
TypeError -- Could not convert device.
ValueError -- Could not fit a chain of the given length on the given device.
ValueError -- The input ratio requires more system qubits than the input chain length
- bath_mapper.linear_chain_optimisation.create_candidates_bilinear(number_system, device)
Given a device and the length of a chain, this function finds all of the simple chains with the given number of system qubits (length of the chain), where each system qubit has an associated bath qubit.
Only simple chains are found in this function: horizontal chains and vertical chains. Each chain represents the qubits of the system. The bath qubits are not part of the chain. For each system qubit in the chain a neighbouring qubit (outside of the chain) is used as its associated bath qubit. No optimization happens here, so in the worst case scenario this should scale to produce $mathcal{O}(N)$ candidates where N is the number of qubits in the device.
- Parameters:
number_system -- The number of qubits in the system part of the chain, which corresponds to the length of the chain. For each system qubit, a bath qubit will be found above or below it on the device.
device -- The device on which to find all the chains of a given length.
- Returns:
The vector of candidates, where each element in the vector is a Tuple, containing the vector of system qubits in the chain and a HashMap linking each system qubit in the vector to a bath qubit.
- Return type:
List[(List[int], Dict[int, int])]
- Raises:
TypeError -- Could not convert device to SquareLatticeDevice.
ValueError -- Could not fit a chain of length number_system on the given device.
- bath_mapper.linear_chain_optimisation.create_candidates_trilinear(number_system, device)
Given a device and the length of a chain, this function finds all of the simple chains with the given number of system qubits (length of the chain), where each system qubit has two associated bath qubits.
Only simple chains are found in this function: horizontal chains and vertical chains. Each chain represents the qubits of the system. The bath qubits are not part of the chain. For each system qubit in the chain two neighbouring qubits (outside of the chain) are used as its two associated bath qubits. No optimization happens here, so in the worst case scenario this should scale to produce $mathcal{O}(N)$ candidates where N is the number of qubits in the device.
- Parameters:
number_system -- The number of qubits in the system part of the chain, which corresponds to the length of the chain. For each system qubit, two bath qubits will be found above or below it on the device.
device -- The device on which to find all the chains of a given length.
- Returns:
The vector of candidates, where each element in the vector is a Tuple, containing the vector of system qubits in the chain and two HashMaps linking each system qubit in the vector to a bath qubit.
- Return type:
List[(List[int], Dict[int, int], Dict[int, int])]
- Raises:
TypeError -- Could not convert device to SquareLatticeDevice.
ValueError -- Could not fit a chain of length number_system on the given device.
- bath_mapper.linear_chain_optimisation.logical_to_physical_mappings_bilinear(candidate)
Create the logical to physical mapping for system qubits and bath qubits, for a bilinear chain.
The system qubits will have the logical qubits 0 to N - 1, where N is the number of system qubits. As there is only one line of bath qubits, they will also be numbered (logical qubit) 0 to N - 1, where N is the number of bath qubits.
- Parameters:
candidate -- The bilinear chain of qubits to create the logical to physical mapping for.
- Returns:
The dictionary of system logical to physical qubits and the dictionary of bath logical to physical qubits.
- Return type:
(Dict[int, int], Dict[int, int])
- bath_mapper.linear_chain_optimisation.logical_to_physical_mappings_trilinear(candidate)
Create the logical to physical mapping for system qubits and bath qubits, for a trilinear chain.
The system qubits will have the logical qubits 0 to N - 1, where N is the number of system qubits. The first line of bath qubits will be numbered (logical qubit) 0 to N - 1 and the second line of bath qubits will be numbered N to 2N - 1, where N is the number of bath qubits.
- Parameters:
candidate -- The trilinear chain of qubits to create the logical to physical mapping for.
- Returns:
The dictionary of system logical to physical qubits and the two dictionaries of bath logical to physical qubits.
- Return type:
(Dict[int, int], Dict[int, int], Dict[int, int])
- bath_mapper.linear_chain_optimisation.select_optimised_bilinear_chain(candidates, device, optimisation='zz', normalise_by_bath=False, noise_models=None)
Given a device and a list of of candidates, this function selects the best chain of system qubits with associated bath qubits in the list of candidates.
- The optimisation options are defined as follows:
XXYYZZ finds the chain with the smallest contribution of all Lindblad noise operators combined.
XXYY finds the chain with the smallest contribution of only the X and Y Lindblad operators.
ZZ finds the chain with the smallest contribution of ZZ Lindblad operators (corresponding to only searching for the chain with smallest dephasing).
- Parameters:
candidates (List[Tuple[List[int], List[int]]]) -- The candidates in which to find the best bilinear chain.
device (Device) -- The device for which to find the best chain.
optimisation (str) -- Which type of optimisation to use (zz, xxyy or xxyyzz). Defaults to zz.
normalise_by_bath (bool) -- Whether or not to normalise the chain minimum as the smallest noise on the system chain divided by the noise on the bath sites.
noise_models (Optional[List[NoiseModel]])
- Returns:
The best candidate in the given list of candidates.
- Return type:
(List[int], Dict[int, int])
- Raises:
TypeError -- Could not convert device to SquareLatticeDevice.
ValueError -- Candidates list is empty.
ValueError -- No decoherence rates in device for given qubit.
- bath_mapper.linear_chain_optimisation.select_optimised_trilinear_chain(candidates, device, optimisation='zz', normalise_by_bath=False, noise_models=None)
Given a device and a list of of candidates, this function selects the best chain of system qubits with associated bath qubits in the list of candidates.
- The optimisation options are defined as follows:
XXYYZZ finds the chain with the smallest contribution of all Lindblad noise operators combined.
XXYY finds the chain with the smallest contribution of only the X and Y Lindblad operators.
ZZ finds the chain with the smallest contribution of ZZ Lindblad operators (corresponding to only searching for the chain with smallest dephasing).
- Parameters:
candidates (List[Tuple[List[int], List[int], List[int]]]) -- The candidates in which to find the best trilinear chain.
device (Device) -- The device for which to find the best chain.
optimisation (str) -- Which type of optimisation to use (zz, xxyy or xxyyzz). Defaults to zz.
normalise_by_bath (bool) -- Whether or not to normalise the chain minimum as the smallest noise on the system chain divided by the noise on the bath sites.
noise_models (Optional[List[NoiseModel]])
- Returns:
The best candidate in the given list of candidates.
- Return type:
(List[int], Dict[int, int], Dict[int, int])
- Raises:
TypeError -- Could not convert device to SquareLatticeDevice.
ValueError -- Candidates list is empty.
ValueError -- No decoherence rates in device for given qubit.