Skip to main contentIBM Quantum Documentation
Important

IBM Quantum Platform is moving and this version will be sunset on July 1. To get started on the new platform, read the migration guide.

LayerModel

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

GitHub

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

from_quantum_circuit

classmethod from_quantum_circuit(circuit, *, keep_only_odd=None, **kwargs)

GitHub

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

get_gate_expm(where, x)

GitHub

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

Was this page helpful?
Report a bug or request content on GitHub.