acetn.evolution package

Submodules

acetn.evolution.als_solver module

class acetn.evolution.als_solver.ALSSolver(n12, a12g, ar_shape, config)

Bases: object

Alternating Least Squares (ALS) solver for the reduced tensor update.

static build_r1(n12, a2r)
static build_r2(n12, a1r)
static build_s1(n12g, a2r)
static build_s2(n12g, a1r)
static calculate_cost(a1r, a2r, a12g, n12)
static cholesky_solve(R, S)
static initialize_reduced_tensors(a12g, ar_shape)

Initializes the reduced tensors a1r and a2r from the gate-contracted tensor a12g.

The initial guess for the updated a1r and a2r is determined from a truncated SVD of a12g.

Parameters:

a12gTensor

The gate-tensor product.

ar_shapetuple

The shape of the reduced tensors.

Returns:

tuple

A tuple containing the initialized reduced tensors a1r and a2r.

initialize_tensors()
solve()

Solves for the updated tensors by alternating between solving for a1r and a2r.

Initialization is always done in PyTorch, then the iteration loop is handled by the backend-specific implementation.

Returns:

tuple

A tuple containing the updated reduced tensors (a1r, a2r).

solve_a1r(n12g, a2r)

Solves for the reduced tensor a1r in the ALS optimization process.

This method forms a system of linear equations and solves for a1r given the fixed tensor a2r.

Parameters:

n12gTensor

The modified norm tensor used in the ALS optimization.

a2rTensor

The fixed reduced tensor a2r.

Returns:

Tensor

The solved reduced tensor a1r.

solve_a2r(n12g, a1r)

Solves for the reduced tensor a2r in the ALS optimization process.

This method forms a system of linear equations and solves for a2r given the fixed tensor a1r.

Parameters:

n12gTensor

The modified norm tensor used in the ALS optimization.

a1rTensor

The fixed reduced tensor a1r.

Returns:

Tensor

The solved reduced tensor a2r.

solve_ar(R, S)

Solves the linear system for the reduced tensor using either Cholesky decomposition or pseudoinverse.

Depending on the chosen method, this function either solves the system using Cholesky decomposition or computes the pseudoinverse of the matrix R to solve the linear system.

Parameters:

RTensor

The matrix representing the linear system to be solved.

STensor

The right-hand side vector of the linear system.

Returns:

Tensor

The solved reduced tensor ar reshaped to the appropriate dimensions.

solve_cutensor(a1r, a2r, n12g)

C++ implementation of the ALS iteration loop.

This calls the compiled C++ function that performs the entire iteration loop using cuTensor operations for maximum performance.

Parameters:

a1rTensor

Initial reduced tensor for first site.

a2rTensor

Initial reduced tensor for second site.

n12gTensor

Modified norm tensor.

Returns:

tuple

Updated tensors (a1r, a2r).

solve_torch(a1r, a2r, n12g)

Python implementation of the ALS iteration loop.

Parameters:

a1rTensor

Initial reduced tensor for first site.

a2rTensor

Initial reduced tensor for second site.

n12gTensor

Modified norm tensor.

Returns:

tuple

Updated tensors (a1r, a2r).

acetn.evolution.evolve module

acetn.evolution.evolve.create_tensor_updater(ipeps, gate, config)

Create the appropriate tensor updater based on config.update_type.

acetn.evolution.evolve.evolve(ipeps, dtau, steps, model, config)

Evolve the iPEPS tensor network in imaginary time.

Args:

ipeps: The iPEPS tensor network. dtau: Imaginary-time step size. steps: Number of evolution steps. model: Model that defines the Hamiltonian and gates. config: Evolution configuration.

acetn.evolution.fast_full_update module

class acetn.evolution.fast_full_update.FastFullUpdater(ipeps, gate, config)

Bases: FullUpdater

A subclass of FullUpdater that combines full updates with directional moves using both distributed and non-distributed Corner Transfer Matrix (CTM) updates.

Attributes:
mover (DirectionalMover): An instance of the DirectionalMover class responsible for

performing directional moves updating the iPEPS boundary tensors following the tensor update.

absorb_bond(**kwargs)
absorb_bond_dist(**kwargs)
bond_update(bond)

Updates the tensors for a given bond in the iPEPS network.

Depending on whether the iPEPS network is distributed or not, this method either broadcasts tensors across ranks or updates them locally. Afterward, it absorbs the updated bond either in a distributed or non-distributed manner.

Args:
bond (list): A list representing a bond in the iPEPS network. It contains the site

indices of two adjacent tensors and an integer (k) that indicates the direction of the update.

Returns:
tuple: A tuple containing two values:
  • ctm_time (float): The time spent on the CTM update for the bond.

  • upd_time (float): The time spent on the full update for the bond.

acetn.evolution.full_update module

class acetn.evolution.full_update.FullUpdater(ipeps, gate, config)

Bases: TensorUpdater

A concrete subclass of TensorUpdater that implements the full tensor update algorithm. This class performs tensor decompositions, updates the reduced tensors, applies a gate operation, and recomposes the tensors.

finalize_reduced_tensors(a1r, a2r)

Finalizes the tensor update using the method shown in Fig.12(b) of arxiv.org/abs/1405.3259.

Parameters:

a1rTensor

The reduced tensor for the first site.

a2rTensor

The reduced tensor for the second site.

Returns:

a1r, a2rTensor

The finalized reduced tensors.

precondition_norm_tensor(n12, a12g)

Applies positive approximation and (optionally) gauge fixing to the norm tensor, improving conditioning for ALS. The gate-tensor product is also modified when gauge fixing is used.

Parameters:

n12Tensor

The norm tensor.

a12gTensor

The contracted a1r-a2r-gate.

Returns:

n12, a12gTensor

The updated tensors.

tensor_update(a1, a2, bond)

Performs the full tensor update process for the given bond. This involves tensor decomposition, norm tensor computation, reduced tensor update, and tensor recomposition.

Parameters:

a1Tensor

The first tensor at the site being updated.

a2Tensor

The second tensor at the site being updated.

bondtuple

The bond that connects the two tensors (indices and position).

Returns:

a1, a2Tensor

The updated tensors after performing the tensor update operation.

update_reduced_tensors(a1r, a2r, n12, gate)

Updates the reduced tensors by applying the gate operation and norm tensor, and optionally applying gauge fixing.

Parameters:

a1rTensor

The reduced tensor for the first site.

a2rTensor

The reduced tensor for the second site.

n12Tensor

The norm tensor that represents the bond interaction between the two sites.

gateTensor

The gate operation to be applied during the update.

Returns:

a1r, a2rTensor

The updated reduced tensors for the first and second sites.

acetn.evolution.full_update.build_norm_tensor(ipeps, bond, a1q, a2q)

Builds the norm tensor for a given bond in the iPEPS network. The norm tensor is a combination of tensors from the iPEPS network and the decomposed tensors for the two sites. This tensor is used to calculate the bond interactions and tensor updates in the iPEPS algorithm.

Parameters:

ipepsobject

An instance of the iPEPS tensor network, which contains the tensors that define the network.

bondtuple

A tuple representing the bond that connects two tensors in the network. Typically, this consists of two site indices and the bond index (s1, s2, k).

a1qTensor

The core part of the first site tensor after decomposition.

a2qTensor

The core part of the second site tensor after decomposition.

Returns:

n12Tensor

The resulting norm tensor, which represents the interaction between the two tensors at the given bond.

acetn.evolution.full_update.build_norm_tensor_core(c12, e12, e11, c13, e13, a1q, c21, e21, e24, c24, e23, a2q)
acetn.evolution.full_update.build_norm_tensor_core_blocked(c12, e12, e11, c13, e13, a1q, c21, e21, e24, c24, e23, a2q)
acetn.evolution.full_update.gauge_fix(nz, a12g, atol=1e-12)

Applies a gauge fixing procedure to the norm tensor square root and the reduced tensors.

Parameters:

nzTensor

The norm tensor square root used to adjust the values during gauge fixing.

a12gTensor

The reduced tensor representing the bond interaction that will be updated during the gauge fixing.

cutofffloat, optional (default: 1e-12)

A threshold value for determining which singular values to retain during the SVD.

Returns:

n12Tensor

The updated norm tensor after applying gauge fixing.

a12gTensor

The updated reduced tensor after applying gauge fixing.

nzxr_invTensor

The inverse of the first part of the norm tensor after gauge fixing.

nzyr_invTensor

The inverse of the second part of the norm tensor after gauge fixing.

acetn.evolution.full_update.positive_approx(n12, cutoff=1e-12)

Computes a positive approximation of the norm tensor. Eigenvalues are ensured to be positive by dynamic regularization and the condition number is greatly reduced.

Parameters:

n12Tensor

The norm tensor to be approximated.

cutofffloat, optional (default: 1e-12)

A threshold value for determining the lowest eigenvalues to retain in the approximation.

Returns:

nzTensor

Square root of the updated norm tensor after applying the positive approximation.

acetn.evolution.gate module

class acetn.evolution.gate.Gate(model, dtau, bond_list=None, site_list=None)

Bases: object

A class representing quantum gates for one-site and two-site Hamiltonians, used in time evolution algorithms.

build_one_site_gates(model, dtau, site_list)

Builds the one-site gates for the given list of sites by calculating the exponential of the Hamiltonian for each site.

Parameters:

modelobject

The model that defines the Hamiltonian for the site.

dtaufloat

The imaginary-time step for the gate calculation.

site_listlist

A list of sites for which one-site gates will be created.

build_two_site_gates(model, dtau, bond_list)

Builds the two-site gates for the given list of bonds by calculating the exponential of the Hamiltonian for each bond and adding contributions from one-site Hamiltonians if necessary.

Parameters:

modelobject

The model that defines the Hamiltonians for the bonds and sites.

dtaufloat

The imaginary-time step for the gate calculation.

bond_listlist

A list of bonds for which two-site gates will be created.

calculate_gate(ham, dtau)

Calculates the gate from the Hamiltonian using the matrix exponential and time step.

Parameters:

hamtorch.Tensor

The Hamiltonian matrix for which the gate will be calculated.

dtaufloat

The imaginary-time step for the gate calculation.

Returns:

torch.Tensor

The calculated gate for the given Hamiltonian.

acetn.evolution.tensor_update module

class acetn.evolution.tensor_update.TensorUpdater(ipeps, gate)

Bases: ABC

Abstract base class for iPEPS tensor updates.

static bond_permutation(k)

Cyclic index permutation for bond direction k.

static decompose_site_tensors(a1, a2)

QR-decompose site tensors into environment (Q) and bond-local (R) parts.

finalize()

Called after the evolution loop. Override in subclasses if needed.

permute_bond_tensors(a1, a2, k)

Cyclically permute tensor legs so the bond direction aligns with a standard orientation.

static recompose_site_tensors(a1q, a1r, a2q, a2r)

Reconstruct full site tensors from QR components.

abstract tensor_update()
update(**kwargs)

Module contents

Evolution module for iPEPS tensor network updates.

This module handles the evolution/optimization of tensor networks using various update algorithms (full update, simple update, etc.).

class acetn.evolution.ALSSolver(n12, a12g, ar_shape, config)

Bases: object

Alternating Least Squares (ALS) solver for the reduced tensor update.

static build_r1(n12, a2r)
static build_r2(n12, a1r)
static build_s1(n12g, a2r)
static build_s2(n12g, a1r)
static calculate_cost(a1r, a2r, a12g, n12)
static cholesky_solve(R, S)
static initialize_reduced_tensors(a12g, ar_shape)

Initializes the reduced tensors a1r and a2r from the gate-contracted tensor a12g.

The initial guess for the updated a1r and a2r is determined from a truncated SVD of a12g.

Parameters:

a12gTensor

The gate-tensor product.

ar_shapetuple

The shape of the reduced tensors.

Returns:

tuple

A tuple containing the initialized reduced tensors a1r and a2r.

initialize_tensors()
solve()

Solves for the updated tensors by alternating between solving for a1r and a2r.

Initialization is always done in PyTorch, then the iteration loop is handled by the backend-specific implementation.

Returns:

tuple

A tuple containing the updated reduced tensors (a1r, a2r).

solve_a1r(n12g, a2r)

Solves for the reduced tensor a1r in the ALS optimization process.

This method forms a system of linear equations and solves for a1r given the fixed tensor a2r.

Parameters:

n12gTensor

The modified norm tensor used in the ALS optimization.

a2rTensor

The fixed reduced tensor a2r.

Returns:

Tensor

The solved reduced tensor a1r.

solve_a2r(n12g, a1r)

Solves for the reduced tensor a2r in the ALS optimization process.

This method forms a system of linear equations and solves for a2r given the fixed tensor a1r.

Parameters:

n12gTensor

The modified norm tensor used in the ALS optimization.

a1rTensor

The fixed reduced tensor a1r.

Returns:

Tensor

The solved reduced tensor a2r.

solve_ar(R, S)

Solves the linear system for the reduced tensor using either Cholesky decomposition or pseudoinverse.

Depending on the chosen method, this function either solves the system using Cholesky decomposition or computes the pseudoinverse of the matrix R to solve the linear system.

Parameters:

RTensor

The matrix representing the linear system to be solved.

STensor

The right-hand side vector of the linear system.

Returns:

Tensor

The solved reduced tensor ar reshaped to the appropriate dimensions.

solve_cutensor(a1r, a2r, n12g)

C++ implementation of the ALS iteration loop.

This calls the compiled C++ function that performs the entire iteration loop using cuTensor operations for maximum performance.

Parameters:

a1rTensor

Initial reduced tensor for first site.

a2rTensor

Initial reduced tensor for second site.

n12gTensor

Modified norm tensor.

Returns:

tuple

Updated tensors (a1r, a2r).

solve_torch(a1r, a2r, n12g)

Python implementation of the ALS iteration loop.

Parameters:

a1rTensor

Initial reduced tensor for first site.

a2rTensor

Initial reduced tensor for second site.

n12gTensor

Modified norm tensor.

Returns:

tuple

Updated tensors (a1r, a2r).

class acetn.evolution.FastFullUpdater(ipeps, gate, config)

Bases: FullUpdater

A subclass of FullUpdater that combines full updates with directional moves using both distributed and non-distributed Corner Transfer Matrix (CTM) updates.

Attributes:
mover (DirectionalMover): An instance of the DirectionalMover class responsible for

performing directional moves updating the iPEPS boundary tensors following the tensor update.

absorb_bond(**kwargs)
absorb_bond_dist(**kwargs)
bond_update(bond)

Updates the tensors for a given bond in the iPEPS network.

Depending on whether the iPEPS network is distributed or not, this method either broadcasts tensors across ranks or updates them locally. Afterward, it absorbs the updated bond either in a distributed or non-distributed manner.

Args:
bond (list): A list representing a bond in the iPEPS network. It contains the site

indices of two adjacent tensors and an integer (k) that indicates the direction of the update.

Returns:
tuple: A tuple containing two values:
  • ctm_time (float): The time spent on the CTM update for the bond.

  • upd_time (float): The time spent on the full update for the bond.

class acetn.evolution.FullUpdater(ipeps, gate, config)

Bases: TensorUpdater

A concrete subclass of TensorUpdater that implements the full tensor update algorithm. This class performs tensor decompositions, updates the reduced tensors, applies a gate operation, and recomposes the tensors.

finalize_reduced_tensors(a1r, a2r)

Finalizes the tensor update using the method shown in Fig.12(b) of arxiv.org/abs/1405.3259.

Parameters:

a1rTensor

The reduced tensor for the first site.

a2rTensor

The reduced tensor for the second site.

Returns:

a1r, a2rTensor

The finalized reduced tensors.

precondition_norm_tensor(n12, a12g)

Applies positive approximation and (optionally) gauge fixing to the norm tensor, improving conditioning for ALS. The gate-tensor product is also modified when gauge fixing is used.

Parameters:

n12Tensor

The norm tensor.

a12gTensor

The contracted a1r-a2r-gate.

Returns:

n12, a12gTensor

The updated tensors.

tensor_update(a1, a2, bond)

Performs the full tensor update process for the given bond. This involves tensor decomposition, norm tensor computation, reduced tensor update, and tensor recomposition.

Parameters:

a1Tensor

The first tensor at the site being updated.

a2Tensor

The second tensor at the site being updated.

bondtuple

The bond that connects the two tensors (indices and position).

Returns:

a1, a2Tensor

The updated tensors after performing the tensor update operation.

update_reduced_tensors(a1r, a2r, n12, gate)

Updates the reduced tensors by applying the gate operation and norm tensor, and optionally applying gauge fixing.

Parameters:

a1rTensor

The reduced tensor for the first site.

a2rTensor

The reduced tensor for the second site.

n12Tensor

The norm tensor that represents the bond interaction between the two sites.

gateTensor

The gate operation to be applied during the update.

Returns:

a1r, a2rTensor

The updated reduced tensors for the first and second sites.

class acetn.evolution.Gate(model, dtau, bond_list=None, site_list=None)

Bases: object

A class representing quantum gates for one-site and two-site Hamiltonians, used in time evolution algorithms.

build_one_site_gates(model, dtau, site_list)

Builds the one-site gates for the given list of sites by calculating the exponential of the Hamiltonian for each site.

Parameters:

modelobject

The model that defines the Hamiltonian for the site.

dtaufloat

The imaginary-time step for the gate calculation.

site_listlist

A list of sites for which one-site gates will be created.

build_two_site_gates(model, dtau, bond_list)

Builds the two-site gates for the given list of bonds by calculating the exponential of the Hamiltonian for each bond and adding contributions from one-site Hamiltonians if necessary.

Parameters:

modelobject

The model that defines the Hamiltonians for the bonds and sites.

dtaufloat

The imaginary-time step for the gate calculation.

bond_listlist

A list of bonds for which two-site gates will be created.

calculate_gate(ham, dtau)

Calculates the gate from the Hamiltonian using the matrix exponential and time step.

Parameters:

hamtorch.Tensor

The Hamiltonian matrix for which the gate will be calculated.

dtaufloat

The imaginary-time step for the gate calculation.

Returns:

torch.Tensor

The calculated gate for the given Hamiltonian.

class acetn.evolution.SimpleUpdater(ipeps, gate, config)

Bases: TensorUpdater

Simple update algorithm for iPEPS (Jiang et al. 2008).

Lambda tensors on each bond approximate the environment as a mean field. Each bond update absorbs surrounding lambdas, applies the gate via QR/SVD, then strips the lambdas back. The bond lambda is recomputed from the SVD singular values.

bond_update(bond)

Perform a single simple update step for a bond.

Returns:

tuple: (ctm_time, upd_time) where ctm_time is always 0.

tensor_update(a1, a2, bond)
class acetn.evolution.TensorUpdater(ipeps, gate)

Bases: ABC

Abstract base class for iPEPS tensor updates.

static bond_permutation(k)

Cyclic index permutation for bond direction k.

static decompose_site_tensors(a1, a2)

QR-decompose site tensors into environment (Q) and bond-local (R) parts.

finalize()

Called after the evolution loop. Override in subclasses if needed.

permute_bond_tensors(a1, a2, k)

Cyclically permute tensor legs so the bond direction aligns with a standard orientation.

static recompose_site_tensors(a1q, a1r, a2q, a2r)

Reconstruct full site tensors from QR components.

abstract tensor_update()
update(**kwargs)
acetn.evolution.evolve(ipeps, dtau, steps, model, config)

Evolve the iPEPS tensor network in imaginary time.

Args:

ipeps: The iPEPS tensor network. dtau: Imaginary-time step size. steps: Number of evolution steps. model: Model that defines the Hamiltonian and gates. config: Evolution configuration.