tnpy.exact_diagonalization.ExactDiagonalization
1.1. tnpy.exact_diagonalization.ExactDiagonalization#
- class tnpy.exact_diagonalization.ExactDiagonalization(mpo, proj=None)[source]#
Bases:
tnpy.operators.FullHamiltonian
Perform the numerically exact diagonalization on the matrix, which is constructed through the given Matrix Product Operator (MPO). Calculations are taken in prompt on the initialization of this class.
- Parameters
mpo (tnpy.operators.MatrixProductOperator) – The matrix product operator.
proj (numpy.ndarray) – Projector apply to the Hamiltonian, \(P^T H P\).
- Raises
ResourceWarning – When the dimensions of Hamiltonian are larger than \(4096 \times 4096\).
Examples
>>> ed = ExactDiagonalization(mpo) >>> evals = ed.evals >>> evecs = ed.evecs
- __init__(mpo, proj=None)[source]#
Perform the numerically exact diagonalization on the matrix, which is constructed through the given Matrix Product Operator (MPO). Calculations are taken in prompt on the initialization of this class.
- Parameters
mpo (tnpy.operators.MatrixProductOperator) – The matrix product operator.
proj (Optional[numpy.ndarray]) – Projector apply to the Hamiltonian, \(P^T H P\).
- Raises
ResourceWarning – When the dimensions of Hamiltonian are larger than \(4096 \times 4096\).
Examples
>>> ed = ExactDiagonalization(mpo) >>> evals = ed.evals >>> evecs = ed.evecs
Methods
__init__
(mpo[, proj])Perform the numerically exact diagonalization on the matrix, which is constructed through the given Matrix Product Operator (MPO).
connected_two_point_function
(operator1, ...)- param operator1
entanglement_entropy
(site[, level_idx, ...])Compute the von Neumann entropy on the cutting
site
.kron_operators
(operators)Perform Kronecker product on the given sequence of operators.
one_point_function
(operator, site[, level_idx])Compute the expectation value \(\langle \hat{O}_i \rangle\) of given local operator \(\hat{O}_i\) on site \(i\).
reduced_density_matrix
(site[, level_idx])Compute the reduced density matrix on the bi-partition
site
\(i\) through the singular value decomposition.two_point_function
(operator1, operator2, ...)Compute the correlation function \(\langle \hat{O}_{i_1}^A \hat{O}_{i_2}^B \rangle\) of 2 given local operators \(\hat{O}_{i_1}^A\) and \(\hat{O}_{i_2}^B\) on site \(i_1\) and \(i_2\).
variance
([operator, tol])Compute the variance on input operator.
Attributes
Eigenvalues in ascending order.
Eigenvectors in the order accordingly to
evals
.matrix
n_sites
phys_dim
- __init__(mpo, proj=None)[source]#
Perform the numerically exact diagonalization on the matrix, which is constructed through the given Matrix Product Operator (MPO). Calculations are taken in prompt on the initialization of this class.
- Parameters
mpo (tnpy.operators.MatrixProductOperator) – The matrix product operator.
proj (Optional[numpy.ndarray]) – Projector apply to the Hamiltonian, \(P^T H P\).
- Raises
ResourceWarning – When the dimensions of Hamiltonian are larger than \(4096 \times 4096\).
Examples
>>> ed = ExactDiagonalization(mpo) >>> evals = ed.evals >>> evecs = ed.evecs
- property proj: numpy.ndarray#
- property evals: numpy.ndarray#
Eigenvalues in ascending order.
- property evecs: numpy.ndarray#
Eigenvectors in the order accordingly to
evals
.- Returns
The eigenvectors, with the column
v[:, k]
is the eigenvector corresponding to the k-th eigenvaluew[k]
.
- reduced_density_matrix(site, level_idx=0)[source]#
Compute the reduced density matrix on the bi-partition
site
\(i\) through the singular value decomposition.\[\rho_A = tr_B \rho\]- Parameters
site (int) – The site to which the bi-partition is taken on the bond \(i\) to \(i+1\).
level_idx (int) – Compute on k-th eigenvector. Default 0 to the 1st eigenvector.
- Return type
Returns:
- entanglement_entropy(site, level_idx=0, nan_to_num=False)[source]#
Compute the von Neumann entropy on the cutting
site
.- Parameters
site (int) – The site to which the bi-partition is taken on the bond \(i\) to \(i+1\).
level_idx (int) – Compute on k-th eigenvector. Default 0 to the 1st eigenvector.
nan_to_num (bool) – If True, convert NaN to zero. Default False.
- Return type
float
Returns:
- static kron_operators(operators)[source]#
Perform Kronecker product on the given sequence of operators. This can be used to construct, for instance, \(I_1 \otimes \cdots \otimes S_i^z \otimes \cdots \otimes I_N\) on the many-body basis.
- Parameters
operators (Sequence[numpy.ndarray]) – A list of operators to take Kronecker product.
- Returns
The resulting product operator.
- Return type
- one_point_function(operator, site, level_idx=0)[source]#
Compute the expectation value \(\langle \hat{O}_i \rangle\) of given local operator \(\hat{O}_i\) on site \(i\).
- Parameters
operator (numpy.ndarray) – The operator \(\hat{O}\).
site (int) –
level_idx (int) –
- Return type
float
Returns:
- two_point_function(operator1, operator2, site1, site2, level_idx)[source]#
Compute the correlation function \(\langle \hat{O}_{i_1}^A \hat{O}_{i_2}^B \rangle\) of 2 given local operators \(\hat{O}_{i_1}^A\) and \(\hat{O}_{i_2}^B\) on site \(i_1\) and \(i_2\).
- Parameters
operator1 (numpy.ndarray) – The first operator \(\hat{O}^A\).
operator2 (numpy.ndarray) – The second operator \(\hat{O}^B\).
site1 (int) –
site2 (int) –
level_idx (int) –
- Return type
float
Returns:
- connected_two_point_function(operator1, operator2, site1, site2, level_idx)[source]#
- Parameters
operator1 (numpy.ndarray) –
operator2 (numpy.ndarray) –
site1 (int) –
site2 (int) –
level_idx (int) –
- Return type
float
Returns:
- variance(operator=None, tol=1e-12)[source]#
Compute the variance on input operator.
- Parameters
operator (Optional[numpy.ndarray]) – Default None to the Hamailtonian itself.
tol (float) – The numerical tolerance.
- Returns
The variance.
- Raises
Warnings – If any off-diagonal element is larger than
tol
.- Return type