seemps.analysis.cross.BlackBoxLoadMPS#

class seemps.analysis.cross.BlackBoxLoadMPS#

Bases: BlackBox

Black-box representing a multivariate scalar function discretized on a Mesh object. Each function degree of freedom is quantized and arranged according to an arbitrary map_matrix operator and assigned a collection of MPS tensors with the given physical_dimensions.

Parameters:
funcCallable

The multivariate scalar function to be represented as MPS.

meshMesh

The domain where the function is discretized.

map_matrixMatrix, optional

An operator that encodes the quantization and arrangement of the MPS tensors. If None, no quantization is assumed and each Mesh dimension is assigned a unique MPS tensor (i.e., “tensor-train structure”).

physical_dimensions: Vector, optional

An array representing the physical sizes of the resulting MPS tensors, required when map_matrix is not None to correctly represent the quantization.

Examples


# Load a bivariate Gaussian function 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 Mesh start, stop = -1, 1 n_qubits = 10 interval = RegularInterval(start, stop, 2**n_qubits) mesh = Mesh([interval, interval])

# Define the quantization operator. Without loss of generality, we consider an “interleaved” # (B) permutation of tensors, each of physical dimension 2. Any other arrangement is possible. permutation = interleaving_permutation([n_qubits, n_qubits]) map_matrix = mps_to_mesh_matrix([n_qubits, n_qubits], permutation=permutation) physical_dimensions = [2] * (2 * n_qubits)

# Define the black box. black_box = BlackBoxLoadMPS(func, mesh, map_matrix, physical_dimensions)

# Load the function in the given domain using some TCI variant (e.g. DMRG, Maxvol or Greedy), # which is dynamically dispatched based on the given CrossStrategy type. cross_strategy = CrossStrategyX() cross_results = cross_interpolation(black_box, cross_strategy) mps = cross_results.mps