EffectiveH

class tenpy.algorithms.mps_sweeps.EffectiveH(env, i0, combine=False, move_right=True, ortho_to_envs=[])[source]

Bases: tenpy.linalg.sparse.NpcLinearOperator

Prototype class for local effective Hamiltonians used in sweep algorithms.

As an example, the local effective Hamiltonian for a two-site (DMRG) algorithm looks like:

|        .---       ---.
|        |    |   |    |
|       LP----H0--H1---RP
|        |    |   |    |
|        .---       ---.

where H0 and H1 are MPO tensors.

Parameters
envMPOEnvironment

Environment for contraction <psi|H|psi>.

i0int

Index of the active site if length=1, or of the left-most active site if length>1.

combinebool, optional

Whether to combine legs into pipes as far as possible. This reduces the overhead of calculating charge combinations in the contractions.

move_rightbool, optional

Whether the sweeping algorithm that calls for an EffectiveH is moving to the right.

ortho_to_envslist of MPSEnvironment

List of environments <psi|psi_ortho>, where psi_ortho is an MPS to orthogonalize against. See matvec_theta_ortho() for more details. We implement this by effectively sending H -> (1 - sum_o |theta_o><theta_o|) H (1 - sum_o |theta_o><theta_o|), where |theta_o> is |psi_o> projected into the appropriate basis (in which self is given).

Attributes
lengthint

Number of (MPS) sites the effective hamiltonian covers. NB: Class attribute.

dtypenp.dtype

The data type of the involved arrays.

Nint

Contracting self with as_matrix() will result in an N`x`N matrix .

acts_onlist of str

Labels of the state on which self acts. NB: class attribute. Overwritten by normal attribute, if combine.

theta_ortholist of Array

Projections of ortho_to_envs into the basis of self.

_matvec_without_theta_orthofunction

Backup copy of matvec(). Allows to monkey-patch matvec() with matvec_theta_ortho(), which is done in _set_theta_ortho().

Methods

matvec(self, theta)

Apply the effective Hamiltonian to theta.

matvec_theta_ortho(self, theta)

Apply self to theta, and orthogonalize against self.theta_ortho.

to_matrix(self)

Contract self to a matrix.

matvec(self, theta)[source]

Apply the effective Hamiltonian to theta.

This function turns EffectiveH to a linear operator, which can be used for lanczos().

Parameters
thetaArray

Wave function to apply the effective Hamiltonian to.

Returns
H_thetaArray

Result of applying the effective Hamiltonian to theta, \(H |\theta>\).

to_matrix(self)[source]

Contract self to a matrix.

matvec_theta_ortho(self, theta)[source]

Apply self to theta, and orthogonalize against self.theta_ortho. __ We implement this by effectively replacing H -> P H P with the projector P = 1 - sum_o |o> <o| projecting out the states from theta_ortho.

Parameter and return value as for matvec() (which this function replaces, if the class was initialized with non-empty ortho_to_envs.)