seemps.analysis.cross.BlackBoxLoadMPS#
- class seemps.analysis.cross.BlackBoxLoadMPS#
Bases:
BlackBoxBlack-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:
- func
Callable The multivariate scalar function to be represented as MPS.
- mesh
Mesh The domain where the function is discretized.
- map_matrix
Matrix,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.
- func
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