state_metrics.hilbert_schmidt_inner_product¶
Hilbert-Schmidt Inner Product refers to the inner product between two Hilbert-Schmidt operators.
Functions¶
|
Compute the Hilbert-Schmidt inner product between two matrices [2]. |
Module Contents¶
- state_metrics.hilbert_schmidt_inner_product.hilbert_schmidt_inner_product(a_mat, b_mat)¶
Compute the Hilbert-Schmidt inner product between two matrices [2].
The Hilbert-Schmidt inner product between
a_mat
andb_mat
is defined as\[HS = (A|B) = Tr[A^\dagger B]\]where \(|B\rangle = \text{vec}(B)\) and \(\langle A|\) is the dual vector to \(|A \rangle\).
Note: This function has been adapted from [1].
Examples
One may consider taking the Hilbert-Schmidt distance between two Hadamard matrices.
>>> import numpy as np >>> from toqito.matrices import hadamard >>> from toqito.state_metrics import hilbert_schmidt_inner_product >>> h = hadamard(1) >>> np.around(hilbert_schmidt_inner_product(h, h), decimals=2) np.float64(2.0)
References
[1]Rigetti. Forest benchmarking. URL: https://github.com/rigetti/forest-benchmarking.
[2] (1,2)Wikipedia. Hilbert-schmidt operator. URL: https://en.wikipedia.org/wiki/Hilbert%E2%80%93Schmidt_operator.
- Parameters:
a_mat (numpy.ndarray) – An input matrix provided as a numpy array.
b_mat (numpy.ndarray) – An input matrix provided as a numpy array.
- Returns:
The Hilbert-Schmidt inner product between
a_mat
andb_mat
.- Return type:
complex