ExactDiag¶
full name: tenpy.algorithms.exact_diag.ExactDiag
parent module:
tenpy.algorithms.exact_diag
type: class
-
class
tenpy.algorithms.exact_diag.
ExactDiag
(model, charge_sector=None, sparse=False, max_size=2000000.0)[source]¶ Bases:
object
(Full) exact diagonalization of the Hamiltonian.
- Parameters
- model
MPOmodel
|CouplingModel
The model which is to be diagonalized.
- charge_sector
None
| charges If not
None
, project onto the given charge sector.- sparsebool
If
True
, don’t sort/bunch the LegPipe used to combine the physical legs. This results in array blocks with just one entry, requires much more charge data, and is not what np_conserved was designed for, so it’s not recommended.- max_sizeint
The build_H_* functions will do nothing (but emit a warning) if the total size of the Hamiltonian would be larger than this.
- model
- Attributes
- model
MPOmodel
|CouplingModel
The model which is to be diagonalized.
- chinfo
ChargeInfo
The nature of the charge (which is the same for all sites).
- charge_sector
None
| charges If not
None
, we project onto the given charge sector.- max_sizeint
The
build_H_*
functions will do nothing (but emit a warning) if the total size of the Hamiltonian would be larger than this.- full_H
Array
|None
The full Hamiltonian to be diagonalized with legs
'(p0.p1....)', '(p0*,p1*...)'
(in that order).None
if thebuild_H_*
functions haven’t been called yet, or if max_size would have been exceeded.- Endarray |
None
1D array of eigenvalues.
- V
Array
|None
Eigenvectors. First leg ‘ps’ are physical legs, the second leg
'ps*'
corresponds to the eigenvalues.- _siteslist of
Site
The sites in the given order.
- _labels_plist or str
The labels use for the physical legs; just
['p0', 'p1', ...., 'p{L-1}']
.- _labels_pconjlist or str
Just each of _labels_p with an
*
.- _pipe
LegPipe
The pipe from the single physical legs to the full combined leg.
- _pipe_conj
LegPipe
Just
_pipe.conj()
.- _mask1D bool ndarray |
None
Bool mask, which of the indices of the pipe are in the desired charge_sector.
- model
Methods
build_full_H_from_bonds
(self)Calculate self.full_H from self.mpo.
build_full_H_from_mpo
(self)Calculate self.full_H from self.mpo.
exp_H
(self, dt)Return
U(dt) := exp(-i H dt)
.from_H_mpo
(H_MPO, \*args, \*\*kwargs)Wrapper taking directly an MPO instead of a Model.
full_diagonalization
(self, \*args, \*\*kwargs)Full diagonalization to obtain all eigenvalues and eigenvectors.
full_to_mps
(self, psi[, canonical_form])Convert a full state (with a single leg) to an MPS.
groundstate
(self[, charge_sector])Pick the ground state energy and ground state from
self.V
.matvec
(self, psi)Allow to use self as LinearOperator for lanczos.
mps_to_full
(self, mps)Contract an MPS along the virtual bonds and combine its legs.
sparse_diag
(self, k, \*args, \*\*kwargs)Call
speigs()
.-
classmethod
from_H_mpo
(H_MPO, *args, **kwargs)[source]¶ Wrapper taking directly an MPO instead of a Model.
- Parameters
- H_MPO
MPO
The MPO representing the Hamiltonian.
- *args, **kwargs :
Other arguments as for the
__init__
of the class.
- H_MPO
-
full_diagonalization
(self, *args, **kwargs)[source]¶ Full diagonalization to obtain all eigenvalues and eigenvectors.
Arguments are given to
eigh
.
-
groundstate
(self, charge_sector=None)[source]¶ Pick the ground state energy and ground state from
self.V
.- Parameters
- charge_sectorNone | 1D ndarray
By default (
None
), consider all charge sectors. Alternatively, give the qtotal which the returned state should have.
- Returns
- E0float
Ground state energy (possibly in the given sector).
- psi0
Array
Ground state (possibly in the given sector).
-
full_to_mps
(self, psi, canonical_form='B')[source]¶ Convert a full state (with a single leg) to an MPS.