ITensor / ITensorParallel.jl

Parallel tools for ITensors.jl.
MIT License
21 stars 3 forks source link

Add new chain splitting OpSum partition backend #18

Closed mtfishman closed 1 year ago

mtfishman commented 1 year ago

This changes the interface for partition a bit. The default is now:

partition(opsum, npartitions; in_partition_alg="sum_split")

where a new in_partition backend can be defined with:

function ITensorParallel.in_partition(::Algorithm"custom_in_partition", sites, p, nparts)
  # Return `true` if the term with `sites` is in the partition `p`
end

Alternatively, a function can be passed as:

function custom_in_partition(sites, p, nparts)
  # Return `true` if the term with `sites` is in the partition `p`
end

partition(opsum, npartitions; in_partition=custom_in_partition)

This PR introduces a new algorithm for splitting a Hamiltonian into chains suggested by Steve White:

partition(opsum; alg="chain_split")

New more general backends like this can be defined with:

ITensorParallel.partition(::Algorithm"new_split", opsum::OpSum) = # implementation of splitting
codecov-commenter commented 1 year ago

Codecov Report

Merging #18 (a77aa0c) into main (d235ae8) will increase coverage by 9.03%. The diff coverage is 96.66%.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##             main      #18      +/-   ##
==========================================
+ Coverage   57.63%   66.66%   +9.03%     
==========================================
  Files           6        9       +3     
  Lines         203      267      +64     
==========================================
+ Hits          117      178      +61     
- Misses         86       89       +3     
Impacted Files Coverage Δ
src/ITensorParallel.jl 100.00% <ø> (ø)
src/partition/partition.jl 95.00% <95.00%> (ø)
src/partition/partition_chain_split.jl 96.61% <96.61%> (ø)
src/partition/partition_sum_split.jl 100.00% <100.00%> (ø)