LayerModel

class LayerModel(L, H2, H1=None, cyclic=False)[source]

Bases: LocalHam1D

A model for representing a layer of time-evolution interactions.

Essentially, this class is a simple wrapper of quimb.tensor.LocalHam1D. Its main purpose is to provide a simple interface for constructing a Quimb-compatible Hamiltonian from Qiskit objects.

Methods

classmethod from_quantum_circuit(circuit, *, keep_only_odd=None, **kwargs)[source]

Construct a LayerModel from a QuantumCircuit.

You can see an example of this function in action in the docs of quimb_layers.

Parameters:
  • circuit (QuantumCircuit) – the quantum circuit to parse.

  • keep_only_odd (bool | None) – whether to keep only interactions on bonds with odd indices.

  • kwargs – any additional keyword arguments to pass to the LayerModel constructor.

Returns:

A new LayerModel instance.

Raises:

NotImplementedError – if an unsupported quantum gate is encountered.

Return type:

LayerModel

get_gate_expm(where, x)[source]

Get the local term at the sites where, matrix exponentiated by x.

Parameters:
  • where (tuple[int, int]) – the pair of site indices of the local term to get. This identifies the bond index.

  • x (float) – the value with which to matrix exponentiate the interaction term.

Returns:

The interaction in terms of an array or None if this layer has no interaction on this bond.

Return type:

ndarray | None