qutip_qip package

Submodules

qutip_qip.circuit module

class qutip_qip.circuit.CircuitResult(final_states, probabilities, cbits=None)[source]

Bases: object

get_cbits(index=None)[source]

Return list of classical bit outputs corresponding to the results.

Parameters
index: int

Indicates i-th output, probability pair to be returned.

Returns
cbits: list of int or list of list of int

list of classical bit outputs

get_final_states(index=None)[source]

Return list of output states.

Parameters
index: int

Indicates i-th state to be returned.

Returns
final_states: Qobj or list of Qobj.

List of output kets or density matrices.

get_probabilities(index=None)[source]

Return list of probabilities corresponding to the output states.

Parameters
index: int

Indicates i-th probability to be returned.

Returns
probabilities: float or list of float

Probabilities associated with each output state.

class qutip_qip.circuit.CircuitSimulator(qc, state=None, cbits=None, U_list=None, measure_results=None, mode='state_vector_simulator', precompute_unitary=False)[source]

Bases: object

initialize(state=None, cbits=None, measure_results=None)[source]

Reset Simulator state variables to start a new run.

Parameters
state: ket or oper

ket or density matrix

cbits: list of int, optional

initial value of classical bits

U_list: list of Qobj, optional

list of predefined unitaries corresponding to circuit.

measure_resultstuple of ints, optional

optional specification of each measurement result to enable post-selection. If specified, the measurement results are set to the tuple of bits (sequentially) instead of being chosen at random.

run(state, cbits=None, measure_results=None)[source]

Calculate the result of one instance of circuit run.

Parameters
stateket or oper

state vector or density matrix input.

cbitsList of ints, optional

initialization of the classical bits.

measure_resultstuple of ints, optional

optional specification of each measurement result to enable post-selection. If specified, the measurement results are set to the tuple of bits (sequentially) instead of being chosen at random.

Returns
result: CircuitResult

Return a CircuitResult object containing output state and probability.

run_statistics(state, cbits=None)[source]

Calculate all the possible outputs of a circuit (varied by measurement gates).

Parameters
stateket

state to be observed on specified by density matrix.

cbitsList of ints, optional

initialization of the classical bits.

Returns
result: CircuitResult

Return a CircuitResult object containing output states and and their probabilities.

step()[source]

Return state after one step of circuit evolution (gate or measurement).

Returns
stateket or oper

state after one evolution step.

class qutip_qip.circuit.Gate(name, targets=None, controls=None, arg_value=None, arg_label=None, classical_controls=None, control_value=None)[source]

Bases: object

Representation of a quantum gate, with its required parametrs, and target and control qubits.

Parameters
namestring

Gate name.

targetslist or int

Gate targets.

controlslist or int

Gate controls.

arg_valuefloat

Argument value(phi).

arg_labelstring

Label for gate representation.

classical_controlsint or list of int, optional

indices of classical bits to control gate on.

control_valueint, optional

value of classical bits to control on, the classical controls are interpreted as an integer with lowest bit being the first one. If not specified, then the value is interpreted to be 2 ** len(classical_controls) - 1 (i.e. all classical controls are 1).

get_inds(N=None)[source]
class qutip_qip.circuit.Measurement(name, targets=None, index=None, classical_store=None)[source]

Bases: object

Representation of a quantum measurement, with its required parameters, and target qubits.

Parameters
namestring

Measurement name.

targetslist or int

Gate targets.

classical_storeint

Result of the measurment is stored in this classical register of the circuit.

measurement_comp_basis(state)[source]

Measures a particular qubit (determined by the target) whose ket vector/ density matrix is specified in the computational basis and returns collapsed_states and probabilities (retains full dimension).

Parameters
stateket or oper

state to be measured on specified by ket vector or density matrix

Returns
collapsed_statesList of Qobjs

the collapsed state obtained after measuring the qubits and obtaining the qubit specified by the target in the state specified by the index.

probabilitiesList of floats

the probability of measuring a state in a the state specified by the index.

class qutip_qip.circuit.QubitCircuit(N, input_states=None, output_states=None, reverse_states=True, user_gates=None, dims=None, num_cbits=0)[source]

Bases: object

Representation of a quantum program/algorithm, maintaining a sequence of gates.

Parameters
Nint

Number of qubits in the system.

user_gatesdict

Define a dictionary of the custom gates. See examples for detail.

input_stateslist

A list of string such as 0,’+’, “A”, “Y”. Only used for latex.

dimslist

A list of integer for the dimension of each composite system. e.g [2,2,2,2,2] for 5 qubits system. If None, qubits system will be the default option.

num_cbitsint

Number of classical bits in the system.

Examples

>>> def user_gate():
...     mat = np.array([[1.,   0],
...                     [0., 1.j]])
...     return Qobj(mat, dims=[[2], [2]])
>>> qubit_circuit = QubitCircuit(2, user_gates={"T":user_gate})
>>> qubit_circuit.add_gate("T", targets=[0])
add_1q_gate(name, start=0, end=None, qubits=None, arg_value=None, arg_label=None, classical_controls=None, control_value=None)[source]

Adds a single qubit gate with specified parameters on a variable number of qubits in the circuit. By default, it applies the given gate to all the qubits in the register.

Parameters
namestring

Gate name.

startint

Starting location of qubits.

endint

Last qubit for the gate.

qubitslist

Specific qubits for applying gates.

arg_valuefloat

Argument value(phi).

arg_labelstring

Label for gate representation.

add_circuit(qc, start=0)[source]

Adds a block of a qubit circuit to the main circuit. Globalphase gates are not added.

Parameters
qcQubitCircuit

The circuit block to be added to the main circuit.

startint

The qubit on which the first gate is applied.

add_gate(gate, targets=None, controls=None, arg_value=None, arg_label=None, index=None, classical_controls=None, control_value=None)[source]

Adds a gate with specified parameters to the circuit.

Parameters
gate: string or :class:`.Gate`

Gate name. If gate is an instance of Gate, parameters are unpacked and added.

targets: list

Gate targets.

controls: list

Gate controls.

arg_value: float

Argument value(phi).

arg_label: string

Label for gate representation.

indexlist

Positions to add the gate.

classical_controlsint or list of int, optional

indices of classical bits to control gate on.

control_valueint, optional

value of classical bits to control on, the classical controls are interpreted as an integer with lowest bit being the first one. If not specified, then the value is interpreted to be 2 ** len(classical_controls) - 1 (i.e. all classical controls are 1).

add_measurement(measurement, targets=None, index=None, classical_store=None)[source]

Adds a measurement with specified parameters to the circuit.

Parameters
name: string

Measurement name. If name is an instance of Measuremnent, parameters are unpacked and added.

targets: list

Gate targets

indexlist

Positions to add the gate.

classical_storeint

Classical register where result of measurement is stored.

add_state(state, targets=None, state_type='input')[source]

Add an input or ouput state to the circuit. By default all the input and output states will be initialized to None. A particular state can be added by specifying the state and the qubit where it has to be added along with the type as input or output.

Parameters
state: str

The state that has to be added. It can be any string such as 0, ‘+’, “A”, “Y”

targets: list

A list of qubit positions where the given state has to be added.

state_type: str

One of either “input” or “output”. This specifies whether the state to be added is an input or output. default: “input”

adjacent_gates()[source]

Method to resolve two qubit gates with non-adjacent control/s or target/s in terms of gates with adjacent interactions.

Returns
qubit_circuit: QubitCircuit

Return QubitCircuit of the gates for the qubit circuit with the resolved non-adjacent gates.

latex_code()[source]
property png

Return the png file

propagators(expand=True)[source]

Propagator matrix calculator returning the individual steps as unitary matrices operating from left to right.

Parameters
expandbool, optional

Whether to expand the unitary matrices for the individual steps to the full Hilbert space for N qubits. Defaults to True. If False, the unitary matrices will not be expanded and the list of unitaries will need to be combined with the list of gates in order to determine which qubits the unitaries should act on.

Returns
U_listlist

Return list of unitary matrices for the qubit circuit.

remove_gate_or_measurement(index=None, end=None, name=None, remove='first')[source]

Remove a gate from a specific index or between two indexes or the first, last or all instances of a particular gate.

Parameters
indexint

Location of gate or measurement to be removed.

namestring

Gate or Measurement name to be removed.

removestring

If first or all gates/measurements are to be removed.

resolve_gates(basis=['CNOT', 'RX', 'RY', 'RZ'])[source]

Unitary matrix calculator for N qubits returning the individual steps as unitary matrices operating from left to right in the specified basis. Calls ‘_resolve_to_universal’ for each gate, this function maps each ‘GATENAME’ with its corresponding ‘_gate_basis_2q’ Subsequently calls _resolve_2q_basis for each basis, this function maps each ‘2QGATENAME’ with its corresponding ‘_basis_’

Parameters
basislist.

Basis of the resolved circuit.

Returns
qcQubitCircuit

Return QubitCircuit of resolved gates for the qubit circuit in the desired basis.

reverse_circuit()[source]

Reverse an entire circuit of unitary gates.

Returns
qubit_circuitQubitCircuit

Return QubitCircuit of resolved gates for the qubit circuit in the reverse order.

run(state, cbits=None, U_list=None, measure_results=None, precompute_unitary=False)[source]

Calculate the result of one instance of circuit run.

Parameters
stateket or oper

state vector or density matrix input.

cbitsList of ints, optional

initialization of the classical bits.

U_list: list of Qobj, optional

list of predefined unitaries corresponding to circuit.

measure_resultstuple of ints, optional

optional specification of each measurement result to enable post-selection. If specified, the measurement results are set to the tuple of bits (sequentially) instead of being chosen at random.

precompute_unitary: Boolean, optional

Specify if computation is done by pre-computing and aggregating gate unitaries. Possibly a faster method in the case of large number of repeat runs with different state inputs.

Returns
final_stateQobj

output state of the circuit run.

run_statistics(state, U_list=None, cbits=None, precompute_unitary=False)[source]

Calculate all the possible outputs of a circuit (varied by measurement gates).

Parameters
stateket or oper

state vector or density matrix input.

cbitsList of ints, optional

initialization of the classical bits.

U_list: list of Qobj, optional

list of predefined unitaries corresponding to circuit.

measure_resultstuple of ints, optional

optional specification of each measurement result to enable post-selection. If specified, the measurement results are set to the tuple of bits (sequentially) instead of being chosen at random.

precompute_unitary: Boolean, optional

Specify if computation is done by pre-computing and aggregating gate unitaries. Possibly a faster method in the case of large number of repeat runs with different state inputs.

Returns
result: CircuitResult

Return a CircuitResult object containing output states and and their probabilities.

property svg

Return the svg file

qutip_qip.circuit_latex module

qutip_qip.circuit_latex.image_from_latex(code, file_type='png')[source]

Convert the LaTeX code into an image format, defined by the file_type. Returns a string or bytes object, depending on whether the requested type is textual (e.g. svg) or binary (e.g. png). The known file types are in keys in this module’s CONVERTERS dictionary.

Parameters
code: str

LaTeX code representing the circuit to be converted.

file_type: str (“png”)

The file type that the image should be returned in.

Returns
image: str or bytes

An encoded version of the image. Whether the output type is str or bytes depends on whether the requested image format is textual or binary.

qutip_qip.gates module

qutip_qip.noise module

class qutip_qip.noise.ControlAmpNoise(coeff, tlist=None, indices=None)[source]

Bases: qutip_qip.noise.Noise

The noise in the amplitude of the control pulse.

Parameters
coeff: list

A list of the coefficients for the control Hamiltonians. For available choices, see qutip.QobjEvo.

tlist: array_like, optional

A NumPy array specifies the time of each coefficient.

indices: list of int, optional

The indices of target pulse in the list of pulses.

Attributes
coeff: list

A list of the coefficients for the control Hamiltonians. For available choices, see qutip.QobjEvo.

tlist: array_like

A NumPy array specifies the time of each coefficient.

indices: list of int

The indices of target pulse in the list of pulses.

get_noisy_pulses(dims=None, pulses=None, systematic_noise=None)[source]

Return the input pulses list with noise added and the pulse independent noise in a dummy Pulse object. This is a template method, a method with the same name and signatures needs to be defined in the subclasses.

Parameters
dims: list, optional

The dimension of the components system, the default value is [2,2…,2] for qubits system.

pulseslist of Pulse

The input pulses. The noise will be added to pulses in this list.

systematic_noisePulse

The dummy pulse with no ideal control element.

Returns
noisy_pulses: list of Pulse

Noisy pulses.

systematic_noisePulse

The dummy pulse representing pulse-independent noise.

class qutip_qip.noise.DecoherenceNoise(c_ops, targets=None, coeff=None, tlist=None, all_qubits=False)[source]

Bases: qutip_qip.noise.Noise

The decoherence noise in a processor. It generates lindblad noise according to the given collapse operator c_ops.

Parameters
c_opsqutip.Qobj or list

The Hamiltonian representing the dynamics of the noise.

targets: int or list, optional

The indices of qubits that are acted on. Default is on all qubits

coeff: list, optional

A list of the coefficients for the control Hamiltonians.

tlist: array_like, optional

A NumPy array specifies the time of each coefficient.

all_qubits: bool, optional

If c_ops contains only single qubits collapse operator, all_qubits=True will allow it to be applied to all qubits.

Attributes
c_opsqutip.Qobj or list

The Hamiltonian representing the dynamics of the noise.

targets: int or list

The indices of qubits that are acted on.

coeff: list

A list of the coefficients for the control Hamiltonians.

tlist: array_like

A NumPy array specifies the time of each coefficient.

all_qubits: bool

If c_ops contains only single qubits collapse operator, all_qubits=True will allow it to be applied to all qubits.

get_noisy_pulses(dims=None, pulses=None, systematic_noise=None)[source]

Return the input pulses list with noise added and the pulse independent noise in a dummy Pulse object.

Parameters
dims: list, optional

The dimension of the components system, the default value is [2, 2, …, 2] for a system of qubits.

pulseslist of Pulse

The input pulses. The noise will be added to pulses in this list.

systematic_noisePulse

The dummy pulse with no ideal control element.

Returns
noisy_pulses: list of Pulse

Noisy pulses.

systematic_noisePulse

The dummy pulse representing pulse-independent noise.

class qutip_qip.noise.Noise[source]

Bases: object

The base class representing noise in a processor. The noise object can be added to device.Processor and contributes to evolution.

get_noisy_pulses(dims=None, pulses=None, systematic_noise=None)[source]

Return the input pulses list with noise added and the pulse independent noise in a dummy Pulse object. This is a template method, a method with the same name and signatures needs to be defined in the subclasses.

Parameters
dims: list, optional

The dimension of the components system, the default value is [2,2…,2] for qubits system.

pulseslist of Pulse

The input pulses. The noise will be added to pulses in this list.

systematic_noisePulse

The dummy pulse with no ideal control element.

Returns
noisy_pulses: list of Pulse

Noisy pulses.

systematic_noisePulse

The dummy pulse representing pulse-independent noise.

class qutip_qip.noise.RandomNoise(dt, rand_gen, indices=None, **kwargs)[source]

Bases: qutip_qip.noise.ControlAmpNoise

Random noise in the amplitude of the control pulse. The arguments for the random generator need to be given as key word arguments.

Parameters
dt: float, optional

The time interval between two random amplitude. The coefficients of the noise are the same within this time range.

rand_gen: numpy.random, optional

A random generator in numpy.random, it has to take a size parameter as the size of random numbers in the output array.

indices: list of int, optional

The indices of target pulse in the list of pulses.

**kwargs:

Key word arguments for the random number generator.

Examples

>>> gaussnoise = RandomNoise(             dt=0.1, rand_gen=np.random.normal, loc=mean, scale=std)             
Attributes
dt: float, optional

The time interval between two random amplitude. The coefficients of the noise are the same within this time range.

rand_gen: numpy.random, optional

A random generator in numpy.random, it has to take a size parameter.

indices: list of int

The indices of target pulse in the list of pulses.

**kwargs:

Key word arguments for the random number generator.

get_noisy_pulses(dims=None, pulses=None, systematic_noise=None)[source]

Return the input pulses list with noise added and the pulse independent noise in a dummy Pulse object.

Parameters
dims: list, optional

The dimension of the components system, the default value is [2,2…,2] for qubits system.

pulseslist of Pulse

The input pulses. The noise will be added to pulses in this list.

systematic_noisePulse

The dummy pulse with no ideal control element.

Returns
noisy_pulses: list of Pulse

Noisy pulses.

systematic_noisePulse

The dummy pulse representing pulse-independent noise.

class qutip_qip.noise.RelaxationNoise(t1=None, t2=None, targets=None)[source]

Bases: qutip_qip.noise.Noise

The decoherence on each qubit characterized by two time scales t1 and t2.

Parameters
t1: float or list, optional

Characterize the decoherence of amplitude damping for each qubit.

t2: float or list, optional

Characterize the decoherence of dephasing for each qubit.

targets: int or list, optional

The indices of qubits that are acted on. Default is on all qubits

Attributes
t1: float or list

Characterize the decoherence of amplitude damping for each qubit.

t2: float or list

Characterize the decoherence of dephasing for each qubit.

targets: int or list

The indices of qubits that are acted on.

get_noisy_pulses(dims=None, pulses=None, systematic_noise=None)[source]

Return the input pulses list with noise added and the pulse independent noise in a dummy Pulse object.

Parameters
dims: list, optional

The dimension of the components system, the default value is [2,2…,2] for qubits system.

pulseslist of Pulse

The input pulses. The noise will be added to pulses in this list.

systematic_noisePulse

The dummy pulse with no ideal control element.

Returns
noisy_pulses: list of Pulse

Noisy pulses.

systematic_noisePulse

The dummy pulse representing pulse-independent noise.

class qutip_qip.noise.ZZCrossTalk(params)[source]

Bases: qutip_qip.noise.Noise

And an always-on ZZ cross talk noise with the corresponding coefficient on each pair of qubits. The operator acts only one the lowerest two levels and is 0 on higher level. Equivalent to tensor(sigmaz(), sigmaz()).

Parameters
params:

Parameters computed from a SCQubits.

get_noisy_pulses(dims=None, pulses=None, systematic_noise=None)[source]

Return the input pulses list with noise added and the pulse independent noise in a dummy Pulse object.

Parameters
dims: list, optional

The dimension of the components system, the default value is [2,2…,2] for qubits system.

pulseslist of Pulse

The input pulses. The noise will be added to pulses in this list.

systematic_noisePulse

The dummy pulse with no ideal control element.

Returns
noisy_pulses: list of Pulse

Noisy pulses.

systematic_noisePulse

The dummy pulse representing pulse-independent noise.

qutip_qip.noise.process_noise(pulses, noise_list, dims, t1=None, t2=None, device_noise=False)[source]

Apply noise to the input list of pulses. It does not modify the input pulse, but return a new one containing the noise.

Parameters
pulses: list of :class:`.Pulse`

The input pulses, on which the noise object will be applied.

noise_list: list of :class:`.Noise`

A list of noise objects.

dims: int or list

Dimension of the system. If int, we assume it is the number of qubits in the system. If list, it is the dimension of the component systems.

t1: list or float, optional

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

t2: list of float, optional

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

device_noise: bool

If pulse independent noise such as relaxation are included. Default is False.

Returns
noisy_pulses: list of Pulse

The noisy pulses, including the system noise.

qutip_qip.pulse module

class qutip_qip.pulse.Drift(qobj=None)[source]

Bases: object

The time independent drift Hamiltonian. Usually its the intrinsic evolution of the quantum system that can not be tuned.

Parameters
qobjqutip.Qobj or list of qutip.Qobj, optional

The drift Hamiltonians.

Attributes
qobj: list of :class:`qutip.Qobj`

A list of the the drift Hamiltonians.

add_drift(qobj, targets)[source]

Add a Hamiltonian to the drift.

Parameters
qobj: :class:’qutip.Qobj’

The collapse operator of the lindblad noise.

targets: list

target qubits of the collapse operator (or subquantum system of other dimensions).

get_ideal_qobjevo(dims)[source]

Get the QobjEvo representation of the drift Hamiltonian.

Parameters
dims: int or list

Dimension of the system. If int, we assume it is the number of qubits in the system. If list, it is the dimension of the component systems.

Returns
ideal_evo: qutip.QobjEvo

A QobjEvo representing the drift evolution.

get_noisy_qobjevo(dims)[source]

Same as the get_ideal_qobjevo method. There is no additional noise for the drift evolution.

Returns
noisy_evo: qutip.QobjEvo

A QobjEvo representing the ideal evolution and coherent noise.

c_ops: list of qutip.QobjEvo

Always an empty list for Drift

class qutip_qip.pulse.Pulse(qobj, targets, tlist=None, coeff=None, spline_kind=None, label='')[source]

Bases: object

Representation of a control pulse and the pulse dependent noise. The pulse is characterized by the ideal control pulse, the coherent noise and the lindblad noise. The later two are lists of noisy evolution dynamics. Each dynamic element is characterized by four variables: 1`qobj, targets, tlist and coeff.

See examples for different construction behavior.

Parameters
qobj:class:’qutip.Qobj’

The Hamiltonian of the ideal pulse.

targets: list

target qubits of the ideal pulse (or subquantum system of other dimensions).

tlist: array-like, optional

Time sequence of the ideal pulse. A list of time at which the time-dependent coefficients are applied. tlist does not have to be equidistant, but must have the same length or one element shorter compared to coeff. See documentation for the parameter spline_kind.

coeff: array-like or bool, optional

Time-dependent coefficients of the ideal control pulse. If an array, the length must be the same or one element longer compared to tlist. See documentation for the parameter spline_kind. If a bool, the coefficient is a constant 1 or 0.

spline_kind: str, optional

Type of the coefficient interpolation: “step_func” or “cubic”.

-“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)

label: str

The label (name) of the pulse.

Examples

Create a pulse that is turned off

>>> Pulse(sigmaz(), 0) 
>>> Pulse(sigmaz(), 0, None, None) 

Create a time dependent pulse

>>> tlist = np.array([0., 1., 2., 4.]) 
>>> coeff = np.array([0.5, 1.2, 0.8]) 
>>> spline_kind = "step_func" 
>>> Pulse(sigmaz(), 0, tlist=tlist, coeff=coeff, spline_kind="step_func") 

Create a time independent pulse

>>> Pulse(sigmaz(), 0, coeff=True) 

Create a constant pulse with time range

>>> Pulse(sigmaz(), 0, tlist=tlist, coeff=True) 

Create an dummy Pulse (H=0)

>>> Pulse(None, None) 
Attributes
ideal_pulse: :class:`.pulse._EvoElement`

The ideal dynamic of the control pulse.

coherent_noise: list of :class:`.pulse._EvoElement`

The coherent noise caused by the control pulse. Each dynamic element is still characterized by a time-dependent Hamiltonian.

lindblad_noise: list of :class:`.pulse._EvoElement`

The dissipative noise of the control pulse. Each dynamic element will be treated as a (time-dependent) lindblad operator in the master equation.

spline_kind: str

See parameter spline_kind.

label: str

See parameter label.

add_coherent_noise(qobj, targets, tlist=None, coeff=None)[source]

Add a new (time-dependent) Hamiltonian to the coherent noise.

Parameters
qobj: :class:’qutip.Qobj’

The Hamiltonian of the pulse.

targets: list

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

tlist: array-like, optional

A list of time at which the time-dependent coefficients are applied. tlist does not have to be equidistant, but must have the same length or one element shorter compared to coeff. See documentation for the parameter spline_kind of Pulse.

coeff: array-like or bool, optional

Time-dependent coefficients of the pulse noise. If an array, the length must be the same or one element longer compared to tlist. See documentation for the parameter spline_kind of Pulse. If a bool, the coefficient is a constant 1 or 0.

add_control_noise(qobj, targets, tlist=None, coeff=None)[source]
add_lindblad_noise(qobj, targets, tlist=None, coeff=None)[source]

Add a new (time-dependent) lindblad noise to the coherent noise.

Parameters
qobj: :class:’qutip.Qobj’

The collapse operator of the lindblad noise.

targets: list

target qubits of the collapse operator (or subquantum system of other dimensions).

tlist: array-like, optional

A list of time at which the time-dependent coefficients are applied. tlist does not have to be equidistant, but must have the same length or one element shorter compared to coeff. See documentation for the parameter spline_kind of Pulse.

coeff: array-like or bool, optional

Time-dependent coefficients of the pulse noise. If an array, the length must be the same or one element longer compared to tlist. See documentation for the parameter spline_kind of Pulse. If a bool, the coefficient is a constant 1 or 0.

property coeff

See parameter coeff.

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

Return the full tlist of the pulses and noise. It means that if different tlist are present, they will be merged to one with all time points stored in a sorted array.

Returns
full_tlist: array-like 1d

The full time sequence for the noisy evolution.

get_ideal_qobj(dims)[source]

Get the Hamiltonian of the ideal pulse.

Parameters
dims: int or list

Dimension of the system. If int, we assume it is the number of qubits in the system. If list, it is the dimension of the component systems.

Returns
qobjqutip.Qobj

The Hamiltonian of the ideal pulse.

get_ideal_qobjevo(dims)[source]

Get a QobjEvo representation of the ideal evolution.

Parameters
dims: int or list

Dimension of the system. If int, we assume it is the number of qubits in the system. If list, it is the dimension of the component systems.

Returns
ideal_evo: qutip.QobjEvo

A QobjEvo representing the ideal evolution.

get_noisy_qobjevo(dims)[source]

Get the QobjEvo representation of the noisy evolution. The result can be used directly as input for the qutip solvers.

Parameters
dims: int or list

Dimension of the system. If int, we assume it is the number of qubits in the system. If list, it is the dimension of the component systems.

Returns
noisy_evo: qutip.QobjEvo

A QobjEvo representing the ideal evolution and coherent noise.

c_ops: list of qutip.QobjEvo

A list of (time-dependent) lindbald operators.

print_info()[source]

Print the information of the pulse, including the ideal dynamics, the coherent noise and the lindblad noise.

property qobj

See parameter qobj.

property targets

See parameter targets.

property tlist

See parameter tlist

qutip_qip.qasm module

qutip_qip.qasm.circuit_to_qasm_str(qc)[source]

Return QASM output of circuit object as string

Parameters
qcQubitCircuit

circuit object to produce QASM output for.

Returns
output: str

string corresponding to QASM output.

qutip_qip.qasm.print_qasm(qc)[source]

Print QASM output of circuit object.

Parameters
qcQubitCircuit

circuit object to produce QASM output for.

qutip_qip.qasm.read_qasm(qasm_input, mode='qiskit', version='2.0', strmode=False)[source]

Read OpenQASM intermediate representation (https://github.com/Qiskit/openqasm) and return a QubitCircuit and state inputs as specified in the QASM file.

Parameters
qasm_inputstr

File location or String Input for QASM file to be imported. In case of string input, the parameter strmode must be True.

modestr

QASM mode to be read in. When mode is “qiskit”, the “qelib1.inc” include is automatically included, without checking externally. Otherwise, each include is processed.

versionstr

QASM version of the QASM file. Only version 2.0 is currently supported.

strmodebool

if specified as True, indicates that qasm_input is in string format rather than from file.

Returns
qcQubitCircuit

Returns a QubitCircuit object specified in the QASM file.

qutip_qip.qasm.save_qasm(qc, file_loc)[source]

Save QASM output of circuit object to file.

Parameters
qcQubitCircuit

circuit object to produce QASM output for.

qutip_qip.qubits module

qutip_qip.qubits.qubit_states(N=1, states=[0])[source]

Function to define initial state of the qubits.

Parameters
NInteger

Number of qubits in the register.

statesList

Initial state of each qubit.

Returns
qstatesQobj

List of qubits.

Module contents