API: Wall Classes

QuantumSystem Implementations

class qubricks.wall.systems.SimpleQuantumSystem(parameters=None, **kwargs)[source]

Bases: qubricks.system.QuantumSystem

SimpleQuantumSystem is a subclass of QuantumSystem that enables you to initialise a QuantumSystem instance in one line, by passing keyword arguments to the constructor. Otherwise, it is indistinguishable.

Parameters:
  • hamiltonian (Operator or numpy.array or list) – The Hamiltonian to use for this QuantumSystem. Can be an Operator or an array.
  • bases (dict of Basis) – A dictionary of bases to add to the QuantumSystem.
  • states (dict of arrays) – A dictionary of states to add to the QuantumSystem.
  • measurements (dict of Measurement) – A dictionary of `Measurement`s to add to the QuantumSystem.
  • derivative_ops (dict of StateOperator) – A dictionary of `StateOperator`s to add to the QuantumSystem.

For more documentation, see QuantumSystem.

init(hamiltonian=None, bases=None, states=None, measurements=None, derivative_ops=None)[source]

Configure any custom properties/attributes using kwargs passed to __init__.

init_bases()[source]
init_derivative_ops(components=None)[source]

Setup the derivative operators to be implemented on top of the basic quantum evolution operator.

init_hamiltonian()[source]
init_measurements()[source]
init_states()[source]

Operator and OperatorSet Implementations

class qubricks.wall.operators.PauliOperatorSet(components=None, defaults=None, **kwargs)[source]

Bases: qubricks.operator.OperatorSet

This subclass of OperatorSet does not store any components directly, but generates tensor products of Pauli I,X,Y and Z upon request. For example:

>>> p = PauliOperatorSet()
>>> p['X']()
array([[ 0.+0.j,  1.+0.j],
       [ 1.+0.j,  0.+0.j]])
>>> p['XX']()
array([[ 0.+0.j,  0.+0.j,  0.+0.j,  1.+0.j],
       [ 0.+0.j,  0.+0.j,  1.+0.j,  0.+0.j],
       [ 0.+0.j,  1.+0.j,  0.+0.j,  0.+0.j],
       [ 1.+0.j,  0.+0.j,  0.+0.j,  0.+0.j]])

As with any OperatorSet, the return type is an Operator instance.

Note

You can still use the aggregation and apply methods, such as

>>> p('XX', 'YY', 'ZZ')

will sum p[‘XX’], p[‘YY’] and p[‘ZZ’] together.

init()[source]

StateOperator Implementations

class qubricks.wall.stateoperators.DummyStateOperator(parameters=None, basis=None, **kwargs)[source]

Bases: qubricks.stateoperator.StateOperator

An StateOperator instance that does nothing to the state, but which forces the integrator to work as if it were necessary to evolve ensemble states.

collapse(*wrt, **params)[source]
connected(*indices, **params)[source]
for_ensemble
for_state
init(**kwargs)[source]
is_linear
restrict(*indices)[source]
transform(transform_op)[source]
class qubricks.wall.stateoperators.LindbladStateOperator(parameters=None, basis=None, **kwargs)[source]

Bases: qubricks.stateoperator.StateOperator

A StateOperator instance that effects a single-termed Lindblad master equation. This will cause decay in a simple two level system proportional to: exp(-8*coefficient*t)

collapse(*wrt, **params)[source]
connected(*indices, **params)[source]
for_ensemble
for_state
init(coefficient, operator)[source]
is_linear
optimise_coefficient()[source]
restrict(*indices)[source]
transform(transform_op)[source]
class qubricks.wall.stateoperators.SchrodingerStateOperator(parameters=None, basis=None, **kwargs)[source]

Bases: qubricks.stateoperator.StateOperator

A StateOperator instance that effects Schroedinger evolution of the (quantum) state.

collapse(*wrt, **params)[source]
connected(*indices, **params)[source]
for_ensemble
for_state
init(H)[source]
is_linear
restrict(*indices)[source]
transform(transform_op)[source]
class qubricks.wall.stateoperators.SimpleStateOperator(parameters=None, basis=None, **kwargs)[source]

Bases: qubricks.stateoperator.StateOperator

SimpleStateOperator wraps around an Operator object and when applied to a state, it is equivalent to :math:`Oleft|Psi
ight>` if state is a vector; or
:math:`O
ho O^{dagger}` if state is a matrix, were \(O\) is the operator
and \(\dagger\) represents the conjugate transpose operation.
collapse(*wrt, **params)[source]
connected(*indices, **params)[source]
for_ensemble
for_state
init(operator)[source]
is_linear
restrict(*indices)[source]
transform(transform_op)[source]

Measurement Implementations

class qubricks.wall.measurements.AmplitudeMeasurement(*args, **kwargs)[source]

Bases: qubricks.measurement.Measurement

Amplitude is a sample Measurement subclass that measures the amplitude of being in certain basis states as function of time throughout some state evolution. The basis states of interest should be identified using the subspace keyword to the measure function.

amplitudes(state)[source]
init()[source]
measure(data, subspace=None, params={}, int_kwargs={}, **kwargs)[source]
result_shape(*args, **kwargs)[source]
result_type(*args, **kwargs)[source]
class qubricks.wall.measurements.ExpectationMeasurement(*args, **kwargs)[source]

Bases: qubricks.measurement.Measurement

ExpectationMeasurement measures the expectation values of a particular set of operators applied to a system state. It can be initialised using:

>>> ExpectationMeasurement(<Operator 1>, <Operator 2>, ...)
expectations(state)[source]
init(*ops)[source]
measure(data, subspace=None, params={}, int_kwargs={}, **kwargs)[source]
result_shape(*args, **kwargs)[source]
result_type(*args, **kwargs)[source]
class qubricks.wall.measurements.LeakageMeasurement(*args, **kwargs)[source]

Bases: qubricks.measurement.Measurement

Leakage measures the probability of a quantum system being outside of a specified subspace. The subspace of interest should be identified using the subspace keyword to the measure function.

init()[source]
leakage(state, subspace, output, params)[source]
measure(data, subspace=None, params={}, int_kwargs={}, **kwargs)[source]
result_shape(*args, **kwargs)[source]
result_type(*args, **kwargs)[source]
result_units

Basis Implementations

class qubricks.wall.bases.SimpleBasis(dim=None, parameters=None, **kwargs)[source]

Bases: qubricks.basis.Basis

SimpleBasis is a subclass of Basis that allows a Basis object to be created on the fly from an Operator, a numpy array or a list instance. For example:

>>> SimpleBasis(parameters=<Parameters intance>, operator=<Operator, numpy.ndarray or list instance>)
init(operator=None)[source]
operator
class qubricks.wall.bases.SpinBasis(dim=None, parameters=None, **kwargs)[source]

Bases: qubricks.wall.bases.StandardBasis

SpinBasis is a subclass of StandardBasis that associates each element of the standard basis with a spin configuration. It assumes that there are n spin-1/2 particles in the system, and thus requires the dimension to be \(2^n\). It also implements conversion to and from string representation of the states.

init()[source]
operator
state_fromString(state, params={})[source]

Convert strings representing sums of basis states of form: “<complex coefficient>|<state label>>” into a numerical vector.

e.g. “|uuu>” -> [1,0,0,0,0,0,0,0]
“0.5|uuu>+0.5|ddd>” -> [0.5,0,0,0,0,0,0,0.5] etc.
state_info(state, params={})[source]

Return a dictionary with the total z-spin projection of the state.

e.g. |uud> -> {‘spin’: 0.5}

state_latex(state, params={})[source]

Returns the latex representation of each of the basis states. Note that this method does not deal with arbitrary states, as does SpinBasis.state_toString and SpinBasis.state_fromString .

state_toString(state, params={})[source]

Applies the inverse map of SpinBasis.state_fromString .

class qubricks.wall.bases.StandardBasis(dim=None, parameters=None, **kwargs)[source]

Bases: qubricks.basis.Basis

StandardBasis is a simple subclass of Basis that describes the standard basis; that is, presents a basis that looks like the identity operator. An instance can be created using:

>>> StandardBasis(parameters=<Parameters instance>, dim=<dimension of basis>)
init()[source]
operator