Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
fd836c4
FusionTreePair
lkdvos Jul 30, 2025
03c3c3b
implement "vectorized" fusiontree manipulations
lkdvos Jul 31, 2025
9c34aab
Refactor treetransformer to make use of vectorized implementation
lkdvos Jul 31, 2025
1f1f734
fix arg order `braid`
lkdvos Jul 31, 2025
7de3afb
refactor in terms of FusionTreeBlock
lkdvos Jul 31, 2025
baf1255
Fix unbound type parameter
lkdvos Jul 31, 2025
4e7c9e3
refactor repartition to unroll loop
lkdvos Jul 31, 2025
c808d4b
dont depend on intricate scoping rules
lkdvos Aug 13, 2025
5704733
Refactor bendright to avoid extra dictionary
lkdvos Aug 13, 2025
3dc1a47
Refactor bendleft to avoid extra dictionaries
lkdvos Aug 13, 2025
f8eb207
Refactor foldright to avoid extra dictionaries
lkdvos Aug 13, 2025
8c129a4
Refactor foldleft to avoid extra dictionaries
lkdvos Aug 13, 2025
8b2a15d
remove unused variable
lkdvos Aug 13, 2025
9311fb0
some docs fixes
lkdvos Aug 14, 2025
ecbdaa6
Avoid using `one(I)`
lkdvos Aug 14, 2025
0c05153
format
lkdvos Aug 14, 2025
4470e2f
Move independent computations out of loop
lkdvos Aug 15, 2025
731a832
add utility fusiontreetype
lkdvos Aug 15, 2025
fff2d5a
add multithreaded treetransformer implementation
lkdvos Aug 15, 2025
54b7abc
refactor treeindex_map
lkdvos Aug 15, 2025
fe3cfd4
Refactor artin_braid to avoid extra dicts
lkdvos Aug 16, 2025
9247e38
type stability improvements
lkdvos Aug 16, 2025
ed9e260
fix multithreaded implementation
lkdvos Aug 17, 2025
d672fd0
speed up hashing by hashing less things
lkdvos Aug 17, 2025
f27547e
Slight refactor of artin_braid
lkdvos Aug 17, 2025
aae6602
reduce allocations with sizehints
lkdvos Aug 17, 2025
edde8f9
separate treemanipulation threads
lkdvos Aug 17, 2025
4764f72
formatter
lkdvos Aug 17, 2025
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
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
TensorKit = "07d1fe3e-3e46-537d-9eac-e9e13d0d4cec"
TensorKitSectors = "13a9c161-d5da-41f0-bcbd-e1a08ae0647f"

[compat]
Expand Down
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Documenter
using Random
using TensorKit, TensorKitSectors
using TensorKit: FusionTreePair, Index2Tuple

pages = ["Home" => "index.md",
"Manual" => ["man/intro.md", "man/tutorial.md", "man/categories.md",
Expand Down
10 changes: 5 additions & 5 deletions docs/src/lib/sectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ insertat
split
merge
elementary_trace
planar_trace(f::FusionTree{I,N}, q1::IndexTuple{N₃}, q2::IndexTuple{N₃}) where {I<:Sector,N,N₃}
planar_trace(f::FusionTree{I,N}, q::Index2Tuple{N₃,N₃}) where {I<:Sector,N,N₃}
artin_braid
braid(f::FusionTree{I,N}, levels::NTuple{N,Int}, p::NTuple{N,Int}) where {I<:Sector,N}
permute(f::FusionTree{I,N}, p::NTuple{N,Int}) where {I<:Sector,N}
Expand All @@ -113,8 +113,8 @@ Finally, these are used to define large manipulations of fusion-splitting tree p
are then used in the index manipulation of `AbstractTensorMap` objects. The following methods
defined on fusion splitting tree pairs have an associated definition for tensors.
```@docs
repartition(::FusionTree{I,N₁}, ::FusionTree{I,N₂}, ::Int) where {I<:Sector,N₁,N₂}
transpose(::FusionTree{I}, ::FusionTree{I}, ::IndexTuple{N₁}, ::IndexTuple{N₂}) where {I<:Sector,N₁,N₂}
braid(::FusionTree{I}, ::FusionTree{I}, ::IndexTuple, ::IndexTuple, ::IndexTuple{N₁}, ::IndexTuple{N₂}) where {I<:Sector,N₁,N₂}
permute(::FusionTree{I}, ::FusionTree{I}, ::IndexTuple{N₁}, ::IndexTuple{N₂}) where {I<:Sector,N₁,N₂}
repartition(::FusionTreePair, ::Int)
transpose(::FusionTreePair{I}, ::Index2Tuple{N₁,N₂}) where {I,N₁,N₂}
braid(::FusionTreePair, ::Index2Tuple, ::Index2Tuple)
permute(::FusionTreePair, ::Index2Tuple)
```
6 changes: 3 additions & 3 deletions docs/src/man/sectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@ the splitting tree.

The `FusionTree` interface to duality and line bending is given by

[`repartition(f1::FusionTree{I,N₁}, f2::FusionTree{I,N₂}, N::Int)`](@ref repartition)
[`repartition(f1::FusionTreePair{I,N₁,N₂}, N::Int)`](@ref repartition)

which takes a splitting tree `f1` with `N₁` outgoing sectors, a fusion tree `f2` with `N₂`
incoming sectors, and applies line bending such that the resulting splitting and fusion
Expand All @@ -1180,7 +1180,7 @@ With this basic function, we can now perform arbitrary combinations of braids or
permutations with line bendings, to completely reshuffle where sectors appear. The
interface provided for this is given by

[`braid(f1::FusionTree{I,N₁}, f2::FusionTree{I,N₂}, levels1::NTuple{N₁,Int}, levels2::NTuple{N₂,Int}, p1::NTuple{N₁′,Int}, p2::NTuple{N₂′,Int})`](@ref braid(::FusionTree{I}, ::FusionTree{I}, ::IndexTuple, ::IndexTuple, ::IndexTuple{N₁}, ::IndexTuple{N₂}) where {I<:Sector,N₁,N₂})
[`braid((f₁, f₂)::FusionTreePair, (p1, p2)::Index2Tuple, (levels1, levels2)::Index2Tuple)`](@ref braid(::TensorKit.FusionTreePair, ::Index2Tuple, ::Index2Tuple))

where we now have splitting tree `f1` with `N₁` outgoing sectors, a fusion tree `f2` with
`N₂` incoming sectors, `levels1` and `levels2` assign a level or depth to the corresponding
Expand All @@ -1206,7 +1206,7 @@ As before, there is a simplified interface for the case where
`BraidingStyle(I) isa SymmetricBraiding` and the levels are not needed. This is simply
given by

[`permute(f1::FusionTree{I,N₁}, f2::FusionTree{I,N₂}, p1::NTuple{N₁′,Int}, p2::NTuple{N₂′,Int})`](@ref permute(::FusionTree{I}, ::FusionTree{I}, ::IndexTuple{N₁}, ::IndexTuple{N₂}) where {I<:Sector,N₁,N₂})
[`permute((f₁, f₂)::FusionTreePair, (p1, p2)::Index2Tuple)`](@ref permute(::FusionTreePair, ::Index2Tuple))

The `braid` and `permute` routines for double fusion trees will be the main access point for
corresponding manipulations on tensors. As a consequence, results from this routine are
Expand Down
13 changes: 13 additions & 0 deletions src/TensorKit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,19 @@ function set_num_transformer_threads(n::Int)
return TRANSFORMER_THREADS[] = n
end

const TREEMANIPULATION_THREADS = Ref(1)

get_num_manipulation_threads() = TREEMANIPULATION_THREADS[]

function set_num_manipulation_threads(n::Int)
N = Base.Threads.nthreads()
if n > N
n = N
Strided._set_num_threads_warn(n)
end
return TREEMANIPULATION_THREADS[] = n
end

# Definitions and methods for tensors
#-------------------------------------
# general definitions
Expand Down
Loading
Loading