qutip_qip.device package

Submodules

qutip_qip.device.cavityqed module

class qutip_qip.device.cavityqed.DispersiveCavityQED(num_qubits, correct_global_phase=True, num_levels=10, t1=None, t2=None, **params)[source]

Bases: qutip_qip.device.modelprocessor.ModelProcessor

The processor based on the physical implementation of a dispersive cavity QED system. The available Hamiltonian of the system is predefined. For a given pulse amplitude matrix, the processor can calculate the state evolution under the given control pulse, either analytically or numerically. (Only additional attributes are documented here, for others please refer to the parent class ModelProcessor)

Parameters
num_qubits: int

The number of qubits in the system.

correct_global_phase: float, optional

Save the global phase, the analytical solution will track the global phase. It has no effect on the numerical solution.

num_levels: int, optional

The number of energy levels in the resonator.

t1: list or float, optional

Characterize the decoherence of amplitude damping for each qubit. A list of size num_qubits or a float for all qubits.

t2: list of float, optional

Characterize the decoherence of dephasing for each qubit. A list of size num_qubits or a float for all qubits.

**params:

Keyword argument for hardware parameters, in the unit of GHz. Qubit parameters can either be a float or a list of the length num_qubits.

  • deltamax: the pulse strength of sigma-x control, default 1.0

  • epsmax: the pulse strength of sigma-z control, default 9.5

  • eps: the bare transition frequency for each of the qubits, default 9.5

  • delta: the coupling between qubit states, default 0.0

  • g: the coupling strength between the resonator and the qubit, default 1.0

  • w0: the bare frequency of the resonator. Should only be a float, default 0.01

The dressed qubit frequency is wq is computed by \(w_q=\sqrt{\epsilon^2+\delta^2}\)

Attributes
wq: list of float

The frequency of the qubits calculated from eps and delta for each qubit.

Delta: list of float

The detuning with respect to w0 calculated from wq and w0 for each qubit.

property cavityqubit_ops

A list of interacting Hamiltonians between cavity and each qubit.

Type

list

eliminate_auxillary_modes(U)[source]

Eliminate the auxillary modes like the cavity modes in cqed.

property g_u

Pulse matrix for interacting Hamiltonians between cavity and each qubit.

Type

array-like

get_operators_labels()[source]

Get the labels for each Hamiltonian. It is used in the method method Processor.plot_pulses(). It is a 2-d nested list, in the plot, a different color will be used for each sublist.

load_circuit(qc, schedule_mode='ASAP', compiler=None)[source]

The default routine of compilation. It first calls the transpile() to convert the circuit to a suitable format for the hardware model. Then it calls the compiler and save the compiled pulses.

Parameters
qcQubitCircuit

Takes the quantum circuit to be implemented.

schedule_mode: string

“ASAP” or “ALAP” or None.

compiler: subclass of :class:`.GateCompiler`

The used compiler.

Returns
tlist, coeffs: dict of 1D NumPy array

A dictionary of pulse label and the time sequence and compiled pulse coefficients.

set_up_ops(num_qubits)[source]

Generate the Hamiltonians for the spinchain model and save them in the attribute ctrls.

Parameters
num_qubits: int

The number of qubits in the system.

set_up_params()[source]

Compute the qubit frequency and detune.

property sx_ops

A list of sigmax Hamiltonians for each qubit.

Type

list

property sx_u

Pulse matrix for sigmax Hamiltonians.

Type

array-like

property sz_ops

A list of sigmaz Hamiltonians for each qubit.

Type

list

property sz_u

Pulse matrix for sigmaz Hamiltonians.

Type

array-like

qutip_qip.device.circuitqed module

class qutip_qip.device.circuitqed.SCQubits(num_qubits, t1=None, t2=None, zz_crosstalk=False, **params)[source]

Bases: qutip_qip.device.modelprocessor.ModelProcessor

A chain of superconducting qubits with fixed frequency. Single-qubit control is realized by rotation around the X and Y axis while two-qubit gates are implemented with Cross Resonance gates. A 3-level system is used to simulate the superconducting qubit system, in order to simulation leakage. Various types of interaction can be realized on a superconducting system, as a demonstration and for simplicity, we only use a ZX Hamiltonian for the two-qubit interaction. For details see https://arxiv.org/abs/2005.12667 and https://journals.aps.org/pra/abstract/10.1103/PhysRevA.101.052308.

Parameters
num_qubits: int

Number of qubits

t1, t2: float or list, optional

Coherence time for all qubit or each qubit

zz_crosstalk: bool, optional

if zz cross talk is included.

**params:

Keyword argument for hardware parameters, in the unit of GHz. Each can should be given as list:

  • wq: qubit bare frequency, default 5.15 and 5.09 for each pair of superconducting qubits, e.g. [5.15, 5.09, 5.15, ...]

  • wr: resonator bare frequency, default [5.96]*num_qubits

  • g: The coupling strength between the resonator and the qubits, default [0.1]*(num_qubits - 1)

  • alpha: anharmonicity for each superconducting qubit, default [-0.3]*num_qubits

  • omega_single: control strength for single-qubit gate, default [0.01]*num_qubits

  • omega_cr: control strength for cross resonance gate, default [0.01]*num_qubits

Attributes
dims: list

Dimension of the subsystem, e.g. [3,3,3].

pulse_mode: “discrete” or “continuous”

Given pulse is treated as continuous pulses or discrete step functions.

native_gates: list of str

The native gate sets

get_operators_labels()[source]

Get the labels for each Hamiltonian. It is used in the method method Processor.plot_pulses(). It is a 2-d nested list, in the plot, a different color will be used for each sublist.

set_up_ops()[source]

Setup the operators. We use 2π σ/2 as the single-qubit control Hamiltonian and -2πZX/4 as the two-qubit Hamiltonian.

set_up_params()[source]

Compute the dressed frequency and the interaction strength.

topology_map(qc)[source]

Map the circuit to the hardware topology.

qutip_qip.device.modelprocessor module

class qutip_qip.device.modelprocessor.ModelProcessor(num_qubits, correct_global_phase=True, t1=None, t2=None, N=None)[source]

Bases: qutip_qip.device.processor.Processor

The base class for a circuit processor simulating a physical device, e.g cavityQED, spinchain. The available Hamiltonian of the system is predefined. The processor can simulate the evolution under the given control pulses either numerically or analytically. It cannot be used alone, please refer to the sub-classes. (Only additional attributes are documented here, for others please refer to the parent class Processor)

Parameters
num_qubits: int

The number of component systems.

correct_global_phase: boolean, optional

If true, the analytical solution will track the global phase. It has no effect on the numerical solution.

t1: list or float

Characterize the decoherence of amplitude damping for each qubit. A list of size num_qubits or a float for all qubits.

t2: list of float

Characterize the decoherence of dephasing for each qubit. A list of size num_qubits or a float for all qubits.

Attributes
correct_global_phase: float

Save the global phase, the analytical solution will track the global phase. It has no effect on the numerical solution.

get_ops_and_u()[source]

Get the labels for each Hamiltonian.

Returns
ctrls: list

The list of Hamiltonians

coeffs: array_like

The transposed pulse matrix

load_circuit(qc, schedule_mode='ASAP', compiler=None)[source]

The default routine of compilation. It first calls the transpile() to convert the circuit to a suitable format for the hardware model. Then it calls the compiler and save the compiled pulses.

Parameters
qcQubitCircuit

Takes the quantum circuit to be implemented.

schedule_mode: string

“ASAP” or “ALAP” or None.

compiler: subclass of :class:`.GateCompiler`

The used compiler.

Returns
tlist, coeffs: dict of 1D NumPy array

A dictionary of pulse label and the time sequence and compiled pulse coefficients.

property params

A Python dictionary contains the name and the value of the parameters in the physical realization, such as laser frequency, detuning etc.

Type

dict

pulse_matrix(dt=0.01)[source]

Generates the pulse matrix for the desired physical system.

Returns
t, u, labels:

Returns the total time and label for every operation.

run_state(init_state=None, analytical=False, qc=None, states=None, **kwargs)[source]

If analytical is False, use qutip.mesolve() to calculate the time of the state evolution and return the result. Other arguments of qutip.mesolve() can be given as keyword arguments. If analytical is True, calculate the propagator with matrix exponentiation and return a list of matrices.

Parameters
init_state: Qobj

Initial density matrix or state vector (ket).

analytical: boolean

If True, calculate the evolution with matrices exponentiation.

qcQubitCircuit, optional

A quantum circuit. If given, it first calls the load_circuit and then calculate the evolution.

statesqutip.Qobj, optional

Old API, same as init_state.

**kwargs

Keyword arguments for the qutip solver.

Returns
evo_result: qutip.Result

If analytical is False, an instance of the class qutip.Result will be returned.

If analytical is True, a list of matrices representation is returned.

set_up_params()[source]

Save the parameters in the attribute params and check the validity. (Defined in subclasses)

Notes

All parameters will be multiplied by 2*pi for simplicity

to_array(params, num_qubits)[source]

Transfer a parameter to an array.

topology_map(qc)[source]

Map the circuit to the hardware topology.

transpile(qc)[source]

Convert the circuit to one that can be executed on given hardware. If there is a method topology_map defined, it will use it to map the circuit to the hardware topology. If the processor has a set of native gates defined, it will decompose the given circuit to the native gates.

Parameters
qc: :class:`.QubitCircuit`

The input quantum circuit.

Returns
qc: QubitCircuit

The transpiled quantum circuit.

qutip_qip.device.optpulseprocessor module

class qutip_qip.device.optpulseprocessor.OptPulseProcessor(N, drift=None, t1=None, t2=None, dims=None)[source]

Bases: qutip_qip.device.processor.Processor

A processor, which takes the Hamiltonian available as dynamic generators, calls the qutip.control.optimize_pulse_unitary function to find an optimized pulse sequence for the desired quantum circuit. The processor can simulate the evolution under the given control pulses using qutip.mesolve(). (For attributes documentation, please refer to the parent class Processor)

Parameters
N: int

The number of component systems.

drift: `:class:`qutip.Qobj`

The drift Hamiltonian. The size must match the whole quantum system.

t1: list or float

Characterize the decoherence of amplitude damping for each qubit. A list of size N or a float for all qubits.

t2: list of float

Characterize the decoherence of dephasing for each qubit. A list of size N or a float for all qubits.

dims: list

The dimension of each component system. Default value is a qubit system of dim=[2,2,2,...,2]

load_circuit(qc, min_fid_err=inf, merge_gates=True, setting_args=None, verbose=False, **kwargs)[source]

Find the pulses realizing a given Circuit using qutip.control.optimize_pulse_unitary(). Further parameter for for qutip.control.optimize_pulse_unitary() needs to be given as keyword arguments. By default, it first merge all the gates into one unitary and then find the control pulses for it. It can be turned off and one can set different parameters for different gates. See examples for details.

Parameters
qcQubitCircuit or list of Qobj

The quantum circuit to be translated.

min_fid_err: float, optional

The minimal fidelity tolerance, if the fidelity error of any gate decomposition is higher, a warning will be given. Default is infinite.

merge_gates: boolean, optimal

If True, merge all gate/Qobj into one Qobj and then find the optimal pulses for this unitary matrix. If False, find the optimal pulses for each gate/Qobj.

setting_args: dict, optional

Only considered if merge_gates is False. It is a dictionary containing keyword arguments for different gates.

verbose: boolean, optional

If true, the information for each decomposed gate will be shown. Default is False.

**kwargs

keyword arguments for :func:qutip.control.optimize_pulse_unitary

Returns
tlist: array_like

A NumPy array specifies the time of each coefficient

coeffs: array_like

A 2d NumPy array of the shape (len(ctrls), len(tlist)-1). Each row corresponds to the control pulse sequence for one Hamiltonian.

Notes

len(tlist)-1=coeffs.shape[1] since tlist gives the beginning and the end of the pulses

Examples

Same parameter for all the gates

>>> from qutip_qip.circuit import QubitCircuit
>>> from qutip_qip.device import OptPulseProcessor
>>> qc = QubitCircuit(N=1)
>>> qc.add_gate("SNOT", 0)
>>> num_tslots = 10
>>> evo_time = 10
>>> processor = OptPulseProcessor(N=1, drift=sigmaz())
>>> processor.add_control(sigmax())
>>> # num_tslots and evo_time are two keyword arguments
>>> tlist, coeffs = processor.load_circuit(                qc, num_tslots=num_tslots, evo_time=evo_time)

Different parameters for different gates

>>> from qutip_qip.circuit import QubitCircuit
>>> from qutip_qip.device import OptPulseProcessor
>>> qc = QubitCircuit(N=2)
>>> qc.add_gate("SNOT", 0)
>>> qc.add_gate("SWAP", targets=[0, 1])
>>> qc.add_gate('CNOT', controls=1, targets=[0])
>>> processor = OptPulseProcessor(                N=2, drift=tensor([sigmaz()]*2))
>>> processor.add_control(sigmax(), cyclic_permutation=True)
>>> processor.add_control(sigmay(), cyclic_permutation=True)
>>> processor.add_control(tensor([sigmay(), sigmay()]))
>>> setting_args = {"SNOT": {"num_tslots": 10, "evo_time": 1},                        "SWAP": {"num_tslots": 30, "evo_time": 3},                        "CNOT": {"num_tslots": 30, "evo_time": 3}}
>>> tlist, coeffs = processor.load_circuit(                qc, setting_args=setting_args, merge_gates=False)

qutip_qip.device.processor module

class qutip_qip.device.processor.Processor(num_qubits=None, t1=None, t2=None, dims=None, spline_kind='step_func', N=None)[source]

Bases: object

A simulator of a quantum device based on the QuTiP solver qutip.mesolve(). It is defined by the available driving Hamiltonian and the decoherence time for each component systems. The processor can simulate the evolution under the given control pulses. Noisy evolution is supported by Noise and can be added to the processor.

Parameters
num_qubits: int

The number of component systems. It replaces the old API is N.

t1: list or float, optional

Characterize the decoherence of amplitude damping for each qubit. A list of size num_qubits or a float for all qubits.

t2: list of float, optional

Characterize the decoherence of dephasing for each qubit. A list of size num_qubits or a float for all qubits.

dims: list, optional

The dimension of each component system. Default value is a qubit system of dim=[2,2,2,...,2]

spline_kind: str, optional

Type of the coefficient interpolation. Default is “step_func” Note that they have different requirement for the length of coeff.

-“step_func”: The coefficient will be treated as a step function. E.g. tlist=[0,1,2] and coeff=[3,2], means that the coefficient is 3 in t=[0,1) and 2 in t=[2,3). It requires len(coeff)=len(tlist)-1 or len(coeff)=len(tlist), but in the second case the last element of coeff has no effect.

-“cubic”: Use cubic interpolation for the coefficient. It requires len(coeff)=len(tlist)

Attributes
num_qubits: int

The number of component systems.

pulseslist of Pulse

A list of control pulses of this device

t1: float or list

Characterize the decoherence of amplitude damping of each qubit.

t2: float or list

Characterize the decoherence of dephasing for each qubit.

noiseNoise, optional

A list of noise objects. They will be processed when creating the noisy qutip.QobjEvo from the processor or run the simulation.

driftDrift

A Drift object representing the drift Hamiltonians.

dims: list

The dimension of each component system. Default value is a qubit system of dim=[2,2,2,...,2]

spline_kind: str

Type of the coefficient interpolation. See parameters of Processor for details.

property N

Number of qubits (or subsystems). For backward compatibility. :type: int

add_control(qobj, targets=None, cyclic_permutation=False, label=None)[source]

Add a control Hamiltonian to the processor. It creates a new Pulse object for the device that is turned off (tlist = None, coeff = None). To activate the pulse, one can set its tlist and coeff.

Parameters
qobjqutip.Qobj

The Hamiltonian for the control pulse..

targets: list, optional

The indices of the target qubits (or subquantum system of other dimensions).

cyclic_permutation: bool, optional

If true, the Hamiltonian will be expanded for all cyclic permutation of the target qubits.

label: str, optional

The label (name) of the pulse

add_drift(qobj, targets, cyclic_permutation=False)[source]

Add a drift Hamiltonians. The drift Hamiltonians are intrinsic of the quantum system and cannot be controlled by external field.

Parameters
qobjqutip.Qobj

The drift Hamiltonian.

targets: list

The indices of the target qubits (or subquantum system of other dimensions).

add_noise(noise)[source]

get_noisy_pulses Add a noise object to the processor

Parameters
noiseNoise

The noise object defined outside the processor

add_pulse(pulse)[source]

Add a new pulse to the device.

Parameters
pulsePulse

Pulse object to be added.

property coeffs

A list of the coefficients for all control pulses.

property ctrls

A list of Hamiltonians of all pulses.

eliminate_auxillary_modes(U)[source]

Eliminate the auxillary modes like the cavity modes in cqed. (Defined in subclasses)

find_pulse(pulse_name)[source]
get_full_coeffs(full_tlist=None)[source]

Return the full coefficients in a 2d matrix form. Each row corresponds to one pulse. If the tlist are different for different pulses, the length of each row will be same as the full_tlist (see method get_full_tlist). Interpolation is used for adding the missing coefficient according to spline_kind.

Returns
coeffs: array-like 2d

The coefficients for all ideal pulses.

get_full_tlist(tol=1e-10)[source]

Return the full tlist of the ideal pulses. If different pulses have different time steps, it will collect all the time steps in a sorted array.

Returns
full_tlist: array-like 1d

The full time sequence for the ideal evolution.

get_noisy_pulses(device_noise=False, drift=False)[source]

It takes the pulses defined in the Processor and adds noise according to Processor.noise. It does not modify the pulses saved in Processor.pulses but returns a new list. The length of the new list of noisy pulses might be longer because of drift Hamiltonian and device noise. They will be added to the end of the pulses list.

Parameters
device_noise: bool, optional

If true, include pulse independent noise such as single qubit Relaxation. Default is False.

drift: bool, optional

If true, include drift Hamiltonians. Default is False.

Returns
noisy_pulseslist of Drift

A list of noisy pulses.

get_operators_labels()[source]

Get the labels for each Hamiltonian. It is used in the method method Processor.plot_pulses(). It is a 2-d nested list, in the plot, a different color will be used for each sublist.

get_pulse_dict()[source]
get_qobjevo(args=None, noisy=False)[source]

Create a qutip.QobjEvo representation of the evolution. It calls the method Processor.get_noisy_pulses() and create the QobjEvo from it.

Parameters
args: dict, optional

Arguments for qutip.QobjEvo

noisy: bool, optional

If noise are included. Default is False.

Returns
qobjevoqutip.QobjEvo

The qutip.QobjEvo representation of the unitary evolution.

c_ops: list of qutip.QobjEvo

A list of lindblad operators is also returned. if noisy==False, it is always an empty list.

load_circuit(qc)[source]

Translate an QubitCircuit to its corresponding Hamiltonians. (Defined in subclasses)

plot_pulses(title=None, figsize=(12, 6), dpi=None, show_axis=False, rescale_pulse_coeffs=True, num_steps=1000)[source]

Plot the ideal pulse coefficients.

Parameters
title: str, optional

Title for the plot.

figsize: tuple, optional

The size of the figure.

dpi: int, optional

The dpi of the figure.

show_axis: bool, optional

If the axis are shown.

rescale_pulse_coeffs: bool, optional

Rescale the hight of each pulses.

num_steps: int, optional

Number of time steps in the plot.

Returns
fig: matplotlib.figure.Figure

The Figure object for the plot.

ax: matplotlib.axes._subplots.AxesSubplot

The axes for the plot.

Notes

:meth:.Processor.plot_pulses` only works for array_like coefficients.

property pulse_mode

If the given pulse is going to be interpreted as “continuous” or “discrete”.

Type

str

read_coeff(file_name, inctime=True)[source]

Read the control amplitudes matrix and time list saved in the file by save_amp.

Parameters
file_name: string

Name of the file.

inctime: bool, optional

True if the time list in included in the first column.

Returns
tlist: array_like

The time list read from the file.

coeffs: array_like

The pulse matrix read from the file.

remove_pulse(indices=None, label=None)[source]

Remove the control pulse with given indices.

Parameters
indices: int or list of int

The indices of the control Hamiltonians to be removed.

label: str

The label of the pulse

run(qc=None)[source]

Calculate the propagator of the evolution by matrix exponentiation. This method won’t include noise or collpase.

Parameters
qcQubitCircuit, optional

Takes the quantum circuit to be implemented. If not given, use the quantum circuit saved in the processor by load_circuit.

Returns
U_list: list

The propagator matrix obtained from the physical implementation.

run_analytically(init_state=None, qc=None)[source]

Simulate the state evolution under the given qutip.QubitCircuit with matrice exponentiation. It will calculate the propagator with matrix exponentiation and return a list of qutip.Qobj. This method won’t include noise or collpase.

Parameters
qcQubitCircuit, optional

Takes the quantum circuit to be implemented. If not given, use the quantum circuit saved in the processor by load_circuit.

init_statequtip.Qobj, optional

The initial state of the qubits in the register.

Returns
U_list: list

A list of propagators obtained for the physical implementation.

run_state(init_state=None, analytical=False, states=None, noisy=True, solver='mesolve', **kwargs)[source]

If analytical is False, use qutip.mesolve() to calculate the time of the state evolution and return the result. Other arguments of mesolve can be given as keyword arguments.

If analytical is True, calculate the propagator with matrix exponentiation and return a list of matrices. Noise will be neglected in this option.

Parameters
init_statequtip.Qobj

Initial density matrix or state vector (ket).

analytical: bool

If True, calculate the evolution with matrices exponentiation.

statesqutip.Qobj, optional

Old API, same as init_state.

solver: str

“mesolve” or “mcsolve”, for mesolve() and mcsolve().

noisy: bool

Include noise or not.

**kwargs

Keyword arguments for the qutip solver. E.g tlist for time points for recording intermediate states and expectation values; args for the solvers and qutip.QobjEvo.

Returns
evo_resultqutip.Result

If analytical is False, an instance of the class qutip.Result will be returned.

If analytical is True, a list of matrices representation is returned.

save_coeff(file_name, inctime=True)[source]

Save a file with the control amplitudes in each timeslot.

Parameters
file_name: string

Name of the file.

inctime: bool, optional

True if the time list should be included in the first column.

set_all_coeffs(coeffs)[source]

Save the coeffs in the processor.

Parameters
coeffs: dict or list of NumPy arraries.

If it is a dict, it should be a map between pulse label and the corresponding coefficients. If it is a list of arrays or a 2D NumPy array, each array will be associated to a pulse, following the order in the pulse list.

set_all_tlist(tlist)[source]

Set the same tlist for all the pulses.

Parameters
tlist: dict or list of NumPy arraries.

If it is a dict, it should be a map between pulse label and the time sequences. If it is a list of arrays or a 2D NumPy array, each array will be associated to a pulse, following the order in the pulse list.

qutip_qip.device.spinchain module

class qutip_qip.device.spinchain.CircularSpinChain(num_qubits=None, correct_global_phase=True, t1=None, t2=None, N=None, **params)[source]

Bases: qutip_qip.device.spinchain.SpinChain

Spin chain model with circular topology. See SpinChain for details.

Parameters
num_qubits: int

The number of qubits in the system.

correct_global_phase: float, optional

Save the global phase, the analytical solution will track the global phase. It has no effect on the numerical solution.

t1: list or float, optional

Characterize the decoherence of amplitude damping for each qubit. A list of size num_qubits or a float for all qubits.

t2: list of float, optional

Characterize the decoherence of dephasing for each qubit. A list of size num_qubits or a float for all qubits.

**params:

Keyword argument for hardware parameters, in the unit of frequency (MHz, GHz etc, the unit of time list needs to be adjusted accordingly). Qubit parameters can either be a float or an array of the length num_qubits. sxsy, should be either a float or an array of the length num_qubits.

  • sx: the pulse strength of sigma-x control, default 0.25

  • sz: the pulse strength of sigma-z control, default 1.0

  • sxsy: the pulse strength for the exchange interaction, default 0.1

get_operators_labels()[source]

Get the labels for each Hamiltonian. It is used in the method method Processor.plot_pulses(). It is a 2-d nested list, in the plot, a different color will be used for each sublist.

load_circuit(qc, schedule_mode='ASAP', compiler=None)[source]

The default routine of compilation. It first calls the transpile() to convert the circuit to a suitable format for the hardware model. Then it calls the compiler and save the compiled pulses.

Parameters
qcQubitCircuit

Takes the quantum circuit to be implemented.

schedule_mode: string

“ASAP” or “ALAP” or None.

compiler: subclass of :class:`.GateCompiler`

The used compiler.

Returns
tlist, coeffs: dict of 1D NumPy array

A dictionary of pulse label and the time sequence and compiled pulse coefficients.

set_up_ops(num_qubits)[source]

Generate the Hamiltonians for the spinchain model and save them in the attribute ctrls.

Parameters
num_qubits: int

The number of qubits in the system.

set_up_params()[source]

Save the parameters in the attribute params and check the validity. The keys of params including “sx”, “sz”, and “sxsy”, each mapped to a list for parameters corresponding to each qubits. For coupling strength “sxsy”, list element i is the interaction between qubits i and i+1. All parameters will be multiplied by 2*pi for simplicity

Parameters
sx: float or list

The coefficient of sigmax in the model

sz: flaot or list

The coefficient of sigmaz in the model

Notes

The coefficient of sxsy is defined in the submethods.

property sxsy_ops

A list of tensor(sigmax, sigmay) interacting Hamiltonians for each qubit.

Type

list

property sxsy_u

Pulse coefficients for tensor(sigmax, sigmay) interacting Hamiltonians.

Type

array-like

topology_map(qc)[source]

Map the circuit to the hardware topology.

class qutip_qip.device.spinchain.LinearSpinChain(num_qubits=None, correct_global_phase=True, t1=None, t2=None, N=None, **params)[source]

Bases: qutip_qip.device.spinchain.SpinChain

Spin chain model with open-end topology. See SpinChain for details.

Parameters
num_qubits: int

The number of qubits in the system.

correct_global_phase: float, optional

Save the global phase, the analytical solution will track the global phase. It has no effect on the numerical solution.

t1: list or float, optional

Characterize the decoherence of amplitude damping for each qubit. A list of size num_qubits or a float for all qubits.

t2: list of float, optional

Characterize the decoherence of dephasing for each qubit. A list of size num_qubits or a float for all qubits.

**params:

Keyword argument for hardware parameters, in the unit of frequency (MHz, GHz etc, the unit of time list needs to be adjusted accordingly). Qubit parameters can either be a float or an array of the length num_qubits. sxsy, should be either a float or an array of the length num_qubits-1.

  • sx: the pulse strength of sigma-x control, default 0.25

  • sz: the pulse strength of sigma-z control, default 1.0

  • sxsy: the pulse strength for the exchange interaction, default 0.1

get_operators_labels()[source]

Get the labels for each Hamiltonian. It is used in the method method Processor.plot_pulses(). It is a 2-d nested list, in the plot, a different color will be used for each sublist.

load_circuit(qc, schedule_mode='ASAP', compiler=None)[source]

The default routine of compilation. It first calls the transpile() to convert the circuit to a suitable format for the hardware model. Then it calls the compiler and save the compiled pulses.

Parameters
qcQubitCircuit

Takes the quantum circuit to be implemented.

schedule_mode: string

“ASAP” or “ALAP” or None.

compiler: subclass of :class:`.GateCompiler`

The used compiler.

Returns
tlist, coeffs: dict of 1D NumPy array

A dictionary of pulse label and the time sequence and compiled pulse coefficients.

set_up_ops(num_qubits)[source]

Generate the Hamiltonians for the spinchain model and save them in the attribute ctrls.

Parameters
num_qubits: int

The number of qubits in the system.

set_up_params()[source]

Save the parameters in the attribute params and check the validity. The keys of params including “sx”, “sz”, and “sxsy”, each mapped to a list for parameters corresponding to each qubits. For coupling strength “sxsy”, list element i is the interaction between qubits i and i+1. All parameters will be multiplied by 2*pi for simplicity

Parameters
sx: float or list

The coefficient of sigmax in the model

sz: flaot or list

The coefficient of sigmaz in the model

Notes

The coefficient of sxsy is defined in the submethods.

property sxsy_ops

A list of tensor(sigmax, sigmay) interacting Hamiltonians for each qubit.

Type

list

property sxsy_u

Pulse coefficients for tensor(sigmax, sigmay) interacting Hamiltonians.

Type

array-like

topology_map(qc)[source]

Map the circuit to the hardware topology.

class qutip_qip.device.spinchain.SpinChain(num_qubits, correct_global_phase, t1, t2, N=None, **params)[source]

Bases: qutip_qip.device.modelprocessor.ModelProcessor

The processor based on the physical implementation of a spin chain qubits system. The available Hamiltonian of the system is predefined. The processor can simulate the evolution under the given control pulses either numerically or analytically. This is the base class and should not be used directly. Please use LinearSpinChain or CircularSpinChain.

Parameters
num_qubits: int

The number of qubits in the system.

correct_global_phase: float, optional

Save the global phase, the analytical solution will track the global phase. It has no effect on the numerical solution.

t1: list or float, optional

Characterize the decoherence of amplitude damping for each qubit. A list of size num_qubits or a float for all qubits.

t2: list of float, optional

Characterize the decoherence of dephasing for each qubit. A list of size num_qubits or a float for all qubits.

**params:

Keyword argument for hardware parameters, in the unit of frequency (MHz, GHz etc, the unit of time list needs to be adjusted accordingly). Qubit parameters can either be a float or an array of the length num_qubits. sxsy, should be either a float or an array of the length num_qubits-1 (for LinearSpinChain) or num_qubits (for :.CircularSpinChain).

  • sx: the pulse strength of sigma-x control, default 0.25

  • sz: the pulse strength of sigma-z control, default 1.0

  • sxsy: the pulse strength for the exchange interaction, default 0.1

load_circuit(qc, setup, schedule_mode='ASAP', compiler=None)[source]

The default routine of compilation. It first calls the transpile() to convert the circuit to a suitable format for the hardware model. Then it calls the compiler and save the compiled pulses.

Parameters
qcQubitCircuit

Takes the quantum circuit to be implemented.

schedule_mode: string

“ASAP” or “ALAP” or None.

compiler: subclass of :class:`.GateCompiler`

The used compiler.

Returns
tlist, coeffs: dict of 1D NumPy array

A dictionary of pulse label and the time sequence and compiled pulse coefficients.

set_up_ops(num_qubits)[source]

Generate the Hamiltonians for the spinchain model and save them in the attribute ctrls.

Parameters
num_qubits: int

The number of qubits in the system.

set_up_params()[source]

Save the parameters in the attribute params and check the validity. The keys of params including “sx”, “sz”, and “sxsy”, each mapped to a list for parameters corresponding to each qubits. For coupling strength “sxsy”, list element i is the interaction between qubits i and i+1. All parameters will be multiplied by 2*pi for simplicity

Parameters
sx: float or list

The coefficient of sigmax in the model

sz: flaot or list

The coefficient of sigmaz in the model

Notes

The coefficient of sxsy is defined in the submethods.

property sx_ops

A list of sigmax Hamiltonians for each qubit.

Type

list

property sx_u

Pulse coefficients for sigmax Hamiltonians.

Type

array-like

property sxsy_ops

A list of tensor(sigmax, sigmay) interacting Hamiltonians for each qubit.

Type

list

property sxsy_u

Pulse coefficients for tensor(sigmax, sigmay) interacting Hamiltonians.

Type

array-like

property sz_ops

A list of sigmaz Hamiltonians for each qubit.

Type

list

property sz_u

Pulse coefficients for sigmaz Hamiltonians.

Type

array-like

Module contents