acetn.evolution package
Submodules
acetn.evolution.als_solver module
- class acetn.evolution.als_solver.ALSSolver(n12, a12g, bD, pD, nD, config)
Bases:
objectA class that implements the Alternating Least Squares (ALS) algorithm to solve for reduced tensors in the context of iPEPS tensor network optimization.
- calculate_distance(a1r, a2r)
- static initialize_reduced_tensors(a12g, bD, pD, nD)
Initializes the reduced tensors a1r and a2r from the gate-contracted tensor a12g.
The method performs a singular value decomposition (SVD) on a reshaped version of the gate-contracted tensor a12g and constructs the reduced tensors based on the resulting singular values and vectors.
Parameters:
- a12gTensor
The a1, a2, and gate-contracted tensor to be approximated in the ALS optimization.
- bDint
The bond dimension of the tensors.
- pDint
The physical dimension of the tensors.
Returns:
- tuple
A tuple containing the initialized reduced tensors a1r and a2r.
- initialize_tensors(bD, pD, nD)
- solve()
Solves the Alternating Least Squares (ALS) optimization problem by alternating between solving for a1r and a2r for a fixed number of iterations.
The method iterates the ALS optimization procedure, solving for one tensor at a time while fixing the other.
Returns:
- tuple
A tuple containing the updated reduced tensors (a1r, a2r).
- solve_a1r(n12g, a2r, bD, pD, nD)
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.
- bDint
The bond dimension of the tensors.
- pDint
The physical dimension of the tensors.
Returns:
- Tensor
The solved reduced tensor a1r.
- solve_a2r(n12g, a1r, bD, pD, nD)
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.
- bDint
The bond dimension of the tensors.
- pDint
The physical dimension of the tensors.
Returns:
- Tensor
The solved reduced tensor a2r.
- solve_ar(R, S, bD, pD, nD)
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.
- bDint
The bond dimension of the tensors.
- pDint
The physical dimension of the tensors.
Returns:
- Tensor
The solved reduced tensor ar reshaped to the appropriate dimensions.
acetn.evolution.evolve module
- acetn.evolution.evolve.evolve(ipeps, dtau, steps, model, config)
Evolves the iPEPS tensor network over a given number of steps.
- Args:
ipeps (Ipeps): The iPEPS object representing the tensor network. dtau (float): The imaginary-time step size. steps (int): The number of evolution steps to perform. model (Model): The model used for generating the gate in the evolution. config (dict): A configuration dictionary that contains parameters for the evolution.
- Returns:
None: The function updates the iPEPS tensors in place and logs the runtime.
acetn.evolution.fast_full_update module
- class acetn.evolution.fast_full_update.FastFullUpdater(ipeps, gate, config)
Bases:
FullUpdaterA 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:
TensorUpdaterA 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.
- static decompose_site_tensors(a1, a2)
Decomposes the site tensors a1 and a2 into their core and reduced parts using QR decomposition.
Parameters:
- a1Tensor
The first tensor at the site being decomposed.
- a2Tensor
The second tensor at the site being decomposed.
Returns:
- a1qTensor
The core part of the first tensor after decomposition.
- a1rTensor
The reduced part of the first tensor after decomposition.
- a2qTensor
The core part of the second tensor after decomposition.
- a2rTensor
The reduced part of the second tensor after decomposition.
- 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.
- static recompose_site_tensors(a1q, a1r, a2q, a2r)
Reconstructs the full site tensors from the decomposed core and reduced components.
Parameters:
- a1qTensor
The core part of the first tensor.
- a1rTensor
The reduced part of the first tensor.
- a2qTensor
The core part of the second tensor.
- a2rTensor
The reduced part of the second tensor.
Returns:
- a1Tensor
The reconstructed tensor for the first site.
- a2Tensor
The reconstructed tensor for the second site.
- 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.gauge_fix(nz, a12g, atol=1e-12)
Applies a gauge fixing procedure to the norm tensor square root and the reduced tensors. See
Parameters:
- nzTensor
The positive-approximation norm tensor 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:
objectA 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:
ABCAbstract base class for the iPEPS tensor update.
- static bond_permutation(k)
Generates a permutation pattern for tensor indices based on the bond direction k.
The permutation is calculated by shifting the tensor indices in a circular fashion, and it determines how the tensor’s dimensions will be permuted during the update process.
Parameters:
- kint
The bond index used to generate the permutation pattern.
Returns:
- list
A list representing the permutation pattern of the tensor indices.
- permute_bond_tensors(a1, a2, k)
Permutes the input tensors a1 and a2 based on the bond index k.
This method rearranges the dimensions of the tensors according to a permutation pattern determined by the bond direction k, which is typically used in the iPEPS update procedure.
Parameters:
- a1Tensor
The first input tensor to be permuted.
- a2Tensor
The second input tensor to be permuted.
- kint
The bond index used to determine the permutation pattern.
Returns:
- tuple
A tuple containing the permuted tensors (a1, a2).
- abstract tensor_update()
Abstract method that should be implemented by subclasses to define the specific logic for updating the tensors in the iPEPS network.
This method must be overridden by a subclass to provide the specific update operation for the tensors based on the network’s requirements.
Returns:
None
- update(**kwargs)