qat.mps.StateMPO
- class qat.mps.StateMPO(tensor_list: list, tensor_types: list = None, external_dims: list = None)
MPO representing a density matrix.
This can be seen as an MPS representation of the vectorized density matrix |rho>>.
- Parameters:
tensor_list (list(array)) – list of tensors for internal MPS representation
tensor_types (list(array)) – list of tensor types for internal MPS representation
external_dims (list(pair(int)) – the list of external dims (ket, bra)
- contract()
Contract the MPO into a matrix.
- Returns:
The matrix.
- Return type:
np.ndarray
- expectation_value(obs: Observable) 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
- classmethod 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() complex
Compute trace of MPO.