Skip to content

Commit

Permalink
SimpleUpdateGen allow power gate_opt
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmgray committed Jul 22, 2024
1 parent 3982ec2 commit 64ca14f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
27 changes: 25 additions & 2 deletions quimb/tensor/tensor_arbgeom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,16 @@ def gate(

gate_ = functools.partialmethod(gate, inplace=True)

def gate_simple_(self, G, where, gauges, renorm=True, **gate_opts):
def gate_simple_(
self,
G,
where,
gauges,
renorm=True,
smudge=1e-12,
power=1.0,
**gate_opts
):
"""Apply a gate to this vector tensor network at sites ``where``, using
simple update style gauging of the tensors first, as supplied in
``gauges``. The new singular values for the bond are reinserted into
Expand All @@ -1041,6 +1050,15 @@ def gate_simple_(self, G, where, gauges, renorm=True, **gate_opts):
renorm : bool, optional
Whether to renormalise the singular after the gate is applied,
before reinserting them into ``gauges``.
smudge : float, optional
A small value to add to the gauges before multiplying them in and
inverting them to avoid numerical issues.
power : float, optional
The power to raise the singular values to before multiplying them
in and inverting them.
gate_opts
Supplied to
:meth:`~quimb.tensor.tensor_core.TensorNetwork.gate_inds`.
"""
if isinstance(where, int):
where = (where,)
Expand All @@ -1055,7 +1073,12 @@ def gate_simple_(self, G, where, gauges, renorm=True, **gate_opts):
site_tags = tuple(map(self.site_tag, where))
tn_where = self.select_any(site_tags)

with tn_where.gauge_simple_temp(gauges, ungauge_inner=False):
with tn_where.gauge_simple_temp(
gauges,
smudge=smudge,
power=power,
ungauge_inner=False,
):
info = {}
tn_where.gate_(G, where, info=info, **gate_opts)

Expand Down
5 changes: 5 additions & 0 deletions quimb/tensor/tensor_arbgeom_tebd.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,11 @@ def gate(self, U, where):
U, where, gauges=self.gauges, **self.gate_opts
)

def normalize(self):
"""Normalize the state and simple gauges.
"""
self._psi.normalize_simple(self.gauges)

def compute_energy(self):
return self._psi.compute_local_expectation_cluster(
terms=self.ham.terms,
Expand Down

0 comments on commit 64ca14f

Please sign in to comment.