cbloq_to_superquimb#
View source on GitHub
|
Convert a composite bloq into a superoperator tensor network.
qualtran.simulation.tensor.cbloq_to_superquimb(
cbloq: qualtran.CompositeBloq,
friendly_indices: bool = False
) -> qtn.TensorNetwork
This simulation strategy can handle non-unitary dynamics, but is more costly.
This function will call Bloq.my_tensors on each subbloq in the composite bloq to add
tensors to a quimb tensor network. This uses ths system+environment strategy for modeling
open system dynamics. In contrast to cbloq_to_quimb, each bloq will have
its tensors added twice: once to the part of the network representing the “forward”
wavefunction, and its conjugate added to the part of the network representing the “backward”
part of the wavefunction. If the bloq returns a sentinel value of the DiscardInd class,
that particular index is traced out: the forward and backward copies of the index are joined.
This corresponds to removing the qubit from the computation and integrating over its possible
values. Arbitrary non-unitary dynamics can be modeled by unitary interaction of the ‘system’
with an ‘environment’ that is traced out.
If a bloq returns a value of type DiscardInd in its tensors, this function must be
used. The ordinary cbloq_to_quimb will raise an error.
Args
cbloqThe composite bloq.
friendly_indicesIf set to True, the outer indices of the tensor network will be renamed from their Qualtran-computer-readable form to human-friendly strings. This may be useful if you plan on manually manipulating the resulting tensor network but will preclude any further processing by Qualtran functions. The indices are named {soq.reg.name}{soq.idx}_{j}{side}{direction}, where j is the individual bit index, side is ‘l’ or ‘r’ for left or right (resp.), and direction is ‘f’ or ‘b’ for the forward or backward (adjoint) wavefunctions.
View source on GitHub