Skip to content

Commit

Permalink
Renaming...
Browse files Browse the repository at this point in the history
  • Loading branch information
shinaoka committed Nov 26, 2024
1 parent 0f9bb32 commit 192b26d
Show file tree
Hide file tree
Showing 25 changed files with 386 additions and 373 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "ProjMPSs"
uuid = "3cac4759-b6c4-45be-a543-65afe6a1360a"
name = "PartitionedMPSs"
uuid = "17ce1de9-5131-45e3-8a48-9723b6e2dc23"
authors = ["Hiroshi Shinaoka <[email protected]> and contributors"]
version = "0.4.1"

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ProjMPSs
# PartitionedMPSs

[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://tensor4all.github.io/ProjMPSs.jl/dev)
[![CI](https://github.com/tensor4all/ProjMPSs.jl/actions/workflows/CI.yml/badge.svg)](https://github.com/tensor4all/ProjMPSs.jl/actions/workflows/CI.yml)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://tensor4all.github.io/PartitionedMPSs.jl/dev)
[![CI](https://github.com/tensor4all/PartitionedMPSs.jl/actions/workflows/CI.yml/badge.svg)](https://github.com/tensor4all/PartitionedMPSs.jl/actions/workflows/CI.yml)
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
ProjMPSs = "3cac4759-b6c4-45be-a543-65afe6a1360a"
PartitionedMPSs = "3cac4759-b6c4-45be-a543-65afe6a1360a"
14 changes: 8 additions & 6 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
using ProjMPSs
using PartitionedMPSs
using Documenter

DocMeta.setdocmeta!(ProjMPSs, :DocTestSetup, :(using ProjMPSs); recursive=true)
DocMeta.setdocmeta!(
PartitionedMPSs, :DocTestSetup, :(using PartitionedMPSs); recursive=true
)

makedocs(;
modules=[ProjMPSs],
modules=[PartitionedMPSs],
authors="Hiroshi Shinaoka <[email protected]> and contributors",
sitename="ProjMPSs.jl",
sitename="PartitionedMPSs.jl",
format=Documenter.HTML(;
canonical="https://github.com/tensor4all/ProjMPSs.jl",
canonical="https://github.com/tensor4all/PartitionedMPSs.jl",
edit_link="main",
assets=String[],
),
pages=["Home" => "index.md"],
)

deploydocs(; repo="github.com/tensor4all/ProjMPSs.jl.git", devbranch="main")
deploydocs(; repo="github.com/tensor4all/PartitionedMPSs.jl.git", devbranch="main")
8 changes: 4 additions & 4 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
```@meta
CurrentModule = ProjMPSs
CurrentModule = PartitionedMPSs
```

# ProjMPSs
# PartitionedMPSs

Documentation for [ProjMPSs](https://github.com/tensor4all/ProjMPSs.jl).
Documentation for [PartitionedMPSs](https://github.com/tensor4all/PartitionedMPSs.jl).

```@index
```

```@autodocs
Modules = [ProjMPSs]
Modules = [PartitionedMPSs]
```
14 changes: 7 additions & 7 deletions notebooks/bse_3d.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,18 @@
" sitesq_vec = [[z] for z in sitesq]\n",
" sites_separateq = [x for pair in zip(siteskk´_vec, sitesq_vec) for x in pair]\n",
"\n",
" full_mps = TCIA.ProjMPSContainer(Float64, full_patches, sites)\n",
" full_mps = TCIA.SubDomainMPSContainer(Float64, full_patches, sites)\n",
" full_kk´_q = Quantics.rearrange_siteinds(full_mps, sites_separateq)\n",
" full_kk´_qq´ = Quantics.makesitediagonal(full_kk´_q, \"q\")\n",
" full_ptt = TCIA.ProjTTContainer{Float64}(full_kk´_qq´)\n",
"\n",
" chi0_mps = TCIA.ProjMPSContainer(Float64, chi0_patches, sites)\n",
" chi0_mps = TCIA.SubDomainMPSContainer(Float64, chi0_patches, sites)\n",
" chi0_kk´_q = Quantics.rearrange_siteinds(chi0_mps, sites_separateq)\n",
" chi0_kk´_qq´ = Quantics.makesitediagonal(chi0_kk´_q, \"q\")\n",
" chi0_kk´_q´q´´ = prime(chi0_kk´_qq´)\n",
" chi0_ptt = TCIA.ProjTTContainer{Float64}(chi0_kk´_q´q´´)\n",
"\n",
" gamma_mps = TCIA.ProjMPSContainer(Float64, gamma_patches, sites)\n",
" gamma_mps = TCIA.SubDomainMPSContainer(Float64, gamma_patches, sites)\n",
" gamma_kk´_q = Quantics.rearrange_siteinds(gamma_mps, sites_separateq)\n",
" gamma_kk´_qq´ = Quantics.makesitediagonal(gamma_kk´_q, \"q\")\n",
" gamma_kk´_q´´q´´´ = prime(gamma_kk´_qq´, 2)\n",
Expand Down Expand Up @@ -210,10 +210,10 @@
"\n",
" chi0_gamma_ptt = TCIA.adaptivematmul(chi0_ptt, gamma_ptt, pordering; maxbonddim)\n",
" phi_bse_diagonal = TCIA.adaptivematmul(full_ptt, chi0_gamma_ptt, pordering; maxbonddim)\n",
" phi_bse_diagonal_projmps = TCIA.ProjMPSContainer(Float64, phi_bse_diagonal, diagonal_sites)\n",
" phi_bse_projmps_kk´_q = Quantics.extractdiagonal(phi_bse_diagonal_projmps, \"q\")\n",
" phi_bse_projmps_kk´q = Quantics.rearrange_siteinds(phi_bse_projmps_kk´_q, sites)\n",
" phi_bse = TCIA.ProjTTContainer{Float64}(phi_bse_projmps_kk´q)\n",
" phi_bse_diagonal_SubDomainMPS = TCIA.SubDomainMPSContainer(Float64, phi_bse_diagonal, diagonal_sites)\n",
" phi_bse_SubDomainMPS_kk´_q = Quantics.extractdiagonal(phi_bse_diagonal_SubDomainMPS, \"q\")\n",
" phi_bse_SubDomainMPS_kk´q = Quantics.rearrange_siteinds(phi_bse_SubDomainMPS_kk´_q, sites)\n",
" phi_bse = TCIA.ProjTTContainer{Float64}(phi_bse_SubDomainMPS_kk´q)\n",
"\n",
" return phi_bse\n",
"end"
Expand Down
6 changes: 3 additions & 3 deletions src/ProjMPSs.jl → src/PartitionedMPSs.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module ProjMPSs
module PartitionedMPSs

import OrderedCollections: OrderedSet, OrderedDict
using EllipsisNotation
Expand All @@ -12,8 +12,8 @@ import FastMPOContractions as FMPOC

include("util.jl")
include("projector.jl")
include("projmps.jl")
include("blockedmps.jl")
include("subdomainmps.jl")
include("partitionedmps.jl")
include("patching.jl")
include("contract.jl")
include("adaptivemul.jl")
Expand Down
28 changes: 14 additions & 14 deletions src/adaptivemul.jl
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
"""
Lazy evaluation for contraction of two ProjMPS objects.
Lazy evaluation for contraction of two SubDomainMPS objects.
"""
struct LazyContraction
a::ProjMPS
b::ProjMPS
a::SubDomainMPS
b::SubDomainMPS
projector::Projector # Projector for the external indices of (a * b)
function LazyContraction(a::ProjMPS, b::ProjMPS)
function LazyContraction(a::SubDomainMPS, b::SubDomainMPS)
shared_inds = Set{Index}()
for (a_, b_) in zip(siteinds(a), siteinds(b))
cinds = commoninds(a_, b_)
length(cinds) > 0 ||
error("The two ProjMPS must have common indices at every site.")
error("The two SubDomainMPS must have common indices at every site.")
shared_inds = shared_inds cinds
end
#@show typeof(_projector_after_contract(a, b))
return new(a, b, _projector_after_contract(a, b)[1])
end
end

function lazycontraction(a::ProjMPS, b::ProjMPS)::Union{LazyContraction,Nothing}
function lazycontraction(a::SubDomainMPS, b::SubDomainMPS)::Union{LazyContraction,Nothing}
# If any of shared indices between a and b is projected at different levels, return nothing
if a.projector & b.projector === nothing
return nothing
Expand All @@ -40,21 +40,21 @@ function project(obj::LazyContraction, prj::Projector; kwargs...)::LazyContracti
end

"""
Perform contruction of two BlockedMPS objects.
Perform contruction of two PartitionedMPS objects.
The ProjMPS objects of each BlockedMPS do not overlap with each other.
The SubDomainMPS objects of each PartitionedMPS do not overlap with each other.
This makes the algorithm much simpler
"""
function adaptivecontract(
a::BlockedMPS,
b::BlockedMPS,
a::PartitionedMPS,
b::PartitionedMPS,
pordering::AbstractVector{Index}=Index[];
alg="fit",
cutoff=1e-25,
maxdim=typemax(Int),
kwargs...,
)
patches = Dict{Projector,Vector{Union{ProjMPS,LazyContraction}}}()
patches = Dict{Projector,Vector{Union{SubDomainMPS,LazyContraction}}}()

for x in values(a), y in values(b) # FIXME: Naive loop over O(N^2) pairs
xy = lazycontraction(x, y)
Expand All @@ -69,15 +69,15 @@ function adaptivecontract(
end

# Check no overlapping projectors.
# This should be prohibited by the fact that the blocks in each ProjMPS obejct do not overlap.
# This should be prohibited by the fact that the blocks in each SubDomainMPS obejct do not overlap.
isdisjoint(collect(keys(patches))) || error("Overlapping projectors")

result_blocks = ProjMPS[]
result_blocks = SubDomainMPS[]
for (p, muls) in patches
prjmpss = [contract(m.a, m.b; alg, cutoff, maxdim, kwargs...) for m in muls]
#patches[p] = +(prjmpss...; alg="fit", cutoff, maxdim)
push!(result_blocks, +(prjmpss...; alg="fit", cutoff, maxdim))
end

return BlockedMPS(result_blocks)
return PartitionedMPS(result_blocks)
end
6 changes: 3 additions & 3 deletions src/automul.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ By default, elementwise multiplication will be performed.
This function is kind of deprecated and will be removed in the future.
"""
function automul(
M1::BlockedMPS,
M2::BlockedMPS;
M1::PartitionedMPS,
M2::PartitionedMPS;
tag_row::String="",
tag_shared::String="",
tag_col::String="",
Expand Down Expand Up @@ -89,7 +89,7 @@ function combinesites(
return sites
end

function _findallsiteinds_by_tag(M::BlockedMPS; tag=tag)
function _findallsiteinds_by_tag(M::PartitionedMPS; tag=tag)
return findallsiteinds_by_tag(only.(siteinds(M)); tag=tag)
end

Expand Down
12 changes: 6 additions & 6 deletions src/bak/conversion.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Conversion from a `TCIAlgorithms.ProjTensorTrain` to a `ProjMPS`.
Conversion from a `TCIAlgorithms.ProjTensorTrain` to a `SubDomainMPS`.
"""
function ProjMPS(projtt::TCIA.ProjTensorTrain{T}, sites)::ProjMPS where {T}
function SubDomainMPS(projtt::TCIA.ProjTensorTrain{T}, sites)::SubDomainMPS where {T}
links = [Index(ld, "Link,l=$l") for (l, ld) in enumerate(TCI.linkdims(projtt.data))]

tensors = ITensor[]
Expand Down Expand Up @@ -47,12 +47,12 @@ function ProjMPS(projtt::TCIA.ProjTensorTrain{T}, sites)::ProjMPS where {T}
end
end

return ProjMPS(MPS(tensors), Projector(proj))
return SubDomainMPS(MPS(tensors), Projector(proj))
end

"""
Conversion from a `TCIAlgorithms.Proj` to a `BlockedMPS`.
Conversion from a `TCIAlgorithms.Proj` to a `PartitionedMPS`.
"""
function BlockedMPS(obj::TCIA.ProjTTContainer{T}, sites)::BlockedMPS where {T}
return BlockedMPS([ProjMPS(x, sites) for x in obj.data])
function PartitionedMPS(obj::TCIA.ProjTTContainer{T}, sites)::PartitionedMPS where {T}
return PartitionedMPS([SubDomainMPS(x, sites) for x in obj.data])
end
Loading

0 comments on commit 192b26d

Please sign in to comment.