qat.mps.mpo.StateMPO
- class qat.mps.mpo.StateMPO(tensor_list: list = None, tensor_types: list = None, external_dims: list = None)
MPO implementation :param tensor_list: list of tensors for internal MPS representation :type tensor_list: list(array) :param tensor_types: list of tensor types for internal MPS representation :type tensor_types: list(array) :param external_dims: the list of external dims (ket, bra) :type external_dims: list(pair(int)
- contract(max_qubit_memory_limit: int = 12)
Contract the MPO into its statevector representation.
- Parameters
max_qubit_memory_limit (int, optional) – Limits the size of the MPO to be contracted to a specific number of qubit to avoid memory issues. Default to 12.
- Returns
The density matrix.
- Return type
np.ndarray
- expectation_value(obs: Observable) double complex
Compute the expectation value of the Observable.
- Parameters
obs (Observable) – The observable to compute.
- Returns
Expectation value for given observable.
- Return type
complex
- get_memory_used()
Compute memory used by the tensor network in megabytes (MB).
- Returns
Number of MB used
- Return type
float
- load(filepath: str)
Load the MPO from an NPZ file.
- Parameters
filepath (str) – Path of the NPZ file.
- sample(state_index: int) float
Get probability of input state.
- Parameters
state_index (int) – State index LSB ordered (0 = |00…00>, 1 = |00…01>, …etc)
- Returns
Probability of the realisation of input state index.
- Return type
float
- save(filepath: str)
Save the MPO to the disk as NumPy NPZ file.
- Parameters
filepath (str) – Path where the NPZ file will be saved.
- trace() double complex
Compute trace of MPO.