seemps.analysis.cross.BlackBoxLoadMPO#

class seemps.analysis.cross.BlackBoxLoadMPO#

Bases: BlackBox

Black-box representing a 2-dimensional function discretized on a 2D Mesh and quantized in a MPO with physical dimensions given by base_mpo. Can be used to load operators in MPO using tensor cross-interpolation. In practice, this object is equivalently represented as a MPS with physical dimensions of size base_mpo**2, whose indices can be subsequently split to form the required MPO.

Parameters:
funcCallable

The bivariate scalar function to be represented as MPO.

meshMesh

The two-dimensional discretization where the function is discretized.

base_mpoint, default=2

The required physical dimension of each index of the MPO.

is_diagonalbool, default=True

Flag that helps in the convergence of TCI for diagonal operators by restricting the convergence evaluation to the main diagonal.

Examples


# Load a 2D Gaussian function in a non-diagonal MPO using some TCI variant.

# Define the tensorized function following the convention of having the dimension index first. func = lambda tensor: np.exp(-(tensor[0]**2 + tensor[1]**2))

# Define the bivariate domain implictly using Interval and Mesh. start, stop = -1, 1 num_qubits = 10 interval = RegularInterval(start, stop, 2**n) mesh = Mesh([interval, interval])

# Define the black box. black_box = BlackBoxLoadMPO(func, mesh)

# Load the function in the given domain using some tci variant (e.g. DMRG, Maxvol or Greedy). cross_strategy = CrossStrategyX() cross_results = cross_interpolation(black_box, cross_strategy) mpo = mps_as_mpo(cross_results.mps) # Unfold into a MPO.