Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
1ee9641
Slight reorganization
leburgel Aug 27, 2026
01f20b9
Remove environment type restriction in expectation value
leburgel Aug 27, 2026
f0da3af
Reuse corner absorption
leburgel Aug 27, 2026
5ba32fe
Split off local expectation value hook, and route dense TensorMap ver…
leburgel Aug 27, 2026
35788f4
Evaluate `BPEnv` expectation values in exactly the same way, and add …
leburgel Aug 27, 2026
e5facb8
Remove unused `contract_local_operator`
leburgel Aug 27, 2026
496f063
Add vanity line break
leburgel Aug 31, 2026
463f48d
Drop more environment type specifiers
leburgel Aug 31, 2026
00c33b6
Remove unused method (accidentally missed during deprecation)
leburgel Aug 31, 2026
e1cf86e
Drop more type specs
leburgel Aug 31, 2026
15d2330
Restore contract_local_operator for future use
leburgel Sep 2, 2026
f9b10f2
More merging
leburgel Sep 2, 2026
9b24a74
Reorganize `expectation_value` code
leburgel Sep 2, 2026
16bdf9d
Fix absorb docstrings
leburgel Sep 4, 2026
3a0af9c
Fix typo
leburgel Sep 4, 2026
f1b38d6
Fix up more docstrings
leburgel Sep 4, 2026
4d021cd
Add network type annotation
leburgel Sep 4, 2026
c00fe08
Revert docstring to match implementation
leburgel Sep 4, 2026
d92d6c2
Clarify use of supertrace and add explicit reference.
leburgel Sep 4, 2026
68b6514
Try to make docstrings more specific
leburgel Sep 4, 2026
68002ce
Merge branch 'main' into lb/expval
leburgel Sep 10, 2026
cd81b82
Update BP patch contraction comment
leburgel Sep 11, 2026
1685a57
Remove `contractcheck` altogether
leburgel Sep 11, 2026
d8ef1b6
Fix typo
leburgel Sep 14, 2026
7f4b40b
Reorganize files
leburgel Sep 14, 2026
fc4f877
Merge branch 'main' into lb/expval
leburgel Sep 14, 2026
42c39ab
Make `absorb` docstrings more accurate
leburgel Sep 18, 2026
741bd39
Be explicit about supertrace usage
leburgel Sep 18, 2026
6c24758
Move basic label generators up into `util`
leburgel Sep 18, 2026
da75332
Remove non-existing default value from docstring
leburgel Sep 18, 2026
c5a0ead
Always point to generic `_contract_densitymatrix` fallback
leburgel Sep 18, 2026
80a3efb
Be more explicit about supertrace again
leburgel Sep 20, 2026
49496f4
Docstring cleanups
Yue-Zhengyuan Sep 21, 2026
814667f
Latest runic v1.10 formatting
Yue-Zhengyuan Sep 21, 2026
15548b3
Merge remote-tracking branch 'origin/main' into lb/expval
leburgel Sep 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions src/PEPSKit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ using DocStringExtensions
include("Defaults.jl") # Include first to allow for docstring interpolation with Defaults values

include("utility/util.jl")
include("utility/contraction_labels.jl")
include("utility/tensor_traces.jl")
include("utility/indexing.jl")
include("utility/diffable_threads.jl")
include("utility/twistdual.jl")
Expand Down Expand Up @@ -95,15 +97,21 @@ include("algorithms/contractions/ctmrg/halfinf_env.jl")
include("algorithms/contractions/ctmrg/fullinf_env.jl")
include("algorithms/contractions/ctmrg/renormalize_corner.jl")
include("algorithms/contractions/ctmrg/renormalize_edge.jl")
include("algorithms/contractions/ctmrg/contract_site.jl")
include("algorithms/contractions/ctmrg/network_value.jl")
include("algorithms/contractions/ctmrg/gaugefix.jl")
include("algorithms/contractions/ctmrg/characteristic_equations.jl")

include("algorithms/contractions/absorb.jl")
include("algorithms/contractions/absorb_weight.jl")
include("algorithms/contractions/transfer.jl")
include("algorithms/contractions/localoperator.jl")
include("algorithms/contractions/vumps_contractions.jl")
include("algorithms/contractions/bp_contractions.jl")
include("algorithms/contractions/bp_messages.jl")
include("algorithms/contractions/local_patch/expr_utils.jl")
Comment thread
leburgel marked this conversation as resolved.
include("algorithms/contractions/local_patch/network_expr.jl")
include("algorithms/contractions/local_patch/patch_contractions.jl")
include("algorithms/contractions/local_patch/densitymatrix/generic.jl")
include("algorithms/contractions/local_patch/densitymatrix/ctmrg.jl")
include("algorithms/contractions/local_patch/densitymatrix/bp.jl")
include("algorithms/contractions/bondenv/benv_tools.jl")
include("algorithms/contractions/bondenv/gaugefix.jl")
include("algorithms/contractions/bondenv/als_solve.jl")
Expand Down Expand Up @@ -145,9 +153,13 @@ include("algorithms/bp/beliefpropagation.jl")
include("algorithms/bp/gaugefix.jl")

include("algorithms/transfermatrix.jl")
include("algorithms/expectation_value/expectation_value.jl")
include("algorithms/expectation_value/reduced_densitymatrix.jl")
include("algorithms/expectation_value/patch_contractions.jl")
include("algorithms/expectation_value/network_value.jl")
include("algorithms/expectation_value/correlator_adapters.jl")
include("algorithms/expectation_value/correlators.jl")
include("algorithms/toolbox.jl")
include("algorithms/correlator_adapters.jl")
include("algorithms/correlators.jl")

include("algorithms/optimization/implicit_differentiation.jl")
include("algorithms/optimization/preconditioning.jl")
Expand Down
62 changes: 62 additions & 0 deletions src/algorithms/contractions/absorb.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Absorption of matrices into tensor legs
# ---------------------------------------

"""
absorb_left(
A::AbstractTensorMap{<:Any, S}, C::AbstractTensorMap{<:Any, S, 1, 1}
) where {S}

Absorb a matrix `C` into the left of a tensor map `A` by contracting the first index of `A` with the last index of `C`.
"""
function absorb_left(
A::AbstractTensorMap{<:Any, S}, C::AbstractTensorMap{<:Any, S, 1, 1}
) where {S}
pC = (codomainind(C), domainind(C))
pA = ((codomainind(A)[1],), (codomainind(A)[2:end]..., domainind(A)...))
pCA = (codomainind(A), domainind(A))
return tensorcontract(C, pC, false, A, pA, false, pCA)
end
function absorb_left(
P::AbstractTensorMap{<:Any, S, 1, N}, C::AbstractTensorMap{<:Any, S, 1, 1}
) where {S, N}
return twistnondual(C, 2) * P
end

"""
absorb_right(
A::AbstractTensorMap{<:Any, S}, C::AbstractTensorMap{<:Any, S, 1, 1}
) where {S}

Absorb a matrix `C` into the right of a tensor map `A` by contracting the first index in the domain of `A` with the first index of `C`.
In the case where `A` has only one space in its domain, this can be interpreted as contracting the last leg of `A` with the first leg of `C`.
"""
function absorb_right(
A::AbstractTensorMap{<:Any, S}, C::AbstractTensorMap{<:Any, S, 1, 1}
) where {S}
pA = ((codomainind(A)..., domainind(A)[2:end]...), (domainind(A)[1],))
pC = (codomainind(C), domainind(C))
pAC = (codomainind(A), (domainind(A)[end], domainind(A)[1:(end - 1)]...))
return tensorcontract(A, pA, false, C, pC, false, pAC)
end
function absorb_right(
E::AbstractTensorMap{<:Any, S, N, 1}, C::AbstractTensorMap{<:Any, S, 1, 1}
) where {S, N}
return E * twistdual(C, 1)
end

"""
absorb_left_right(
A::AbstractTensorMap{<:Any, S},
CL::AbstractTensorMap{<:Any, S, 1, 1},
CR::AbstractTensorMap{<:Any, S, 1, 1}
) where {S}

Absorb matrices `CL` and `CR` into the left and right of a tensor map `A` by contracting the first leg of `A` with the second leg of `CL` and the first domain index of `A` with the first leg of `CR`.
"""
function absorb_left_right(
A::AbstractTensorMap{<:Any, S},
CL::AbstractTensorMap{<:Any, S, 1, 1},
CR::AbstractTensorMap{<:Any, S, 1, 1}
) where {S}
return absorb_right(absorb_left(A, CL), CR)
end
257 changes: 0 additions & 257 deletions src/algorithms/contractions/bp_contractions.jl

This file was deleted.

Loading
Loading