# EffectiveH¶

Inheritance Diagram Methods

 EffectiveH.__init__(env, i0[, combine, …]) Initialize self. EffectiveH.matvec(theta) Apply the effective Hamiltonian to theta. Apply self to theta, and orthogonalize against self.theta_ortho. Contract self to a matrix.

Class Attributes and Properties

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

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
• env (MPOEnvironment) – Environment for contraction <psi|H|psi>.

• i0 (int) – Index of the active site if length=1, or of the left-most active site if length>1.

• combine (bool, optional) – Whether to combine legs into pipes as far as possible. This reduces the overhead of calculating charge combinations in the contractions.

• move_right (bool, optional) – Whether the sweeping algorithm that calls for an EffectiveH is moving to the right.

• ortho_to_envs (list 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).

length

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

Type

int

dtype

The data type of the involved arrays.

Type

np.dtype

N

Contracting self with as_matrix() will result in an NxN matrix .

Type

int

acts_on

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

Type

list of str

theta_ortho

Projections of ortho_to_envs into the basis of self.

Type

list of Array

_matvec_without_theta_ortho

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

Type

function

matvec(theta)[source]

Apply the effective Hamiltonian to theta.

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

Parameters

theta (Array) – Wave function to apply the effective Hamiltonian to.

Returns

H_theta – Result of applying the effective Hamiltonian to theta, $$H |\theta>$$.

Return type

Array

to_matrix()[source]

Contract self to a matrix.

matvec_theta_ortho(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.)