Closed JoeyT1994 closed 3 months ago
My thinking on derivative(f::AbstractFormNetwork, state_vertices::Vector)
is that for a form, you can only take the derivative with respect to the state vertices, so a separate function derivative_state
wouldn't be necessary.
@mtfishman In terms of derivative(f::AbstractFormNetwork, state_vertices::Vector)
instead of derivative_state(f::AbstractFormNetwork, state_vertices::Vector)
, the issue is that it conflicts with derivative(itn::AbstractITensorNetwork, vertices::Vector)
in src/derivative.jl
which I want derivative_state
to forward to. We have the hierarchy FormNetwork <: AbstractITensorNetwork
and so currently that would just create a circular loop.
I was originally defining derivative(itn::AbstractITensorNetwork, vertices::Vector)
and having derivative(f::AbstractFormNetwork, state_vertices::Vector)
pass to that by calling derivative(itensornetwork(f), vertices(f, state_vertices))
but the logic for building the bp_cache
(if it is not defined) is in derivative(itn::AbstractITensorNetwork, vertices::Vector)
and I want the default cache (default partitioning) to be different for an AbstractFormNetwork vs an
AbstractITensorNetwork`. I.e I have:
default_partitioning(ψ::AbstractITensorNetwork) = group(v -> v, vertices(ψ))
default_partitioning(f::AbstractFormNetwork) = group(v -> state_vertex(f,v), vertices(f))
at the moment so a standard ψ::AbstractITensorNetwork
just has simple BP done on it with no partitioning but a f::AbstractFormNetwork
will partition itself by the state_vertices
by default.
Attention: Patch coverage is 88.00000%
with 6 lines
in your changes are missing coverage. Please review.
Project coverage is 73.87%. Comparing base (
5df202a
) to head (9bb5c7a
). Report is 3 commits behind head on main.
Files | Patch % | Lines |
---|---|---|
src/caches/beliefpropagationcache.jl | 80.00% | 3 Missing :warning: |
src/formnetworks/abstractformnetwork.jl | 83.33% | 3 Missing :warning: |
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Can't you specify a different default partitioning in derivative(f::AbstractFormNetwork, state_vertices::Vector)
? That issue seems like something we can circumvent without having to define a new function derivative_state
.
Yeah good point: I can make the choice partitioning
a kwarg
of derivative(Alg::"BP", ...)
and have derivative(f::AbstractForm, ...)
define that and pass it on
Looks good, thanks! One more step towards BP-based DMRG/TDVP...
This PR adds the functionality
environment(tn::AbstractITensorNetwork, verbs::Vector)
to the codebase with returns the environment (related to the derivative) of anITensorNetwork
with respect to some subset of its vertices.Algorithms are defined for getting the environments/derivates which currently include either exact contraction or belief propagation. This new functionality has been hooked to interface
environment(f::AbstractFormNetwork, state_vertices::Vector)
.Testing it added for this within
test/test_forms.jl