From e5142d25aa0da4ed18ad178f4fdc82f2f085acb2 Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Tue, 26 Dec 2023 22:05:24 +0000 Subject: [PATCH] build based on 63d9179 --- dev/.documenter-siteinfo.json | 2 +- dev/base/couplingmodel/index.html | 6 +++--- dev/base/fermions/index.html | 2 +- dev/base/global/index.html | 4 ++-- dev/base/graph/index.html | 14 +++++++------- dev/base/misc/index.html | 6 +++--- dev/base/opstrings/index.html | 8 ++++---- dev/base/solver/index.html | 2 +- dev/index.html | 2 +- dev/mps/dmrg/index.html | 8 ++++---- dev/mps/example_dmrg/index.html | 2 +- dev/mps/example_tdvp/index.html | 2 +- dev/mps/measure/index.html | 4 ++-- dev/mps/state_envs/index.html | 8 ++++---- dev/mps/sweep/index.html | 6 +++--- dev/mps/tdvp/index.html | 10 +++++----- dev/mps/update_site/index.html | 2 +- dev/ttn/example_optimize/index.html | 2 +- dev/ttn/measure_ttn/index.html | 4 ++-- dev/ttn/optimize_ttn/index.html | 8 ++++---- dev/ttn/state_envs_ttn/index.html | 4 ++-- dev/ttn/sweep_ttn/index.html | 4 ++-- dev/ttn/ttn/index.html | 4 ++-- dev/ttn/ttn_gen/index.html | 6 +++--- dev/ttn/ttn_struct/index.html | 6 +++--- dev/ttn/update_site_ttn/index.html | 4 ++-- 26 files changed, 65 insertions(+), 65 deletions(-) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index fff330b..1e7bd3a 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.9.4","generation_timestamp":"2023-12-26T22:02:55","documenter_version":"1.2.1"}} \ No newline at end of file +{"documenter":{"julia_version":"1.9.4","generation_timestamp":"2023-12-26T22:05:20","documenter_version":"1.2.1"}} \ No newline at end of file diff --git a/dev/base/couplingmodel/index.html b/dev/base/couplingmodel/index.html index f0488a9..c3efb44 100644 --- a/dev/base/couplingmodel/index.html +++ b/dev/base/couplingmodel/index.html @@ -2,7 +2,7 @@ CouplingModel · TeNLib.jl

CouplingModel

TeNLib.jl degines as struct, called the CouplingModel, to store the Hamiltonian terms. In case of MPS based algorithms, CouplingModel can replace MPO without modifying rest of the code. For Tree Tensor Network (TTN) codes, only CouplingModel can be used. Different elements of CouplingModel are contracted in parallel.

TeNLib.CouplingModelType
struct CouplingModel{T}
     sites::Vector{Index{T}}
     terms::Vector{IDTensors}
-end

CouplingModel for a given OpStrings Hamiltonian terms and sites::Vector{Index}.

  • sites::Vector{Index{T}}: Site Indexs.
  • terms::Vector{IDTensors}: Collection of Hamiltonian terms.
source
TeNLib.CouplingModelMethod
function CouplingModel(os::OpStrings{T1},
+end

CouplingModel for a given OpStrings Hamiltonian terms and sites::Vector{Index}.

  • sites::Vector{Index{T}}: Site Indexs.
  • terms::Vector{IDTensors}: Collection of Hamiltonian terms.
source
TeNLib.CouplingModelMethod
function CouplingModel(os::OpStrings{T1},
                        sites::Vector{Index{T2}};
                        merge::Bool = true,
                        maxdim::Int = typemax(Int),
@@ -15,11 +15,11 @@
     os += 0.5, "S+" => j, "S-" => j+1
     os += 0.5, "S-" => j, "S+" => j+1
 end    
-H = CouplingModel(os,sites)
source
TeNLib.CouplingModelMethod
function CouplingModel(os::OpStrings{T1},
                        mpo::MPO;
                        merge::Bool = true,
                        maxdim::Int = typemax(Int),
                        mindim::Int = 1,
                        cutoff::Float64 = Float64_threashold(),
                        svd_alg::String = "divide_and_conquer",
-                       chunksize::Int = 12) where {T1 <: Number}

Constructor of the CouplingModel from os::OpStrings and mpo::MPO. Resultant CouplingModel is the sum of os and the mpo.

Named arguments and their default values:

  • merge::Bool = true. If true, merges all the terms having same spatial support resulting in larger virtual dimension. Otherwise, all the terms have virtual dimension one.
  • maxdim::Int = typemax(Int): Maximum bond dimension after SVD truncation.
  • mindim::Int = 1: Minimum bond dimension after SVD truncation.
  • cutoff::Float64 = Float64_Threshold(): Cutoff for SVD truncation.
  • svd_alg::String = "divide_and_conquer".
  • chunksize::Int = 12.
source
TeNLib.CouplingModelMethod
function CouplingModel(mpos::MPO...)

Constructs CouplingModel from a collection of MPOs. Different MPO terms are contracted in parallel. Useful for TTN codes.

source
Base.lengthMethod
function Base.length(model::CouplingModel)

Number of sites in the system.

source
Base.copyMethod
function Base.copy(model::CouplingModel)

Shallow copy of CouplingModel.

source
Base.getindexMethod
function Base.getindex(model::CouplingModel, n)

Returns Hamiltonian terms for nth site(s) in the CouplingModel.

source
ITensors.siteindsMethod
function ITensors.siteinds(model::CouplingModel)

Returns the site Indexs of the CouplingModel.

source
+ chunksize::Int = 12) where {T1 <: Number}

Constructor of the CouplingModel from os::OpStrings and mpo::MPO. Resultant CouplingModel is the sum of os and the mpo.

Named arguments and their default values:

source
TeNLib.CouplingModelMethod
function CouplingModel(mpos::MPO...)

Constructs CouplingModel from a collection of MPOs. Different MPO terms are contracted in parallel. Useful for TTN codes.

source
Base.lengthMethod
function Base.length(model::CouplingModel)

Number of sites in the system.

source
Base.copyMethod
function Base.copy(model::CouplingModel)

Shallow copy of CouplingModel.

source
Base.getindexMethod
function Base.getindex(model::CouplingModel, n)

Returns Hamiltonian terms for nth site(s) in the CouplingModel.

source
ITensors.siteindsMethod
function ITensors.siteinds(model::CouplingModel)

Returns the site Indexs of the CouplingModel.

source
diff --git a/dev/base/fermions/index.html b/dev/base/fermions/index.html index 54c0ca1..5a40316 100644 --- a/dev/base/fermions/index.html +++ b/dev/base/fermions/index.html @@ -1,3 +1,3 @@ Dealing with Fermions · TeNLib.jl

Dealing with Fermions

TeNLib.jl uses the following function to teat fermionic operators.

TeNLib.bosonizeMethod
function bosonize(oppair::Vector{Pair{String, Int}},
-                  sites::Vector{Index{T}}) where T

Given a string of operator names with positions in the form of Vector{Pair{String, Int}} "bosonizes" the operator string by putting the Jordan-Wigner string "F" at appropriate places.

Arguments

  • oppair::Vector{Pair{String, Int}}: Input string of operator names with positions.
  • sites::Vector{Index}: The entire site Indexs as per ITensors' convention.

Return values

  • ::Int: Even (+1) or odd (-1) permutation.
  • ::Vector{Pair{String, Int}}: modified string of operator names and positions.
source
+ sites::Vector{Index{T}}) where T

Given a string of operator names with positions in the form of Vector{Pair{String, Int}} "bosonizes" the operator string by putting the Jordan-Wigner string "F" at appropriate places.

Arguments

Return values

source diff --git a/dev/base/global/index.html b/dev/base/global/index.html index 5db8a5b..01e77df 100644 --- a/dev/base/global/index.html +++ b/dev/base/global/index.html @@ -1,5 +1,5 @@ Controlling global behaviors · TeNLib.jl

Controlling global behaviors

TeNLib.jl provides following functions to control global behaviors for Tensor Network simulations.

TeNLib.Float64_thresholdFunction
function Float64_threshold()
-function Float64_threshold(threshold::Float)

Returns threshold for floating point calculations. In most places, any number below this will be treated zero. E.g., in cutoff. Default: 1e-15.

Optionally, change the threshold as per the input threshold.

source
TeNLib.@threaded_loopMacro
macro threaded_loop(code)

Conditional threaded loop by Threads.@threads. If using_threaded_loop() returns true, performs parallel loop, otherwise performs serial loop.

Note: All other forms of parallelization are switched off inside the loop body, if parallel loop is being executed.

Example:

@threaded_loop for i = 1 : N
+function Float64_threshold(threshold::Float)

Returns threshold for floating point calculations. In most places, any number below this will be treated zero. E.g., in cutoff. Default: 1e-15.

Optionally, change the threshold as per the input threshold.

source
TeNLib.@threaded_loopMacro
macro threaded_loop(code)

Conditional threaded loop by Threads.@threads. If using_threaded_loop() returns true, performs parallel loop, otherwise performs serial loop.

Note: All other forms of parallelization are switched off inside the loop body, if parallel loop is being executed.

Example:

@threaded_loop for i = 1 : N
     # Do stuff in parallel
-end
source
+endsource diff --git a/dev/base/graph/index.html b/dev/base/graph/index.html index 6c8f60b..34f3206 100644 --- a/dev/base/graph/index.html +++ b/dev/base/graph/index.html @@ -2,17 +2,17 @@ The Graph object · TeNLib.jl

The Graph object

TeNLib.jl defines its own undirected graph object, the Graph. Currently only used for the Tree Tensor Network (TTN) codes.

TeNLib.GraphType
mutable struct Graph{T}
     nodes::Set{T}
     edges::Dict{T, Set{T}}
-end

Undirected graph where nodes are of type T.

  • nodes::Set{T}: Holds the nodes of the graph.
  • edges::Dict{T, Set{T}}: Holds the edges of the graph. For a given node as key, holds all the connected nodes as value of the Dict.
source
TeNLib.GraphMethod
function Graph{T}(nodes::Set{T}) where T
-function Graph{T}(nodes::Vector{T}) where T

Constructor of Graph with a list of nodes and empty edges.

  • nodes: Intial nodes.
source
TeNLib.getnodesMethod
function getnodes(graph::Graph{T}) where T = copy(graph.nodes)

Returns (shallow copy of) nodes in the Graph.

source
TeNLib.hasnodeMethod
function hasnode(graph::Graph{T}, node::T) where T

Checks whether a node is in the Graph.

source
TeNLib.addnode!Method
function addnode!(graph::Graph{T}, node::T) where T

Adds a node to the Graph.

source
TeNLib.addedge!Method
function addedge!(graph::Graph{T}, node1::T, node2::T) where T

Adds an edge between node1 and node2. If node1 or node2 are not present in the Graph, they are added.

source
TeNLib.isneighborMethod
function isneighbor(graph::Graph{T}, node1::T, node2::T)::Bool where T

Checks whether node1 and node2 are connected by an edge.

source
TeNLib.bfsMethod
function bfs(graph::Graph{T},
+end

Undirected graph where nodes are of type T.

  • nodes::Set{T}: Holds the nodes of the graph.
  • edges::Dict{T, Set{T}}: Holds the edges of the graph. For a given node as key, holds all the connected nodes as value of the Dict.
source
TeNLib.GraphMethod
function Graph{T}(nodes::Set{T}) where T
+function Graph{T}(nodes::Vector{T}) where T

Constructor of Graph with a list of nodes and empty edges.

  • nodes: Intial nodes.
source
TeNLib.getnodesMethod
function getnodes(graph::Graph{T}) where T = copy(graph.nodes)

Returns (shallow copy of) nodes in the Graph.

source
TeNLib.hasnodeMethod
function hasnode(graph::Graph{T}, node::T) where T

Checks whether a node is in the Graph.

source
TeNLib.addnode!Method
function addnode!(graph::Graph{T}, node::T) where T

Adds a node to the Graph.

source
TeNLib.addedge!Method
function addedge!(graph::Graph{T}, node1::T, node2::T) where T

Adds an edge between node1 and node2. If node1 or node2 are not present in the Graph, they are added.

source
TeNLib.isneighborMethod
function isneighbor(graph::Graph{T}, node1::T, node2::T)::Bool where T

Checks whether node1 and node2 are connected by an edge.

source
TeNLib.bfsMethod
function bfs(graph::Graph{T},
              source::T,
-             destination::Union{Nothing, T} = nothing) where T

Performs a full BFS starting from the node source (and optionally, to the destination).

Return values

  • ::Dict{T, Int}: Distances of nodes (key) in the BFS path.
  • ::Dict{T, T}: Parents of nodes (key) in the BFS path.
source
TeNLib.nodes_from_bfsMethod
function nodes_from_bfs(graph::Graph{T}, source::T;
+             destination::Union{Nothing, T} = nothing) where T

Performs a full BFS starting from the node source (and optionally, to the destination).

Return values

  • ::Dict{T, Int}: Distances of nodes (key) in the BFS path.
  • ::Dict{T, T}: Parents of nodes (key) in the BFS path.
source
TeNLib.nodes_from_bfsMethod
function nodes_from_bfs(graph::Graph{T}, source::T;
                         reverse::Bool = false) where T
 
 function nodes_from_bfs(graph::Graph{T}, source::T,
                         destinations::Union{Set{T}, Vector{T}};
-                        reverse::Bool = false) where T

Returns the Vector of nodes in the BFS path from the source (optionally, towards the destinations). If reverse=true returns the reverse order of nodes.

source
TeNLib.shortest_pathMethod
function shortest_path(graph::Graph{T}, source::T, destination::T) where T

Returns the shortest path between source and destination in a Graph.

source
TeNLib.nextnode_in_pathMethod
function nextnode_in_path(graph::Graph{T}, source::T, destination::T, n=1) where T

Returns the next node in the shortest path between source and destination in a Graph. Optionally, finds nth next-node in the path.

source
TeNLib.has_cycleMethod
function has_cycle(graph::Graph{T}) where T

Checks whether a Graph has cycles/loops in it.

source
TeNLib.find_sum_central_nodeMethod
function find_sum_central_node(graph::Graph{T}) where T
+                        reverse::Bool = false) where T

Returns the Vector of nodes in the BFS path from the source (optionally, towards the destinations). If reverse=true returns the reverse order of nodes.

source
TeNLib.shortest_pathMethod
function shortest_path(graph::Graph{T}, source::T, destination::T) where T

Returns the shortest path between source and destination in a Graph.

source
TeNLib.nextnode_in_pathMethod
function nextnode_in_path(graph::Graph{T}, source::T, destination::T, n=1) where T

Returns the next node in the shortest path between source and destination in a Graph. Optionally, finds nth next-node in the path.

source
TeNLib.has_cycleMethod
function has_cycle(graph::Graph{T}) where T

Checks whether a Graph has cycles/loops in it.

source
TeNLib.find_sum_central_nodeMethod
function find_sum_central_node(graph::Graph{T}) where T
 function find_sum_central_node(graph::Graph{T}, nodes::Set{T}) where T
-function find_sum_central_node(graph::Graph{T}, nodes::Vector{T}) where T

Finds the sum central node node of a Graph. Optionally, when nodes is specified, finds the central node with respect to the nodes.

source
TeNLib.find_eccentric_central_nodeMethod
function find_eccentric_central_node(graph::Graph{T}) where T
+function find_sum_central_node(graph::Graph{T}, nodes::Vector{T}) where T

Finds the sum central node node of a Graph. Optionally, when nodes is specified, finds the central node with respect to the nodes.

source
TeNLib.find_eccentric_central_nodeMethod
function find_eccentric_central_node(graph::Graph{T}) where T
 function find_eccentric_central_node(graph::Graph{T}, nodes::Set{T}) where T
-function find_eccentric_central_node(graph::Graph{T}, nodes::Vector{T}) where T

Finds the eccentric central node of a Graph. Optionally, when nodes is specified, finds the central node with respect to the nodes.

source
Base.copyMethod
function Base.copy(graph::Graph{T}) where T

Shallow copy of Graph.

source
Base.getindexMethod
function Base.getindex(graph::Graph{T}, node::T) where T

Returns the edges for a given node::T as an index.

source
Base.setindex!Method
function Base.setindex!(graph::Graph{T}, neighbors::Set{T}, node::T) where T
-function Base.setindex!(graph::Graph{T}, neighbors::Vector{T}, node::T) where T

Sets the edges=neighbors for a given node::T as an index.

source
Base.:==Method
function Base.:(==)(graph1::Graph{T}, graph2::Graph{T}) where T

Equality between two Graph objects.

source
+function find_eccentric_central_node(graph::Graph{T}, nodes::Vector{T}) where T

Finds the eccentric central node of a Graph. Optionally, when nodes is specified, finds the central node with respect to the nodes.

source
Base.copyMethod
function Base.copy(graph::Graph{T}) where T

Shallow copy of Graph.

source
Base.getindexMethod
function Base.getindex(graph::Graph{T}, node::T) where T

Returns the edges for a given node::T as an index.

source
Base.setindex!Method
function Base.setindex!(graph::Graph{T}, neighbors::Set{T}, node::T) where T
+function Base.setindex!(graph::Graph{T}, neighbors::Vector{T}, node::T) where T

Sets the edges=neighbors for a given node::T as an index.

source
Base.:==Method
function Base.:(==)(graph1::Graph{T}, graph2::Graph{T}) where T

Equality between two Graph objects.

source
diff --git a/dev/base/misc/index.html b/dev/base/misc/index.html index 095c73f..826f8df 100644 --- a/dev/base/misc/index.html +++ b/dev/base/misc/index.html @@ -1,8 +1,8 @@ -Miscellaneous typedefs and functions · TeNLib.jl

Miscellaneous typedefs and functions

TeNLib.IDTypeType
const IDType = ITensors.IDType

Type of randomly generated id. It is usually UInt64.

source
TeNLib.IDTensorsType
const IDTensors = Dict{IDType, ITensor}

Dictionary of key = randomly generated id and value = ITensor objects.

source
TeNLib.combineindsMethod
function combineinds(inds::Vector{Index};
+Miscellaneous typedefs and functions · TeNLib.jl

Miscellaneous typedefs and functions

TeNLib.IDTypeType
const IDType = ITensors.IDType

Type of randomly generated id. It is usually UInt64.

source
TeNLib.IDTensorsType
const IDTensors = Dict{IDType, ITensor}

Dictionary of key = randomly generated id and value = ITensor objects.

source
TeNLib.combineindsMethod
function combineinds(inds::Vector{Index};
                      maxdim::Union{Nothing, Int} = nothing, 
                      maxqnblocks::Union{Nothing, Int} = nothing,
-                     kwargs...)

Combine a vector of Index into one (like ITensors.jl's combiner). maxdim is be the maximum dimension of the output Index, maxqnblocks represents maximum number of QN blocks to retain in the output Index.

source
TeNLib.indexintersectionMethod
function indexintersection(inds1::Vector{Index}, inds2::Vector{Index};
+                     kwargs...)

Combine a vector of Index into one (like ITensors.jl's combiner). maxdim is be the maximum dimension of the output Index, maxqnblocks represents maximum number of QN blocks to retain in the output Index.

source
TeNLib.indexintersectionMethod
function indexintersection(inds1::Vector{Index}, inds2::Vector{Index};
                            maxdim::Union{Nothing, Int} = nothing,
                            maxqnblocks::Union{Nothing, Int} = nothing,
-                           kwargs...)

Performs set intersection of two vectors of Index. maxdim is be the maximum dimension of the output Index, maxqnblocks represents maximum number of QN blocks to retain in the output Index.

source
+ kwargs...)

Performs set intersection of two vectors of Index. maxdim is be the maximum dimension of the output Index, maxqnblocks represents maximum number of QN blocks to retain in the output Index.

source
diff --git a/dev/base/opstrings/index.html b/dev/base/opstrings/index.html index d36cdbf..dbcf5d7 100644 --- a/dev/base/opstrings/index.html +++ b/dev/base/opstrings/index.html @@ -2,18 +2,18 @@ OpStrings · TeNLib.jl

OpStrings

TeNLib.jl provides an alternative, called OpStrings, to ITensors.jl's OpSum to automatically construct Hamiltonains / operators. TeNLib.jl's own CouplingModel is built from OpStrings and is not compatible with OpSum.

OpString

OpStrings is basically a vector of OpString objects (notice the difference in 's' at the end)

TeNLib.OpStringType
struct OpString{T <: Number}
     coeff::T
     ops::Vector{Pair{String, Int}}
-end

Holds operator strings (operator names with corresponding positions) along with the coefficient.

  • coeff::T: Coeffcient of the operator string.
  • ops::Vector{Pair{String, Int}}: String of operator names along with the positions.
source
TeNLib.operatorsMethod
function operators(opstr::OpString)

Returns the operator string of the OpString.

source
TeNLib.minsiteMethod
function minsite(opstr::OpString)

Returns the lowest site position in the operator string of the OpString.

source
TeNLib.maxsiteMethod
function maxsite(opstr::OpString)

Returns the highest site position in the operator string of the OpString.

source
TeNLib.removeIdsMethod
function removeIds(opstr::OpString{T}) where {T <: Number}

Returns an OpString with all "Id" operators removed from the original.

source
TeNLib.bosonizeMethod
function bosonize(opstr::OpString{T1},
-                  sites::Vector{Index{T2}}) where {T1 <: Number, T2}

Returns an OpString after "bosonizing" the original with Jordan-Wigner strings as needed. See bosonize.

source

OpStrings

TeNLib.OpStringsType
const OpStrings{T} = Vector{OpString{T}}

Collection of OpStrings.

Syntax:

os = OpStrings()
+end

Holds operator strings (operator names with corresponding positions) along with the coefficient.

  • coeff::T: Coeffcient of the operator string.
  • ops::Vector{Pair{String, Int}}: String of operator names along with the positions.
source
TeNLib.operatorsMethod
function operators(opstr::OpString)

Returns the operator string of the OpString.

source
TeNLib.minsiteMethod
function minsite(opstr::OpString)

Returns the lowest site position in the operator string of the OpString.

source
TeNLib.maxsiteMethod
function maxsite(opstr::OpString)

Returns the highest site position in the operator string of the OpString.

source
TeNLib.removeIdsMethod
function removeIds(opstr::OpString{T}) where {T <: Number}

Returns an OpString with all "Id" operators removed from the original.

source
TeNLib.bosonizeMethod
function bosonize(opstr::OpString{T1},
+                  sites::Vector{Index{T2}}) where {T1 <: Number, T2}

Returns an OpString after "bosonizing" the original with Jordan-Wigner strings as needed. See bosonize.

source

OpStrings

TeNLib.OpStringsType
const OpStrings{T} = Vector{OpString{T}}

Collection of OpStrings.

Syntax:

os = OpStrings()
 os += 1, "Sx" => i, "Sx" => j, "Sx" => k, ....
 os += "Sx" => i, "Sx" => j, "Sx" => k, ....

Example:

os = OpStrings()    
 for j=1:N-1
     os += 1, "Sz" => j, "Sz" => j+1
     os += 0.5, "S+" => j, "S-" => j+1
     os += 0.5, "S-" => j, "S+" => j+1
-end
source
TeNLib.removeIdsZerosMethod
function removeIdsZeros(os::OpStrings{T}) where {T <: Number}

Returns an OpStrings with all "Id" operators removed from the original, as well as any OpString term that has coeff less than Float64_threshold().

source
TeNLib.bosonizeMethod
function bosonize(os::OpStrings{T1}, sites::Vector{Index{T2}}) where {T1 <: Number, T2}

Returns an OpStrings after "bosonizing" the original with Jordan-Wigner strings as needed. See bosonize.

source
TeNLib.mergetermsMethod
function mergeterms(os::OpStrings{T}) where T <: Number

Returns an OpStrings where OpString elements with exactly same operator strings has been merged by adding the coefficients.

source

MPO from OpStrings

TeNLib.removeIdsZerosMethod
function removeIdsZeros(os::OpStrings{T}) where {T <: Number}

Returns an OpStrings with all "Id" operators removed from the original, as well as any OpString term that has coeff less than Float64_threshold().

source
TeNLib.bosonizeMethod
function bosonize(os::OpStrings{T1}, sites::Vector{Index{T2}}) where {T1 <: Number, T2}

Returns an OpStrings after "bosonizing" the original with Jordan-Wigner strings as needed. See bosonize.

source
TeNLib.mergetermsMethod
function mergeterms(os::OpStrings{T}) where T <: Number

Returns an OpStrings where OpString elements with exactly same operator strings has been merged by adding the coefficients.

source

MPO from OpStrings

ITensors.MPOMethod
function ITensors.MPO(os::OpStrings{T1},
                       sites::Vector{Index{T2}};
                       maxdim::Int = typemax(Int),
                       mindim::Int = 1,
                       cutoff::Float64 = Float64_threashold(),
                       svd_alg::String = "divide_and_conquer",
-                      chunksize::Int = 12) where {T1 <: Number, T2}

Creates MPO from os::OpStrings. The present version uses recursive SVDs to create the MPO. Very inefficient when number of Hamiltonian terms is large. Future updates will solve the problem.

Named arguments and their default values:

  • maxdim::Int = typemax(Int): Maximum MPO bond dimension after SVD truncation.
  • mindim::Int = 1: Minimum MPO bond dimension after SVD truncation.
  • cutoff::Float64 = Float64_threshold(): Cutoff for SVD truncation.
  • svd_alg::String = "divide_and_conquer".
  • chunksize::Int = 12. Maximum size of the chunks on which recursive SVDs are performed.
source
+ chunksize::Int = 12) where {T1 <: Number, T2}

Creates MPO from os::OpStrings. The present version uses recursive SVDs to create the MPO. Very inefficient when number of Hamiltonian terms is large. Future updates will solve the problem.

Named arguments and their default values:

source diff --git a/dev/base/solver/index.html b/dev/base/solver/index.html index fa001f7..35ae7e1 100644 --- a/dev/base/solver/index.html +++ b/dev/base/solver/index.html @@ -1,2 +1,2 @@ -Solvers · TeNLib.jl

Solvers

Functions to perform local updates. These functions use Krylovkit.jl.

TeNLib.eig_solverFunction
function eig_solver(env, phi0::ITensor, time_step::Nothing; kwargs...)

Solver to find smallest eigenvalue corresponding to "matrix" env and input vector phi0.

Named arguments for solver and their default values:

See the documentation of KrylovKit.jl.

  • ishermitian::Bool = true
  • solver_tol::Float64 = 1E-14.
  • solver_krylovdim::Int = 5.
  • solver_maxiter::Int = 2.
  • solver_outputlevel::Int = 0: See verbosity in KrylovKit.jl.
  • solver_eager::Bool = false.
  • solver_check_convergence::Bool = false.

Return values:

  • ::Float64: Smallest eigenvalue.
  • ::ITensor: Eigenstate corresponding to the smallest eigenvalue.
source
TeNLib.exp_solverFunction
function exp_solver(env, phi0::ITensor, time_step::Union{Float64, ComplexF64}; kwargs...)

Exponentiation solver to find exp(env * phi0 * time_step).

Named arguments for solver and their default values:

See the documentation of KrylovKit.jl.

  • ishermitian::Bool = true
  • solver_tol::Float64 = 1E-12.
  • solver_krylovdim::Int = 30.
  • solver_maxiter::Int = 10.
  • solver_outputlevel::Int = 0: See verbosity in KrylovKit.jl.
  • solver_eager::Bool = true.
  • solver_check_convergence::Bool = true.

Return values:

  • ::Float64: NaN.
  • ::ITensor: Exponentiated ITensor.
source
+Solvers · TeNLib.jl

Solvers

Functions to perform local updates. These functions use Krylovkit.jl.

TeNLib.eig_solverFunction
function eig_solver(env, phi0::ITensor, time_step::Nothing; kwargs...)

Solver to find smallest eigenvalue corresponding to "matrix" env and input vector phi0.

Named arguments for solver and their default values:

See the documentation of KrylovKit.jl.

  • ishermitian::Bool = true
  • solver_tol::Float64 = 1E-14.
  • solver_krylovdim::Int = 5.
  • solver_maxiter::Int = 2.
  • solver_outputlevel::Int = 0: See verbosity in KrylovKit.jl.
  • solver_eager::Bool = false.
  • solver_check_convergence::Bool = false.

Return values:

  • ::Float64: Smallest eigenvalue.
  • ::ITensor: Eigenstate corresponding to the smallest eigenvalue.
source
TeNLib.exp_solverFunction
function exp_solver(env, phi0::ITensor, time_step::Union{Float64, ComplexF64}; kwargs...)

Exponentiation solver to find exp(env * phi0 * time_step).

Named arguments for solver and their default values:

See the documentation of KrylovKit.jl.

  • ishermitian::Bool = true
  • solver_tol::Float64 = 1E-12.
  • solver_krylovdim::Int = 30.
  • solver_maxiter::Int = 10.
  • solver_outputlevel::Int = 0: See verbosity in KrylovKit.jl.
  • solver_eager::Bool = true.
  • solver_check_convergence::Bool = true.

Return values:

  • ::Float64: NaN.
  • ::ITensor: Exponentiated ITensor.
source
diff --git a/dev/index.html b/dev/index.html index b13e319..eaab5f6 100644 --- a/dev/index.html +++ b/dev/index.html @@ -86,4 +86,4 @@ disable_noise_after = 5) en, psi = optimize(psi0, H, params, sweeppath) -end

+end

diff --git a/dev/mps/dmrg/index.html b/dev/mps/dmrg/index.html index e6f8e1a..e9884cb 100644 --- a/dev/mps/dmrg/index.html +++ b/dev/mps/dmrg/index.html @@ -6,18 +6,18 @@ noise::Vector{Float64} noisedecay::Vector{Float64} disable_noise_after::Vector{Int} -end

Holds parameters to control DMRG sweeps.

states of DMRG.

All these Vectors must have same dimension.

source
TeNLib.DMRGParamsMethod
function DMRGParams(;maxdim::Vector{Int}, nsweeps::Vector{Int}, 
+end

Holds parameters to control DMRG sweeps.

  • maxdim::Vector{Int}: Maximum allowed MPS bond/link dimensions at each stages of DMRG.
  • nsweeps::Vector{Int}: Number of sweeps to be performed at each statges of DMRG.
  • cutoff::Vector{Float64}: Cutoff for SVD truncation at each stages of DMRG.
  • noise::Vector{Float64}: Noise level at each stages of DMRG.
  • noisedecay::Vector{Float64}: Decay of noise level at each states of DMRG. Noise is divided by noisedecay after each sweep.
  • disable_noise_after::Vector{Int}: Switch of noise after this many sweeps at each

states of DMRG.

All these Vectors must have same dimension.

source
TeNLib.DMRGParamsMethod
function DMRGParams(;maxdim::Vector{Int}, nsweeps::Vector{Int}, 
                     cutoff::Union{Vector{Float64}, Float64} = _Float64_Threshold,
                     noise::Union{Vector{Float64}, Float64, Int} = 0.0,
                     noisedecay::Union{Vector{Float64}, Float64, Int} = 1.0,
-                    disable_noise_after::Union{Vector{Int}, Int} = typemax(Int))

Constructor for DMRGParams. Takes only named arguments.

  • maxdim::Vector{Int}: Maximum allowed MPS bond/link dimensions at each stages of DMRG.
  • nsweeps::Vector{Int}: Number of sweeps to be performed at each statges of DMRG.
  • cutoff::Union{Float64, Vector{Float64}} = Float64_threshold(): Cutoff for SVD truncation at each stages of DMRG. If Float64, cutoff remains same throughout the DMRG simulation.
  • noise::Union{Float64, Int, Vector{Float64}} = 0.0: Noise level at each stages of DMRG. If Float64 or Int, initial noise remains same throughout the DMRG simulation.
  • noisedecay::Union{Float64, Int, Vector{Float64}} = 1.0: Decay of noise level at each states of DMRG. Noise is divided by noisedecay after each sweep. If Float64 or Int, noisedecay remains same throughout the DMRG simulation.
  • disable_noise_after::Union{Int, Vector{Int}} = typemax(Int): Switch of noise after this many sweeps at each states of DMRG. If Int, disable_noise_after remains same throughout the DMRG simulation.
source
Base.copyMethod
Base.copy(params::DMRGParams)

Shallow copy DMRGParams.

source

A lower level DMRG function

Following function modifies StateEnvs in-place. Skip this function if you want to avoid lower-level abstraction.

TeNLib.dmrg!Method
function dmrg!(sysenv::StateEnvs, params::DMRGParams, nsite::Int; kwargs...)

Performs DMRG.

Arguments:

  • sysenv::StateEnvs.
  • params::DMRGParams.
  • nsite::Int of the environment. Either 1 or 2 for one-site or two-site update respectively.

Named arguments and their default values:

  • normalize::Bool = true: Whether to normalize after update.
  • svd_alg::String = "divide_and_conquer".
  • weight::Float64 = -1.0: Weight for the excited state DMRG. Must be set to greater than 0 for the excited state DMRG.
  • outputlevel::Int = 1. If 0 prints no information, for 1 outputs after every fullsweep, if 2 prints at every update step.

Convergence criteria:

  • energyErrGoal: DMRG (at a particluar stage) stops when energy difference between two consecutive sweeps falls below this threshold and DMRG moves to the next stage. noise must be below Float64_threshold() to trigger this early stopping.
  • entropyErrGoal: DMRG (at a particluar stage) stops when mid-chain entropy difference between two consecutive sweeps falls below this threshold and DMRG moves to the next stage. noise must be below Float64_threshold() to trigger this early stopping.

When both energyErrGoal and entropyErrGoal are given, both conditions must be satisfied to trigger this early stopping.

Named arguments for solver and their default values:

See the documentation of KrylovKit.jl.

  • ishermitian::Bool = true.
  • solver_tol::Float64 = 1E-14.
  • solver_krylovdim::Int = 5.
  • solver_maxiter::Int = 2.
  • solver_outputlevel::Int = 0.: See verbosity in KrylovKit.jl.
  • solver_eager::Bool = false.
  • solver_check_convergence::Bool = false.

Return values:

  • SweepData
source

Higher level DMRG functions

Standard two- and single-site DMRG functions. Single-site DMRG can increasing the bond-dimension if noise > Float64_threshold().

TeNLib.dmrg2Method
function dmrg2(psi0::MPS, H::MPO, params::DMRGParams; kwargs...)
+                    disable_noise_after::Union{Vector{Int}, Int} = typemax(Int))

Constructor for DMRGParams. Takes only named arguments.

  • maxdim::Vector{Int}: Maximum allowed MPS bond/link dimensions at each stages of DMRG.
  • nsweeps::Vector{Int}: Number of sweeps to be performed at each statges of DMRG.
  • cutoff::Union{Float64, Vector{Float64}} = Float64_threshold(): Cutoff for SVD truncation at each stages of DMRG. If Float64, cutoff remains same throughout the DMRG simulation.
  • noise::Union{Float64, Int, Vector{Float64}} = 0.0: Noise level at each stages of DMRG. If Float64 or Int, initial noise remains same throughout the DMRG simulation.
  • noisedecay::Union{Float64, Int, Vector{Float64}} = 1.0: Decay of noise level at each states of DMRG. Noise is divided by noisedecay after each sweep. If Float64 or Int, noisedecay remains same throughout the DMRG simulation.
  • disable_noise_after::Union{Int, Vector{Int}} = typemax(Int): Switch of noise after this many sweeps at each states of DMRG. If Int, disable_noise_after remains same throughout the DMRG simulation.
source
Base.copyMethod
Base.copy(params::DMRGParams)

Shallow copy DMRGParams.

source

A lower level DMRG function

Following function modifies StateEnvs in-place. Skip this function if you want to avoid lower-level abstraction.

TeNLib.dmrg!Method
function dmrg!(sysenv::StateEnvs, params::DMRGParams, nsite::Int; kwargs...)

Performs DMRG.

Arguments:

  • sysenv::StateEnvs.
  • params::DMRGParams.
  • nsite::Int of the environment. Either 1 or 2 for one-site or two-site update respectively.

Named arguments and their default values:

  • normalize::Bool = true: Whether to normalize after update.
  • svd_alg::String = "divide_and_conquer".
  • weight::Float64 = -1.0: Weight for the excited state DMRG. Must be set to greater than 0 for the excited state DMRG.
  • outputlevel::Int = 1. If 0 prints no information, for 1 outputs after every fullsweep, if 2 prints at every update step.

Convergence criteria:

  • energyErrGoal: DMRG (at a particluar stage) stops when energy difference between two consecutive sweeps falls below this threshold and DMRG moves to the next stage. noise must be below Float64_threshold() to trigger this early stopping.
  • entropyErrGoal: DMRG (at a particluar stage) stops when mid-chain entropy difference between two consecutive sweeps falls below this threshold and DMRG moves to the next stage. noise must be below Float64_threshold() to trigger this early stopping.

When both energyErrGoal and entropyErrGoal are given, both conditions must be satisfied to trigger this early stopping.

Named arguments for solver and their default values:

See the documentation of KrylovKit.jl.

  • ishermitian::Bool = true.
  • solver_tol::Float64 = 1E-14.
  • solver_krylovdim::Int = 5.
  • solver_maxiter::Int = 2.
  • solver_outputlevel::Int = 0.: See verbosity in KrylovKit.jl.
  • solver_eager::Bool = false.
  • solver_check_convergence::Bool = false.

Return values:

  • SweepData
source

Higher level DMRG functions

Standard two- and single-site DMRG functions. Single-site DMRG can increasing the bond-dimension if noise > Float64_threshold().

TeNLib.dmrg2Method
function dmrg2(psi0::MPS, H::MPO, params::DMRGParams; kwargs...)
 function dmrg2(psi0::MPS, H::CouplingModel, params::DMRGParams; kwargs...)
 function dmrg2(psi0::MPS, Hs::Vector{MPO}, params::DMRGParams; kwargs...)
 function dmrg2(psi0::MPS, H::MPO, Ms::Vector{MPS}, params::DMRGParams; kwargs...)
 function dmrg2(psi0::MPS, Hs::Vector{MPO}, Ms::Vector{MPS}, params::DMRGParams; kwargs...)
-function dmrg2(psi0::MPS, H::CouplingModel, Ms::Vector{MPS}, params::DMRGParams; kwargs...)

Performs two-site DMRG.

Arguments:

  • psi0::MPS: Initial MPS.
  • H::MPO, H::CouplingModel, Hs::Vector{MPO}, Ms::Vector{MPS}.
  • params::DMRGParams.

Named arguments and their default values:

  • normalize::Bool = true: Whether to normalize after update.
  • svd_alg::String = "divide_and_conquer".
  • weight::Float64 = -1.0: Weight for the excited state DMRG. Must be set to greater than 0 for the excited state DMRG.
  • outputlevel::Int = 1. If 0 prints no information, for 1 outputs after every fullsweep, if 2 prints at every update step.

Convergence criteria:

  • energyErrGoal: DMRG (at a particluar stage) stops when energy difference between two consecutive sweeps falls below this threshold and DMRG moves to the next stage. noise must be below Float64_threshold() to trigger this early stopping.
  • entropyErrGoal: DMRG (at a particluar stage) stops when mid-chain entropy difference between two consecutive sweeps falls below this threshold and DMRG moves to the next stage. noise must be below Float64_threshold() to trigger this early stopping.

When both energyErrGoal and entropyErrGoal are given, both conditions must be satisfied to trigger this early stopping.

Named arguments for eig_solver and their default values:

See the documentation of KrylovKit.jl.

  • ishermitian::Bool = true.
  • solver_tol::Float64 = 1E-14.
  • solver_krylovdim::Int = 5.
  • solver_maxiter::Int = 2.
  • solver_outputlevel::Int = 0: See verbosity in KrylovKit.jl.
  • solver_eager::Bool = false.
  • solver_check_convergence::Bool = false.

Return values:

  • ::Float64: Energy.
  • ::MPS: The state psi.
source
TeNLib.dmrg1Method
function dmrg1(psi0::MPS, H::MPO, params::DMRGParams; kwargs...)
+function dmrg2(psi0::MPS, H::CouplingModel, Ms::Vector{MPS}, params::DMRGParams; kwargs...)

Performs two-site DMRG.

Arguments:

  • psi0::MPS: Initial MPS.
  • H::MPO, H::CouplingModel, Hs::Vector{MPO}, Ms::Vector{MPS}.
  • params::DMRGParams.

Named arguments and their default values:

  • normalize::Bool = true: Whether to normalize after update.
  • svd_alg::String = "divide_and_conquer".
  • weight::Float64 = -1.0: Weight for the excited state DMRG. Must be set to greater than 0 for the excited state DMRG.
  • outputlevel::Int = 1. If 0 prints no information, for 1 outputs after every fullsweep, if 2 prints at every update step.

Convergence criteria:

  • energyErrGoal: DMRG (at a particluar stage) stops when energy difference between two consecutive sweeps falls below this threshold and DMRG moves to the next stage. noise must be below Float64_threshold() to trigger this early stopping.
  • entropyErrGoal: DMRG (at a particluar stage) stops when mid-chain entropy difference between two consecutive sweeps falls below this threshold and DMRG moves to the next stage. noise must be below Float64_threshold() to trigger this early stopping.

When both energyErrGoal and entropyErrGoal are given, both conditions must be satisfied to trigger this early stopping.

Named arguments for eig_solver and their default values:

See the documentation of KrylovKit.jl.

  • ishermitian::Bool = true.
  • solver_tol::Float64 = 1E-14.
  • solver_krylovdim::Int = 5.
  • solver_maxiter::Int = 2.
  • solver_outputlevel::Int = 0: See verbosity in KrylovKit.jl.
  • solver_eager::Bool = false.
  • solver_check_convergence::Bool = false.

Return values:

  • ::Float64: Energy.
  • ::MPS: The state psi.
source
TeNLib.dmrg1Method
function dmrg1(psi0::MPS, H::MPO, params::DMRGParams; kwargs...)
 function dmrg1(psi0::MPS, H::CouplingModel, params::DMRGParams; kwargs...)
 function dmrg1(psi0::MPS, Hs::Vector{MPO}, params::DMRGParams; kwargs...)
 function dmrg1(psi0::MPS, H::MPO, Ms::Vector{MPS}, params::DMRGParams; kwargs...)
 function dmrg1(psi0::MPS, Hs::Vector{MPO}, Ms::Vector{MPS}, params::DMRGParams; kwargs...)
-function dmrg1(psi0::MPS, H::CouplingModel, Ms::Vector{MPS}, params::DMRGParams; kwargs...)

Performs single-site DMRG. All other details are same as in dmrg2.

source
+function dmrg1(psi0::MPS, H::CouplingModel, Ms::Vector{MPS}, params::DMRGParams; kwargs...)

Performs single-site DMRG. All other details are same as in dmrg2.

source diff --git a/dev/mps/example_dmrg/index.html b/dev/mps/example_dmrg/index.html index 968e07b..778be92 100644 --- a/dev/mps/example_dmrg/index.html +++ b/dev/mps/example_dmrg/index.html @@ -71,4 +71,4 @@ # Alternatively, take the psi from `StateEnvs` itself. # NOTE: This can crash the simulation, if the MPS is modified (e.g., in measurements) # and `StateEnvs` is going to be updated later. -# psi1 = sysenv_ex.psi +# psi1 = sysenv_ex.psi diff --git a/dev/mps/example_tdvp/index.html b/dev/mps/example_tdvp/index.html index ef4a9ec..2068fb7 100644 --- a/dev/mps/example_tdvp/index.html +++ b/dev/mps/example_tdvp/index.html @@ -109,4 +109,4 @@ Ht = makeHt(sites, ii*dt) updateH!(engine, Ht) end -end

Note 1: The above example for time-dependent Hamiltonian is very crude. In real situations, the update in the Hamiltonian should be done with proper care.

Note 2: When the TDVPEngine is created from a single MPO and dt is small, one can use recalcEnv = false in updateH!, so that environments from the last step is reused.

+end

Note 1: The above example for time-dependent Hamiltonian is very crude. In real situations, the update in the Hamiltonian should be done with proper care.

Note 2: When the TDVPEngine is created from a single MPO and dt is small, one can use recalcEnv = false in updateH!, so that environments from the last step is reused.

diff --git a/dev/mps/measure/index.html b/dev/mps/measure/index.html index 7d3730d..b016ce3 100644 --- a/dev/mps/measure/index.html +++ b/dev/mps/measure/index.html @@ -1,4 +1,4 @@ -Measuring the MPS · TeNLib.jl

Measuring the MPS

TeNLib.entropyMethod
function entropy(psi::MPS, bond::Int)

Compute von Neumann Entropy of a given MPS psi at bond.

source
TeNLib.entropyMethod
function entropy(psi::MPS; kwargs...)

Compute von Neumann Entropies of a given MPS psi at all the bonds.

Optionally, for specific bonds, keyword argument bonds can be specified, e.g., bonds = [1, 2, 3].

source
TeNLib.measureMethod
function measure(::Type{ElT} = ComplexF64, psi::MPS, opten::ITensor)

Returns (complex / real) local expectation value (::ComplexF64 / ::Float64) of a given MPS psi::MPS. The operator opten::ITensor must be single-site operator.

For ElT = Float64, if the expectation value is complex, raises a warning!

source
TeNLib.measureMethod
function measure(::Type{ElT} = ComplexF64, psi::MPS, opstr::String, pos::Int)

Returns (complex / real) local expectation value (::ComplexF64 / ::Float64) of a given MPS psi::MPS for a given operator name (opstr::String) and a site index (pos::Int)

For ElT = Float64, if the expectation value is complex, raises a warning!

source
TeNLib.measureMethod
function measure(::Type{ElT} = ComplexF64, psi::MPS, opstr::String; kwargs...)

Returns (complex / real) local expectation values (::Vector{ComplexF64} / ::Vector{Float64}) of a given MPS psi::MPS for a given operator name (opstr::String) at all the sites.

Optionally, for specific sites, keyword argument sites can be specified, e.g., sites = [1, 2, 3].

For ElT = Float64, if the expectation value is complex, raises a warning!

source
TeNLib.measureMethod
function measure(::Type{ElT} = ComplexF64, psi::MPS, optens::Vector{ITensor})

Returns (complex / real) multi-site expectation value (::ComplexF64 / ::Float64) of a given MPS psi::MPS for a given vector of single-site operators (optens::Vector{ITensor}).

For ElT = Float64, if the expectation value is complex, raises a warning!

source
TeNLib.measureMethod
function measure(::Type{ElT} = ComplexF64, psi::MPS, oppairs::Vector{Pair{String, Int}};
+Measuring the MPS · TeNLib.jl

Measuring the MPS

TeNLib.entropyMethod
function entropy(psi::MPS, bond::Int)

Compute von Neumann Entropy of a given MPS psi at bond.

source
TeNLib.entropyMethod
function entropy(psi::MPS; kwargs...)

Compute von Neumann Entropies of a given MPS psi at all the bonds.

Optionally, for specific bonds, keyword argument bonds can be specified, e.g., bonds = [1, 2, 3].

source
TeNLib.measureMethod
function measure(::Type{ElT} = ComplexF64, psi::MPS, opten::ITensor)

Returns (complex / real) local expectation value (::ComplexF64 / ::Float64) of a given MPS psi::MPS. The operator opten::ITensor must be single-site operator.

For ElT = Float64, if the expectation value is complex, raises a warning!

source
TeNLib.measureMethod
function measure(::Type{ElT} = ComplexF64, psi::MPS, opstr::String, pos::Int)

Returns (complex / real) local expectation value (::ComplexF64 / ::Float64) of a given MPS psi::MPS for a given operator name (opstr::String) and a site index (pos::Int)

For ElT = Float64, if the expectation value is complex, raises a warning!

source
TeNLib.measureMethod
function measure(::Type{ElT} = ComplexF64, psi::MPS, opstr::String; kwargs...)

Returns (complex / real) local expectation values (::Vector{ComplexF64} / ::Vector{Float64}) of a given MPS psi::MPS for a given operator name (opstr::String) at all the sites.

Optionally, for specific sites, keyword argument sites can be specified, e.g., sites = [1, 2, 3].

For ElT = Float64, if the expectation value is complex, raises a warning!

source
TeNLib.measureMethod
function measure(::Type{ElT} = ComplexF64, psi::MPS, optens::Vector{ITensor})

Returns (complex / real) multi-site expectation value (::ComplexF64 / ::Float64) of a given MPS psi::MPS for a given vector of single-site operators (optens::Vector{ITensor}).

For ElT = Float64, if the expectation value is complex, raises a warning!

source
TeNLib.measureMethod
function measure(::Type{ElT} = ComplexF64, psi::MPS, oppairs::Vector{Pair{String, Int}};
                  isfermions::Bool = true)

Returns (complex / real) multi-site expectation value (::ComplexF64 / ::Float64) of a given MPS psi::MPS. oppairs::Vector{Pair{String, Int}} contains pairs of operator names (String) and site locations (Int). E.g., for <ψ|OᵢOⱼOₖ... |ψ>, oppairs = ["O" => i, "O" => j, "O" => k,...].

Fermionic JW strings are added automatically for fermionic operators if isfermions::Bool = true (default).

For ElT = Float64, if the expectation value is complex, raises a warning!

Example:

valueC = measure(psi, ["Cdag" => 2, "C" => 6, "Cdag" => 9, "C" => 12])
-valueR = measure(Float64, psi, ["Cdag" => 2, "C" => 6, "Cdag" => 9, "C" => 12])
source
+valueR = measure(Float64, psi, ["Cdag" => 2, "C" => 6, "Cdag" => 9, "C" => 12])
source
diff --git a/dev/mps/state_envs/index.html b/dev/mps/state_envs/index.html index d885afa..adb117d 100644 --- a/dev/mps/state_envs/index.html +++ b/dev/mps/state_envs/index.html @@ -8,7 +8,7 @@ } psi::MPS PH::T -end

Holds the MPS state psi and its environments PH.

source
TeNLib.getpsiMethod
function getpsi(sysenv::StateEnvs)

Returns (shallow copy of) the state psi.

source
TeNLib.getenvMethod
function getenv(sysenv::StateEnvs)

Returns (shallow copy of) the environment PH.

source
TeNLib.StateEnvsMethod
function StateEnvs(psi::MPS, H::MPO)

Constructor of the StateEnvs from a single MPO.

source
TeNLib.StateEnvsMethod
function StateEnvs(psi::MPS, Hs::Vector{MPO})

Constructor of the StateEnvs from a vector of MPO. Environments are contracted in parallel.

source
TeNLib.StateEnvsMethod
function StateEnvs(psi::MPS, H::MPO, Ms::Vector{MPS}; weight::Float64)

Constructor of the StateEnvs from a single MPO and a vector of MPS used for excited state DMRG.

source
TeNLib.StateEnvsMethod
function StateEnvs(psi::MPS, Hs::Vector{MPO}, Ms::Vector{MPS}; weight::Float64)

Constructor of the StateEnvs from a vector of MPO and a vector of MPS used for excited state DMRG. Environments for MPOs are contracted in parallel.

source
TeNLib.StateEnvsMethod
function StateEnvs(psi::MPS, H::CouplingModel)

Constructor of the StateEnvs from a CouplingModel. Each terms in the CouplingModel are contracted in parallel.

source
TeNLib.StateEnvsMethod
function StateEnvs(psi::MPS, H::CouplingModel, Ms::Vector{MPS}; weight::Float64)

Constructor of StateEnvs from a CouplingModel and a vector of MPS used for excited state DMRG. Each terms in the CouplingModel are contracted in parallel.

source
TeNLib.updateH!Method
function updateH!(sysenv::StateEnvs{ProjMPO}, H::MPO; recalcEnv::Bool = true)

Update Hamiltonian H in sysenv::StateEnvs. If recalcEnv = false, it reuses previous environments.

source
TeNLib.updateH!Method
function updateH!(sysenv::StateEnvs{ProjMPOSum2}, Hs::Vector{MPO}; recalcEnv::Bool = true)

Update Hamiltonian H in sysenv::StateEnvs. recalcEnv = false is not supported.

source
TeNLib.updateH!Method
function updateH!(sysenv::StateEnvs{ProjMPO_MPS2}, H::MPO, Ms::Vector{MPS};
-                  weight::Float64, recalcEnv::Bool = true)

Update Hamiltonian H in sysenv::StateEnvs. recalcEnv = false is not supported.

  • weight::Union{Nothing, Float64} = nothing.
source
TeNLib.updateH!Method
function updateH!(sysenv::StateEnvs{ProjMPOSum_MPS}, Hs::Vector{MPO}, Ms::Vector{MPS};
-                  weight::Float64, recalcEnv::Bool = true)

Update Hamiltonian H in sysenv::StateEnvs. recalcEnv = false is not supported.

  • weight::Union{Nothing, Float64} = nothing.
source
TeNLib.updateH!Method
function updateH!(sysenv::StateEnvs{ProjCouplingModel_MPS}, H::CouplingModel, Ms::Vector{MPS};
-                  weight::Float64, recalcEnv::Bool = true)

Update Hamiltonian H in sysenv::StateEnvs. recalcEnv = false is not supported.

  • weight::Union{Nothing, Float64} = nothing.
source
ITensors.nsiteMethod
function nsite(sysenv::StateEnvs)

Returns the nsite of the environment. nsite = 1 for single-site environment, nsite = 2 for two-site environmrnt, and so on. Currently, only uses nsite = 0, 1, or 2.

source
ITensors.set_nsite!Method
function set_nsite!(sysenv::StateEnvs, nsite::Int)

Set nsite of the environment. nsite = 1 for single-site environment, nsite = 2 for two-site environmrnt, and so on. Currently, only uses nsite = 0, 1, or 2.

source
ITensors.position!Method
function position!(sysenv::StateEnvs, pos::Int)

Compute the left and right environments at position pos.

source
TeNLib.productMethod
function product(sysenv::StateEnvs, v::ITensor)

Returns the Matrix-Vector product between the environment and input ITensor v.

source
Base.copyMethod
function Base.copy(sysenv::StateEnvs)

Shallow copy of StateEnvs.

source
Base.lengthMethod
function Base.length(sysenv::StateEnvs)

Returns the length of the underlying MPS/Environment.

source
+end

Holds the MPS state psi and its environments PH.

source
TeNLib.getpsiMethod
function getpsi(sysenv::StateEnvs)

Returns (shallow copy of) the state psi.

source
TeNLib.getenvMethod
function getenv(sysenv::StateEnvs)

Returns (shallow copy of) the environment PH.

source
TeNLib.StateEnvsMethod
function StateEnvs(psi::MPS, H::MPO)

Constructor of the StateEnvs from a single MPO.

source
TeNLib.StateEnvsMethod
function StateEnvs(psi::MPS, Hs::Vector{MPO})

Constructor of the StateEnvs from a vector of MPO. Environments are contracted in parallel.

source
TeNLib.StateEnvsMethod
function StateEnvs(psi::MPS, H::MPO, Ms::Vector{MPS}; weight::Float64)

Constructor of the StateEnvs from a single MPO and a vector of MPS used for excited state DMRG.

source
TeNLib.StateEnvsMethod
function StateEnvs(psi::MPS, Hs::Vector{MPO}, Ms::Vector{MPS}; weight::Float64)

Constructor of the StateEnvs from a vector of MPO and a vector of MPS used for excited state DMRG. Environments for MPOs are contracted in parallel.

source
TeNLib.StateEnvsMethod
function StateEnvs(psi::MPS, H::CouplingModel)

Constructor of the StateEnvs from a CouplingModel. Each terms in the CouplingModel are contracted in parallel.

source
TeNLib.StateEnvsMethod
function StateEnvs(psi::MPS, H::CouplingModel, Ms::Vector{MPS}; weight::Float64)

Constructor of StateEnvs from a CouplingModel and a vector of MPS used for excited state DMRG. Each terms in the CouplingModel are contracted in parallel.

source
TeNLib.updateH!Method
function updateH!(sysenv::StateEnvs{ProjMPO}, H::MPO; recalcEnv::Bool = true)

Update Hamiltonian H in sysenv::StateEnvs. If recalcEnv = false, it reuses previous environments.

source
TeNLib.updateH!Method
function updateH!(sysenv::StateEnvs{ProjMPOSum2}, Hs::Vector{MPO}; recalcEnv::Bool = true)

Update Hamiltonian H in sysenv::StateEnvs. recalcEnv = false is not supported.

source
TeNLib.updateH!Method
function updateH!(sysenv::StateEnvs{ProjMPO_MPS2}, H::MPO, Ms::Vector{MPS};
+                  weight::Float64, recalcEnv::Bool = true)

Update Hamiltonian H in sysenv::StateEnvs. recalcEnv = false is not supported.

  • weight::Union{Nothing, Float64} = nothing.
source
TeNLib.updateH!Method
function updateH!(sysenv::StateEnvs{ProjMPOSum_MPS}, Hs::Vector{MPO}, Ms::Vector{MPS};
+                  weight::Float64, recalcEnv::Bool = true)

Update Hamiltonian H in sysenv::StateEnvs. recalcEnv = false is not supported.

  • weight::Union{Nothing, Float64} = nothing.
source
TeNLib.updateH!Method
function updateH!(sysenv::StateEnvs{ProjCouplingModel_MPS}, H::CouplingModel, Ms::Vector{MPS};
+                  weight::Float64, recalcEnv::Bool = true)

Update Hamiltonian H in sysenv::StateEnvs. recalcEnv = false is not supported.

  • weight::Union{Nothing, Float64} = nothing.
source
ITensors.nsiteMethod
function nsite(sysenv::StateEnvs)

Returns the nsite of the environment. nsite = 1 for single-site environment, nsite = 2 for two-site environmrnt, and so on. Currently, only uses nsite = 0, 1, or 2.

source
ITensors.set_nsite!Method
function set_nsite!(sysenv::StateEnvs, nsite::Int)

Set nsite of the environment. nsite = 1 for single-site environment, nsite = 2 for two-site environmrnt, and so on. Currently, only uses nsite = 0, 1, or 2.

source
ITensors.position!Method
function position!(sysenv::StateEnvs, pos::Int)

Compute the left and right environments at position pos.

source
TeNLib.productMethod
function product(sysenv::StateEnvs, v::ITensor)

Returns the Matrix-Vector product between the environment and input ITensor v.

source
Base.copyMethod
function Base.copy(sysenv::StateEnvs)

Shallow copy of StateEnvs.

source
Base.lengthMethod
function Base.length(sysenv::StateEnvs)

Returns the length of the underlying MPS/Environment.

source
diff --git a/dev/mps/sweep/index.html b/dev/mps/sweep/index.html index db5933b..c968983 100644 --- a/dev/mps/sweep/index.html +++ b/dev/mps/sweep/index.html @@ -6,6 +6,6 @@ entropy::Vector{Float64} maxtruncerr::Vector{Float64} lasteigs::Vector{Vector{Float64}} -end

Holds historical data after each (full)sweep. Requires for convergence check etc.

Default constructor:

source
Base.copyMethod
Base.copy(swdata::SweepData)

Shallow copy of SweepData.

source

Perform a fullsweep

TeNLib.fullsweep!Method
function fullsweep!(sysenv::StateEnvs, solver, nsite::Int, swdata::SweepData;
-                    kwargs...)

Perform a fullsweep (left-to-right and right-to-left) by solver.

Arguments:

  • sysenv::StateEnvs.
  • solver: Solver for update. Available ones: eig_solver and exp_solver.
  • nsite::Int of the environment. Either 1 or 2 for one-site or two-site update respectively.
  • swdata::SweepData.

Named arguments and their default values:

  • time_step::Union{Float64, ComplexF64, Nothing} = nothing: Time step for TDVP.
  • normalize::Bool = true: Whether to normalize after update.
  • maxdim::Int = typemax(Int): Maximum bond dimension after SVD truncation.
  • mindim::Int = 1: Minimum bond dimension after SVD truncation.
  • cutoff::Float64 = Float64_threshold(): Cutoff for SVD truncation.
  • svd_alg::String = "divide_and_conquer".
  • noise::Float64 = 0.0.
  • reverse_step::Bool = false if time_step = nothing, true otherwise.
  • outputlevel::Int = 1. If 0 prints no information, for 1 outputs after every fullsweep, if 2 prints at every update step.

Named arguments for solver and their default values:

See the documentation of KrylovKit.jl.

  • ishermitian::Bool = true.
  • solver_tol::Float64 = 1E-14 if eig_solver, 1E-12 if exp_solver.
  • solver_krylovdim::Int = 5 if eig_solver, 30 if exp_solver.
  • solver_maxiter::Int = 2 if eig_solver, 100 if exp_solver.
  • solver_outputlevel::Int = 0: See verbosity in KrylovKit.jl.
  • solver_eager::Bool = false if eig_solver, true if exp_solver.
  • solver_check_convergence::Bool = false if eig_solver, true if exp_solver.

Return values:

  • ::Float64: Change in Energy ΔE
  • ::Float64: Change in Entropy ΔS

swdata::SweepData gets updated.

source

Perform a dynamical fullsweep

TeNLib.jl defines the following function to dynamically decide whether to perform single- or two-site update at each bond, depending on the entropy growth at the previous halfsweep.

TeNLib.dynamic_fullsweep!Method
function dynamic_fullsweep!(sysenv::StateEnvs, solver, swdata::SweepData;
-                            kwargs...)

Perform a dynamic fullsweep (left-to-right and right-to-left) by solver. The very first sweep, as dictated by swdata.sweepcount=0, Global Subspace Expansion (see below) is performed followed by a pure one-site sweep if typeof(sysenv) == StateEnvs{ProjMPO}, else performs a full two-site sweep. At each bond, if the lowest eigenvalue is below eigthreshold or the bond dimension at that bond has reached maxdim at a particular halfsweep, performs single-site update across that bond in the subsequent halfsweep, otherwise performs two-site update.

Arguments:

  • sysenv::StateEnvs.
  • solver: Solver for update. Available ones: eig_solver and exp_solver.
  • swdata::SweepData.

Named arguments and their default values:

  • time_step::Union{Float64, ComplexF64, Nothing} = nothing: Time step for TDVP.
  • normalize::Bool = true: Whether to normalize after update.
  • maxdim::Int = typemax(Int): Maximum bond dimension after SVD truncation.
  • mindim::Int = 1: Minimum bond dimension after SVD truncation.
  • cutoff::Float64 = Float64_threshold(): Cutoff for SVD truncation.
  • svd_alg::String = "divide_and_conquer".
  • noise::Float64 = 0.0.
  • reverse_step::Bool = false if time_step = nothing, true otherwise.
  • outputlevel::Int = 1. If 0 prints no information, for 1 outputs after every fullsweep, if 2 prints at every update step.
  • eigthreshold::Float64 = 1E-12.
  • extendat::Union{Nothing, Int} = nothing: If specified, at every extendatth sweep, Global Subspace Expansion is performed followed by a pure one-site sweep if typeof(sysenv) == StateEnvs{ProjMPO}, else performs a full two-site sweep.

Named arguments for solver and their default values:

See the documentation of KrylovKit.jl.

  • ishermitian::Bool = true.
  • solver_tol::Float64 = 1E-14 if eig_solver, 1E-12 if exp_solver.
  • solver_krylovdim::Int = 3 if eig_solver, 30 if exp_solver.
  • solver_maxiter::Int = 1 if eig_solver, 100 if exp_solver.
  • solver_outputlevel::Int = 0: See verbosity in KrylovKit.jl.
  • solver_eager::Bool = false if eig_solver, true if exp_solver.
  • solver_check_convergence::Bool = false if eig_solver, true if exp_solver.

Arguments for Global Subspace Expansion and their default values:

  • extension_krylovdim::Int = 3: Number of Krylov vectors used for GSE.
  • extension_applyH_cutoff::Float64 = 0.0: Cutoff for the application of the MPO to the MPS.
  • extension_applyH_maxdim::Int = maxlinkdim(psi) + 1: Maximum bond/link dimension for the application of the MPO to the MPS.
  • extension_cutoff::Float64 = 1E-10: Cutoff for the basis extension step in GSE.

Return values:

  • ::Float64: Change in Energy ΔE
  • ::Float64: Change in Entropy ΔS

swdata::SweepData gets updated.

source

Global Subspace Expansion

Following Phys. Rev. B 102, 094315 (2020), a Global Subspace Expansion can be performed using Krylov subspace if the environments are created by a single MPO.

TeNLib.krylov_extend!Method
function krylov_extend!(psi::MPS, H::MPO; kwargs...)

Performs Global Subspace Expansion.

Arguments and their default values:

  • extension_krylovdim::Int = 3: Number of Krylov vectors used for GSE.
  • extension_applyH_cutoff::Float64 = Float64_threshold(): Cutoff for the application the MPO to the MPS.
  • extension_applyH_maxdim::Int = maxlinkdim(psi) + 1: Maximum bond/link dimension of the resulting MPS after the application of the MPO to the MPS.
  • extension_cutoff::Float64 = 1E-10: Cutoff for the basis extension step in GSE.
source
TeNLib.krylov_extend!Method
function krylov_extend!(sysenv::StateEnvs{ProjMPO}; kwargs...)

Performs Global Subspace Expansion. The StateEnvs must be created by a single MPO.

Arguments and their default values:

  • extension_krylovdim::Int = 3: Number of Krylov vectors used for GSE.
  • extension_applyH_cutoff::Float64 = Float64_threshold(): Cutoff for the application the MPO to the MPS.
  • extension_applyH_maxdim::Int = maxlinkdim(psi) + 1: Maximum bond/link dimension of the resulting MPS after the application of the MPO to the MPS.
  • extension_cutoff::Float64 = 1E-10: Cutoff for the basis extension step in GSE.
source
Info

Apart from TDVP, Global Subspace Expansion is also very useful for DMRG to get rid of nasty local minimas.

+end

Holds historical data after each (full)sweep. Requires for convergence check etc.

Default constructor:

source
Base.copyMethod
Base.copy(swdata::SweepData)

Shallow copy of SweepData.

source

Perform a fullsweep

TeNLib.fullsweep!Method
function fullsweep!(sysenv::StateEnvs, solver, nsite::Int, swdata::SweepData;
+                    kwargs...)

Perform a fullsweep (left-to-right and right-to-left) by solver.

Arguments:

  • sysenv::StateEnvs.
  • solver: Solver for update. Available ones: eig_solver and exp_solver.
  • nsite::Int of the environment. Either 1 or 2 for one-site or two-site update respectively.
  • swdata::SweepData.

Named arguments and their default values:

  • time_step::Union{Float64, ComplexF64, Nothing} = nothing: Time step for TDVP.
  • normalize::Bool = true: Whether to normalize after update.
  • maxdim::Int = typemax(Int): Maximum bond dimension after SVD truncation.
  • mindim::Int = 1: Minimum bond dimension after SVD truncation.
  • cutoff::Float64 = Float64_threshold(): Cutoff for SVD truncation.
  • svd_alg::String = "divide_and_conquer".
  • noise::Float64 = 0.0.
  • reverse_step::Bool = false if time_step = nothing, true otherwise.
  • outputlevel::Int = 1. If 0 prints no information, for 1 outputs after every fullsweep, if 2 prints at every update step.

Named arguments for solver and their default values:

See the documentation of KrylovKit.jl.

  • ishermitian::Bool = true.
  • solver_tol::Float64 = 1E-14 if eig_solver, 1E-12 if exp_solver.
  • solver_krylovdim::Int = 5 if eig_solver, 30 if exp_solver.
  • solver_maxiter::Int = 2 if eig_solver, 100 if exp_solver.
  • solver_outputlevel::Int = 0: See verbosity in KrylovKit.jl.
  • solver_eager::Bool = false if eig_solver, true if exp_solver.
  • solver_check_convergence::Bool = false if eig_solver, true if exp_solver.

Return values:

  • ::Float64: Change in Energy ΔE
  • ::Float64: Change in Entropy ΔS

swdata::SweepData gets updated.

source

Perform a dynamical fullsweep

TeNLib.jl defines the following function to dynamically decide whether to perform single- or two-site update at each bond, depending on the entropy growth at the previous halfsweep.

TeNLib.dynamic_fullsweep!Method
function dynamic_fullsweep!(sysenv::StateEnvs, solver, swdata::SweepData;
+                            kwargs...)

Perform a dynamic fullsweep (left-to-right and right-to-left) by solver. The very first sweep, as dictated by swdata.sweepcount=0, Global Subspace Expansion (see below) is performed followed by a pure one-site sweep if typeof(sysenv) == StateEnvs{ProjMPO}, else performs a full two-site sweep. At each bond, if the lowest eigenvalue is below eigthreshold or the bond dimension at that bond has reached maxdim at a particular halfsweep, performs single-site update across that bond in the subsequent halfsweep, otherwise performs two-site update.

Arguments:

  • sysenv::StateEnvs.
  • solver: Solver for update. Available ones: eig_solver and exp_solver.
  • swdata::SweepData.

Named arguments and their default values:

  • time_step::Union{Float64, ComplexF64, Nothing} = nothing: Time step for TDVP.
  • normalize::Bool = true: Whether to normalize after update.
  • maxdim::Int = typemax(Int): Maximum bond dimension after SVD truncation.
  • mindim::Int = 1: Minimum bond dimension after SVD truncation.
  • cutoff::Float64 = Float64_threshold(): Cutoff for SVD truncation.
  • svd_alg::String = "divide_and_conquer".
  • noise::Float64 = 0.0.
  • reverse_step::Bool = false if time_step = nothing, true otherwise.
  • outputlevel::Int = 1. If 0 prints no information, for 1 outputs after every fullsweep, if 2 prints at every update step.
  • eigthreshold::Float64 = 1E-12.
  • extendat::Union{Nothing, Int} = nothing: If specified, at every extendatth sweep, Global Subspace Expansion is performed followed by a pure one-site sweep if typeof(sysenv) == StateEnvs{ProjMPO}, else performs a full two-site sweep.

Named arguments for solver and their default values:

See the documentation of KrylovKit.jl.

  • ishermitian::Bool = true.
  • solver_tol::Float64 = 1E-14 if eig_solver, 1E-12 if exp_solver.
  • solver_krylovdim::Int = 3 if eig_solver, 30 if exp_solver.
  • solver_maxiter::Int = 1 if eig_solver, 100 if exp_solver.
  • solver_outputlevel::Int = 0: See verbosity in KrylovKit.jl.
  • solver_eager::Bool = false if eig_solver, true if exp_solver.
  • solver_check_convergence::Bool = false if eig_solver, true if exp_solver.

Arguments for Global Subspace Expansion and their default values:

  • extension_krylovdim::Int = 3: Number of Krylov vectors used for GSE.
  • extension_applyH_cutoff::Float64 = 0.0: Cutoff for the application of the MPO to the MPS.
  • extension_applyH_maxdim::Int = maxlinkdim(psi) + 1: Maximum bond/link dimension for the application of the MPO to the MPS.
  • extension_cutoff::Float64 = 1E-10: Cutoff for the basis extension step in GSE.

Return values:

  • ::Float64: Change in Energy ΔE
  • ::Float64: Change in Entropy ΔS

swdata::SweepData gets updated.

source

Global Subspace Expansion

Following Phys. Rev. B 102, 094315 (2020), a Global Subspace Expansion can be performed using Krylov subspace if the environments are created by a single MPO.

TeNLib.krylov_extend!Method
function krylov_extend!(psi::MPS, H::MPO; kwargs...)

Performs Global Subspace Expansion.

Arguments and their default values:

  • extension_krylovdim::Int = 3: Number of Krylov vectors used for GSE.
  • extension_applyH_cutoff::Float64 = Float64_threshold(): Cutoff for the application the MPO to the MPS.
  • extension_applyH_maxdim::Int = maxlinkdim(psi) + 1: Maximum bond/link dimension of the resulting MPS after the application of the MPO to the MPS.
  • extension_cutoff::Float64 = 1E-10: Cutoff for the basis extension step in GSE.
source
TeNLib.krylov_extend!Method
function krylov_extend!(sysenv::StateEnvs{ProjMPO}; kwargs...)

Performs Global Subspace Expansion. The StateEnvs must be created by a single MPO.

Arguments and their default values:

  • extension_krylovdim::Int = 3: Number of Krylov vectors used for GSE.
  • extension_applyH_cutoff::Float64 = Float64_threshold(): Cutoff for the application the MPO to the MPS.
  • extension_applyH_maxdim::Int = maxlinkdim(psi) + 1: Maximum bond/link dimension of the resulting MPS after the application of the MPO to the MPS.
  • extension_cutoff::Float64 = 1E-10: Cutoff for the basis extension step in GSE.
source
Info

Apart from TDVP, Global Subspace Expansion is also very useful for DMRG to get rid of nasty local minimas.

diff --git a/dev/mps/tdvp/index.html b/dev/mps/tdvp/index.html index 3f3ad7a..fe92434 100644 --- a/dev/mps/tdvp/index.html +++ b/dev/mps/tdvp/index.html @@ -4,11 +4,11 @@ ProjMPO_MPS2, ProjMPOSum_MPS, ProjCouplingModel, - ProjCouplingModel_MPS}}

Holds the MPS state, SweepData, and absolute elpased time for TDVP simulations.

source
TeNLib.TDVPEngineMethod
function TDVPEngine(psi::MPS, H::{T}) where T <: Union{MPO, Vector{MPO}, CouplingModel}

Constructor of the TDVPEngine from different forms of Hamiltonians.

source
TeNLib.TDVPEngineMethod
function TDVPEngine(psi::MPS, H::T, Ms::Vector{MPS};
-                    weight::Float64) where T <: Union{MPO, Vector{MPO}, CouplingModel}

Constructor of TDVPEngine from different forms of Hamiltonians and a vector of MPS.

source
TeNLib.getpsiMethod
function getpsi(engine::TDVPEngine)

Returns (shallow copy of) the state psi.

source
TeNLib.sweepcountMethod
function sweepcount(engine::TDVPEngine)

Returns the number of sweeps performed.

source
TeNLib.getenergyMethod
function getenergy(engine::TDVPEngine)

Returns the energy of the state psi.

source
TeNLib.getentropyMethod
function getentropy(engine::TDVPEngine)

Returns the mid-chain entropy of the state psi.

source
TeNLib.maxchiMethod
function maxchi(engine::TDVPEngine)

Returns the maximum bond/link dimension of the state psi.

source
TeNLib.totalerrorMethod
function totalerror(engine::TDVPEngine)

Returns the sum of the truncation errors of all the sweeps performed.

source
TeNLib.sweeperrorMethod
function sweeperror(engine::TDVPEngine)

Returns the truncation error in the last sweep.

source
TeNLib.krylov_extend!Method
function krylov_extend!(engine::TDVPEngine{ProjMPO}; kwargs...)

Performs Global Subspace Expansion.

Arguments and their default values:

  • extension_krylovdim::Int = 3: Number of Krylov vectors used for GSE.
  • extension_applyH_cutoff::Float64 = Float64_threshold(): Cutoff for the application the MPO to the MPS.
  • extension_applyH_maxdim::Int = maxlinkdim(psi) + 1: Maximum bond/link dimension of the resulting MPS after the application of the MPO to the MPS.
  • extension_cutoff::Float64 = 1E-10: Cutoff for the basis extension step in GSE.
source
TeNLib.sweepdataMethod
function sweepdata(engine::TDVPEngine)

Returns the (shallow copy of) SweepData.

source
TeNLib.abstimeMethod
function abstime(engine::TDVPEngine)

Returns the absolute elapsed time.

source
TeNLib.updateH!Method
function updateH!(engine::TDVPEngine, H::T;
-                  recalcEnv::Bool = true) where T <: Union{MPO, Vector{MPO}, CouplingModel}

Update Hamiltonian H in engine::TDVPEngine. If recalcEnv = false, it reuses previous environments. recalcEnv = false is only defined when the TDVPEngine is created from a single MPO.

source
TeNLib.updateH!Method
function updateH!(engine::TDVPEngine, H::T, Ms::Vector{MPS};
+                                     ProjCouplingModel_MPS}}

Holds the MPS state, SweepData, and absolute elpased time for TDVP simulations.

  • sysenv::StateEnvs: Holds the state psi and environments PH.
  • swdata::SweepData: Holds the historical data after each (full)sweep.
  • abstime::Float64: Absolute elapsed time.
source
TeNLib.TDVPEngineMethod
function TDVPEngine(psi::MPS, H::{T}) where T <: Union{MPO, Vector{MPO}, CouplingModel}

Constructor of the TDVPEngine from different forms of Hamiltonians.

source
TeNLib.TDVPEngineMethod
function TDVPEngine(psi::MPS, H::T, Ms::Vector{MPS};
+                    weight::Float64) where T <: Union{MPO, Vector{MPO}, CouplingModel}

Constructor of TDVPEngine from different forms of Hamiltonians and a vector of MPS.

source
TeNLib.getpsiMethod
function getpsi(engine::TDVPEngine)

Returns (shallow copy of) the state psi.

source
TeNLib.sweepcountMethod
function sweepcount(engine::TDVPEngine)

Returns the number of sweeps performed.

source
TeNLib.getenergyMethod
function getenergy(engine::TDVPEngine)

Returns the energy of the state psi.

source
TeNLib.getentropyMethod
function getentropy(engine::TDVPEngine)

Returns the mid-chain entropy of the state psi.

source
TeNLib.maxchiMethod
function maxchi(engine::TDVPEngine)

Returns the maximum bond/link dimension of the state psi.

source
TeNLib.totalerrorMethod
function totalerror(engine::TDVPEngine)

Returns the sum of the truncation errors of all the sweeps performed.

source
TeNLib.sweeperrorMethod
function sweeperror(engine::TDVPEngine)

Returns the truncation error in the last sweep.

source
TeNLib.krylov_extend!Method
function krylov_extend!(engine::TDVPEngine{ProjMPO}; kwargs...)

Performs Global Subspace Expansion.

Arguments and their default values:

  • extension_krylovdim::Int = 3: Number of Krylov vectors used for GSE.
  • extension_applyH_cutoff::Float64 = Float64_threshold(): Cutoff for the application the MPO to the MPS.
  • extension_applyH_maxdim::Int = maxlinkdim(psi) + 1: Maximum bond/link dimension of the resulting MPS after the application of the MPO to the MPS.
  • extension_cutoff::Float64 = 1E-10: Cutoff for the basis extension step in GSE.
source
TeNLib.sweepdataMethod
function sweepdata(engine::TDVPEngine)

Returns the (shallow copy of) SweepData.

source
TeNLib.abstimeMethod
function abstime(engine::TDVPEngine)

Returns the absolute elapsed time.

source
TeNLib.updateH!Method
function updateH!(engine::TDVPEngine, H::T;
+                  recalcEnv::Bool = true) where T <: Union{MPO, Vector{MPO}, CouplingModel}

Update Hamiltonian H in engine::TDVPEngine. If recalcEnv = false, it reuses previous environments. recalcEnv = false is only defined when the TDVPEngine is created from a single MPO.

source
TeNLib.updateH!Method
function updateH!(engine::TDVPEngine, H::T, Ms::Vector{MPS};
                   weight::Float64,
-                  recalcEnv::Bool = true) where T <: Union{MPO, Vector{MPO}, CouplingModel}

Update Hamiltonian H in engine::TDVPEngine. recalcEnv = false is not supported.

source
Base.copyMethod
Base.copy(engine::TDVPEngine)

Shallow copy of TDVPEngine.

source

tdvpsweep!

Following function performs one TDVP sweep.

TeNLib.tdvpsweep!Function
tdvpsweep!(engine::TDVPEngine, time_step::Union{Float64, ComplexF64}; 
+                  recalcEnv::Bool = true) where T <: Union{MPO, Vector{MPO}, CouplingModel}

Update Hamiltonian H in engine::TDVPEngine. recalcEnv = false is not supported.

source
Base.copyMethod
Base.copy(engine::TDVPEngine)

Shallow copy of TDVPEngine.

source

tdvpsweep!

Following function performs one TDVP sweep.

TeNLib.tdvpsweep!Function
tdvpsweep!(engine::TDVPEngine, time_step::Union{Float64, ComplexF64}; 
            nsite::Union{Int, String} = "dynamic", 
            solver = exp_solver,
-           kwargs...)::Nothing

Performs one TDVP sweep. Computes ψ' = exp(time_step * H) * ψ. Therefore, for real-time dynamics with step dt, time_step should be -im * dt.

Arguments:

  • engine::TDVPEngine.
  • time_step::Union{Float64, ComplexF64}.
  • nsite::Union{Int, String} = "dynamic": For two or one site sweeps, nsite=2 or nsite=1 respectively. For nsite="dynamic", dynamic_fullsweep! is performed.
  • solver = exp_solver: Only exp_solver is supported now.

Named arguments and their default values:

  • normalize::Bool = true: Whether to normalize after update.
  • maxdim::Int = typemax(Int): Maximum bond dimension after SVD truncation.
  • mindim::Int = 1: Minimum bond dimension after SVD truncation.
  • cutoff::Float64 = Float64_threshold(): Cutoff for SVD truncation.
  • svd_alg::String = "divide_and_conquer".
  • outputlevel::Int = 1. If 0 prints no information, for 1 outputs after every fullsweep, if 2 prints at every update step.
  • eigthreshold::Float64 = 1E-12. Only applicable for nsite = "dynamic" (see dynamic_fullsweep!).
  • extendat::Union{Nothing, Int} = nothing: If specified, at every extendatth sweep, Global Subspace Expansion is performed followed by a pure one-site sweep if typeof(sysenv) == StateEnvs{ProjMPO}, else performs a full two-site sweep. Only applicable for nsite = "dynamic" (see dynamic_fullsweep!).

Named arguments for solver and their default values:

See the documentation of KrylovKit.jl.

  • ishermitian::Bool = true.
  • solver_tol::Float64 = 1E-12.
  • solver_krylovdim::Int = 30.
  • solver_maxiter::Int = 100.
  • solver_outputlevel::Int = 0.: See verbosity in KrylovKit.jl.
  • solver_eager::Bool = true.
  • solver_check_convergence::Bool = true.

Arguments for Global Subspace Expansion and their default values:

Only applicable for nsite = "dynamic" (see dynamic_fullsweep!).

  • extension_krylovdim::Int = 3: Number of Krylov vectors used for GSE.
  • extension_applyH_cutoff::Float64 = Float64_threshold(): Cutoff for the application the MPO to the MPS.
  • extension_applyH_maxdim::Int = maxlinkdim(psi) + 1: Maximum bond/link dimension of the resulting MPS after the application of the MPO to the MPS.
  • extension_cutoff::Float64 = 1E-10: Cutoff for the basis extension step in GSE.
source
+ kwargs...)::Nothing

Performs one TDVP sweep. Computes ψ' = exp(time_step * H) * ψ. Therefore, for real-time dynamics with step dt, time_step should be -im * dt.

Arguments:

Named arguments and their default values:

Named arguments for solver and their default values:

See the documentation of KrylovKit.jl.

Arguments for Global Subspace Expansion and their default values:

Only applicable for nsite = "dynamic" (see dynamic_fullsweep!).

source diff --git a/dev/mps/update_site/index.html b/dev/mps/update_site/index.html index 2ecace1..f392673 100644 --- a/dev/mps/update_site/index.html +++ b/dev/mps/update_site/index.html @@ -1,2 +1,2 @@ -Perform local updates · TeNLib.jl

Perform local updates

At the lowest-level of abstraction, TeNLib.jl allows for updating the StateEnvs for each sites/bonds manually.

Skip this part if you want to avoid lower-level abstraction.

TeNLib.update_position!Method
update_position!(sysenv::StateEnvs, solver, pos::Int, nsite::Int, ortho::String; kwargs...)

Updates StateEnvs at position pos by solver.

Arguments:

  • sysenv::StateEnvs
  • solver: Solver for update. Available ones: eig_solver and exp_solver.
  • pos::Int: Position of the bond (nsite=2) or site (nsite=1).
  • nsite of the environment. Either 1 or 2 for one-site or two-site update respectively.
  • ortho::String: Direction of the sweep. Either "left" or "right".

Named arguments and their default values:

  • time_step::Union{Float64, ComplexF64, Nothing} = nothing: Time step for TDVP.
  • normalize::Bool = true: Whether to normalize after update.
  • maxdim::Int = typemax(Int): Maximum bond dimension after SVD truncation.
  • mindim::Int = 1: Minimum bond dimension after SVD truncation.
  • cutoff::Float64 = Float64_threshold(): Cutoff for SVD truncation.
  • svd_alg::String = "divide_and_conquer".
  • noise::Float64 = 0.0.
  • reverse_step::Bool = false if time_step = nothing, true otherwise.

Named arguments for solver and their default values:

See the documentation of KrylovKit.jl.

  • ishermitian::Bool = true.
  • solver_tol::Float64 = 1E-14 if eig_solver, 1E-12 if exp_solver.
  • solver_krylovdim::Int = 5 if eig_solver, 30 if exp_solver.
  • solver_maxiter::Int = 2 if eig_solver, 100 if exp_solver.
  • solver_outputlevel::Int = 0: See verbosity in KrylovKit.jl.
  • solver_eager::Bool = false if eig_solver, true if exp_solver.
  • solver_check_convergence::Bool = false if eig_solver, true if exp_solver.

Return values:

  • ::Float64: Energy.
  • ::Float64: Truncation Error.
  • ::Vector{Float64}: SVD spectrum.
source
+Perform local updates · TeNLib.jl

Perform local updates

At the lowest-level of abstraction, TeNLib.jl allows for updating the StateEnvs for each sites/bonds manually.

Skip this part if you want to avoid lower-level abstraction.

TeNLib.update_position!Method
update_position!(sysenv::StateEnvs, solver, pos::Int, nsite::Int, ortho::String; kwargs...)

Updates StateEnvs at position pos by solver.

Arguments:

  • sysenv::StateEnvs
  • solver: Solver for update. Available ones: eig_solver and exp_solver.
  • pos::Int: Position of the bond (nsite=2) or site (nsite=1).
  • nsite of the environment. Either 1 or 2 for one-site or two-site update respectively.
  • ortho::String: Direction of the sweep. Either "left" or "right".

Named arguments and their default values:

  • time_step::Union{Float64, ComplexF64, Nothing} = nothing: Time step for TDVP.
  • normalize::Bool = true: Whether to normalize after update.
  • maxdim::Int = typemax(Int): Maximum bond dimension after SVD truncation.
  • mindim::Int = 1: Minimum bond dimension after SVD truncation.
  • cutoff::Float64 = Float64_threshold(): Cutoff for SVD truncation.
  • svd_alg::String = "divide_and_conquer".
  • noise::Float64 = 0.0.
  • reverse_step::Bool = false if time_step = nothing, true otherwise.

Named arguments for solver and their default values:

See the documentation of KrylovKit.jl.

  • ishermitian::Bool = true.
  • solver_tol::Float64 = 1E-14 if eig_solver, 1E-12 if exp_solver.
  • solver_krylovdim::Int = 5 if eig_solver, 30 if exp_solver.
  • solver_maxiter::Int = 2 if eig_solver, 100 if exp_solver.
  • solver_outputlevel::Int = 0: See verbosity in KrylovKit.jl.
  • solver_eager::Bool = false if eig_solver, true if exp_solver.
  • solver_check_convergence::Bool = false if eig_solver, true if exp_solver.

Return values:

  • ::Float64: Energy.
  • ::Float64: Truncation Error.
  • ::Vector{Float64}: SVD spectrum.
source
diff --git a/dev/ttn/example_optimize/index.html b/dev/ttn/example_optimize/index.html index af8e2fe..552e5ce 100644 --- a/dev/ttn/example_optimize/index.html +++ b/dev/ttn/example_optimize/index.html @@ -53,4 +53,4 @@ # Alternatively, take the psi from `StateEnvsTTN` itself. # NOTE: This can crash the simulation, if the TTN is modified (e.g., in measurements) # and `StateEnvsTTN` is going to be updated later. -# psi1 = sysenv_ex.psi +# psi1 = sysenv_ex.psi diff --git a/dev/ttn/measure_ttn/index.html b/dev/ttn/measure_ttn/index.html index a08d2b7..7081a86 100644 --- a/dev/ttn/measure_ttn/index.html +++ b/dev/ttn/measure_ttn/index.html @@ -1,4 +1,4 @@ -Measuring the TTN · TeNLib.jl

Measuring the TTN

TeNLib.measureMethod
function measure(::Type{ElT} = ComplexF64, psi::TTN, opten::ITensor)

Returns (complex / real) local expectation value (::ComplexF64 / ::Float64) of a given TTN psi::TTN. The operator opten::ITensor must be single-site operator.

For ElT = Float64, if the expectation value is complex, raises a warning!

source
TeNLib.measureMethod
function measure(::Type{ElT} = ComplexF64, psi::TTN, opstr::String, pos::Int)

Returns (complex / real) local expectation value (::ComplexF64 / ::Float64) of a given TTN psi::TTN for a given operator name (opstr::String) and a site index (pos::Int)

For ElT = Float64, if the expectation value is complex, raises a warning!

source
TeNLib.measureMethod
function measure(::Type{ElT} = ComplexF64, psi::TTN, opstr::String; kwargs...)

Returns (complex / real) local expectation values (::Vector{ComplexF64} / ::Vector{Float64}) of a given TTN psi::TTN for a given operator name (opstr::String) at all the sites.

Optionally, for specific sites, keyword argument sites can be specified, e.g., sites = [1, 2, 3].

For ElT = Float64, if the expectation value is complex, raises a warning!

source
TeNLib.measureMethod
function measure(::Type{ElT} = ComplexF64, psi::TTN, optens::Vector{ITensor})

Returns (complex / real) multi-site expectation value (::ComplexF64 / ::Float64) of a given TTN psi::TTN for a given vector of single-site operators (optens::Vector{ITensor}).

For ElT = Float64, if the expectation value is complex, raises a warning!

source
TeNLib.measureMethod
function measure(::Type{ElT} = ComplexF64, psi::TTN, oppairs::Vector{Pair{String, Int}};
+Measuring the TTN · TeNLib.jl

Measuring the TTN

TeNLib.measureMethod
function measure(::Type{ElT} = ComplexF64, psi::TTN, opten::ITensor)

Returns (complex / real) local expectation value (::ComplexF64 / ::Float64) of a given TTN psi::TTN. The operator opten::ITensor must be single-site operator.

For ElT = Float64, if the expectation value is complex, raises a warning!

source
TeNLib.measureMethod
function measure(::Type{ElT} = ComplexF64, psi::TTN, opstr::String, pos::Int)

Returns (complex / real) local expectation value (::ComplexF64 / ::Float64) of a given TTN psi::TTN for a given operator name (opstr::String) and a site index (pos::Int)

For ElT = Float64, if the expectation value is complex, raises a warning!

source
TeNLib.measureMethod
function measure(::Type{ElT} = ComplexF64, psi::TTN, opstr::String; kwargs...)

Returns (complex / real) local expectation values (::Vector{ComplexF64} / ::Vector{Float64}) of a given TTN psi::TTN for a given operator name (opstr::String) at all the sites.

Optionally, for specific sites, keyword argument sites can be specified, e.g., sites = [1, 2, 3].

For ElT = Float64, if the expectation value is complex, raises a warning!

source
TeNLib.measureMethod
function measure(::Type{ElT} = ComplexF64, psi::TTN, optens::Vector{ITensor})

Returns (complex / real) multi-site expectation value (::ComplexF64 / ::Float64) of a given TTN psi::TTN for a given vector of single-site operators (optens::Vector{ITensor}).

For ElT = Float64, if the expectation value is complex, raises a warning!

source
TeNLib.measureMethod
function measure(::Type{ElT} = ComplexF64, psi::TTN, oppairs::Vector{Pair{String, Int}};
                  isfermions::Bool = true)

Returns (complex / real) multi-site expectation value (::ComplexF64 / ::Float64) of a given TTN psi::TTN. oppairs::Vector{Pair{String, Int}} contains pairs of operator names (String) and site locations (Int). E.g., for <ψ|OᵢOⱼOₖ... |ψ>, oppairs = ["O" => i, "O" => j, "O" => k,...].

Fermionic JW strings are added automatically for fermionic operators if isfermions::Bool = true (default).

For ElT = Float64, if the expectation value is complex, raises a warning!

Example:

valueC = measure(psi, ["Cdag" => 2, "C" => 6, "Cdag" => 9, "C" => 12])
-valueR = measure(Float64, psi, ["Cdag" => 2, "C" => 6, "Cdag" => 9, "C" => 12])
source
+valueR = measure(Float64, psi, ["Cdag" => 2, "C" => 6, "Cdag" => 9, "C" => 12])
source
diff --git a/dev/ttn/optimize_ttn/index.html b/dev/ttn/optimize_ttn/index.html index 0ab3937..a1c363d 100644 --- a/dev/ttn/optimize_ttn/index.html +++ b/dev/ttn/optimize_ttn/index.html @@ -6,14 +6,14 @@ noise::Vector{Float64} noisedecay::Vector{Float64} disable_noise_after::Vector{Int} -end

Holds parameters to control the optimzation sweeps of the TTN.

Noise is divided by noisedecay after each sweep.

states of optimization.

All these Vectors must have same dimension.

source
TeNLib.OptimizeParamsTTNMethod
function OptimizeParamsTTN(;maxdim::Vector{Int}, nsweeps::Vector{Int}, 
+end

Holds parameters to control the optimzation sweeps of the TTN.

  • maxdim::Vector{Int}: Maximum allowed TTN bond/link dimensions at each stages of optimization.
  • nsweeps::Vector{Int}: Number of sweeps to be performed at each statges of optimization.
  • cutoff::Vector{Float64}: Cutoff for SVD truncation at each stages of optimization.
  • noise::Vector{Float64}: Noise level at each stages of optimization.
  • noisedecay::Vector{Float64}: Decay of noise level at each states of optimization.

Noise is divided by noisedecay after each sweep.

  • disable_noise_after::Vector{Int}: Switch of noise after this many sweeps at each

states of optimization.

All these Vectors must have same dimension.

source
TeNLib.OptimizeParamsTTNMethod
function OptimizeParamsTTN(;maxdim::Vector{Int}, nsweeps::Vector{Int}, 
                            cutoff::Union{Vector{Float64}, Float64} = Float64_threshold(),
                            noise::Union{Vector{Float64}, Float64, Int} = 0.0,
                            noisedecay::Union{Vector{Float64}, Float64, Int} = 1.0,
-                           disable_noise_after::Union{Vector{Int}, Int} = typemax(Int))

Constructor for OptimizeParamsTTN. Takes named arguments.

  • maxdim::Vector{Int}: Maximum allowed TTN bond/link dimensions at each stages of optimization.
  • nsweeps::Vector{Int}: Number of sweeps to be performed at each statges of optimization.
  • cutoff::Union{Float64, Vector{Float64}} = Float64_threshold(): Cutoff for SVD truncation at each stages of optimization. If Float64, cutoff remains same throughout the optimization simulation.
  • noise::Union{Float64, Int, Vector{Float64}} = 0.0: Noise level at each stages of optimization. If Float64 / Int, initial noise remains same throughout the optimization.
  • noisedecay::Union{Float64, Int, Vector{Float64}} = 1.0: Decay of noise level at each states of optimization. Noise is divided by noisedecay after each sweep. If Float64 / Int, noisedecay remains same throughout the DMRG simulation.
  • disable_noise_after::Union{Int, Vector{Int}} = typemax(Int): Switch of noise after this many sweeps at each states of optimization. If Int, disable_noise_after remains same throughout the optimization.
source
Base.copyMethod
Base.copy(params::OptimizeParamsTTN)

Shallow copy OptimizeParamsTTN.

source

A lower level optimization function

Following function modifies StateEnvsTTN in-place. Skip this function if you want to avoid lower-level abstraction.

TeNLib.optimize!Method
function optimize!(sysenv::StateEnvsTTN,
+                           disable_noise_after::Union{Vector{Int}, Int} = typemax(Int))

Constructor for OptimizeParamsTTN. Takes named arguments.

  • maxdim::Vector{Int}: Maximum allowed TTN bond/link dimensions at each stages of optimization.
  • nsweeps::Vector{Int}: Number of sweeps to be performed at each statges of optimization.
  • cutoff::Union{Float64, Vector{Float64}} = Float64_threshold(): Cutoff for SVD truncation at each stages of optimization. If Float64, cutoff remains same throughout the optimization simulation.
  • noise::Union{Float64, Int, Vector{Float64}} = 0.0: Noise level at each stages of optimization. If Float64 / Int, initial noise remains same throughout the optimization.
  • noisedecay::Union{Float64, Int, Vector{Float64}} = 1.0: Decay of noise level at each states of optimization. Noise is divided by noisedecay after each sweep. If Float64 / Int, noisedecay remains same throughout the DMRG simulation.
  • disable_noise_after::Union{Int, Vector{Int}} = typemax(Int): Switch of noise after this many sweeps at each states of optimization. If Int, disable_noise_after remains same throughout the optimization.
source
Base.copyMethod
Base.copy(params::OptimizeParamsTTN)

Shallow copy OptimizeParamsTTN.

source

A lower level optimization function

Following function modifies StateEnvsTTN in-place. Skip this function if you want to avoid lower-level abstraction.

TeNLib.optimize!Method
function optimize!(sysenv::StateEnvsTTN,
                    params::OptimizeParamsTTN,
                    sweeppath::Vector{Int2};
-                   kwargs...)

Performs optimization of the TTN.

Arguments:

  • sysenv::StateEnvsTTN.
  • params::OptimizationParamsTTN.
  • sweeppath::Vector{Int2}: The path to be followed during optimization sweep. A vector that must contain all the nodes atleast once.

Named arguments and their default values:

  • normalize::Bool = true: Whether to normalize after update.
  • svd_alg::String = "divide_and_conquer".
  • weight::Float64 = -1.0: Weight for the excited state calculation. Must be set to greater than 0 for the excited state optimization.
  • outputlevel::Int = 1. If 0 prints no information, for 1 outputs after every fullsweep, if 2 prints at every update step.

Convergence criteria:

  • energyErrGoal: Optimization (at a particluar stage) stops when energy difference between two consecutive sweeps falls below this threshold and the optimzation moves to the next stage. noise must be below Float64_threshold() to trigger this early stopping.

Named arguments for eig_solver and their default values:

See documentation of KrylovKit.jl.

  • ishermitian::Bool = true
  • solver_tol::Float64 = 1E-14.
  • solver_krylovdim::Int = 3.
  • solver_maxiter::Int = 1.
  • solver_outputlevel::Int = 0: See verbosity in KrylovKit.jl.
  • solver_eager::Bool = false.
  • solver_check_convergence::Bool = false.

Return values:

  • SweepDataTTN
source

Higher level optimzation functions

TeNLib.optimizeMethod
function optimize(psi0::TTN, H::CouplingModel,
+                   kwargs...)

Performs optimization of the TTN.

Arguments:

  • sysenv::StateEnvsTTN.
  • params::OptimizationParamsTTN.
  • sweeppath::Vector{Int2}: The path to be followed during optimization sweep. A vector that must contain all the nodes atleast once.

Named arguments and their default values:

  • normalize::Bool = true: Whether to normalize after update.
  • svd_alg::String = "divide_and_conquer".
  • weight::Float64 = -1.0: Weight for the excited state calculation. Must be set to greater than 0 for the excited state optimization.
  • outputlevel::Int = 1. If 0 prints no information, for 1 outputs after every fullsweep, if 2 prints at every update step.

Convergence criteria:

  • energyErrGoal: Optimization (at a particluar stage) stops when energy difference between two consecutive sweeps falls below this threshold and the optimzation moves to the next stage. noise must be below Float64_threshold() to trigger this early stopping.

Named arguments for eig_solver and their default values:

See documentation of KrylovKit.jl.

  • ishermitian::Bool = true
  • solver_tol::Float64 = 1E-14.
  • solver_krylovdim::Int = 3.
  • solver_maxiter::Int = 1.
  • solver_outputlevel::Int = 0: See verbosity in KrylovKit.jl.
  • solver_eager::Bool = false.
  • solver_check_convergence::Bool = false.

Return values:

  • SweepDataTTN
source

Higher level optimzation functions

TeNLib.optimizeMethod
function optimize(psi0::TTN, H::CouplingModel,
                   params::OptimizeParamsTTN,
                   sweeppath::Vector{Int2};
                   kwargs...)
@@ -21,4 +21,4 @@
 function optimize(psi0::TTN, H::CouplingModel, Ms::Vector{TTN},
                   params::OptimizeParamsTTN,
                   sweeppath::Vector{Int2};
-                  kwargs...)

Performs optimization of the TTN.

Arguments:

  • psi0::TTN: Initial TTN.
  • H::CouplingModel, Ms::Vector{MPS}.
  • params::OptimizationParamsTTN.
  • sweeppath::Vector{Int2}: The path to be followed during optimization sweep. A vector that must contain all the nodes atleast once.

Named arguments and their default values:

  • normalize::Bool = true: Whether to normalize after update.
  • svd_alg::String = "divide_and_conquer".
  • weight::Float64 = -1.0: Weight for the excited state calculation. Must be set to greater than 0 for the excited state optimization.
  • outputlevel::Int = 1. If 0 prints no information, for 1 outputs after every fullsweep, if 2 prints at every update step.

Convergence criteria:

  • energyErrGoal: Optimization (at a particluar stage) stops when energy difference between two consecutive sweeps falls below this threshold and the optimzation moves to the next stage. noise must be below Float64_threshold() to trigger this early stopping.

Named arguments for eig_solver and their default values:

See documentation of KrylovKit.jl.

  • ishermitian::Bool = true
  • solver_tol::Float64 = 1E-14.
  • solver_krylovdim::Int = 3.
  • solver_maxiter::Int = 1.
  • solver_outputlevel::Int = 0: See verbosity in KrylovKit.jl.
  • solver_eager::Bool = false.
  • solver_check_convergence::Bool = false.

Return values:

  • ::Float64: Energy.
  • ::TTN: The state psi.
source
+ kwargs...)

Performs optimization of the TTN.

Arguments:

Named arguments and their default values:

Convergence criteria:

Named arguments for eig_solver and their default values:

See documentation of KrylovKit.jl.

Return values:

source diff --git a/dev/ttn/state_envs_ttn/index.html b/dev/ttn/state_envs_ttn/index.html index 531a052..968d7a0 100644 --- a/dev/ttn/state_envs_ttn/index.html +++ b/dev/ttn/state_envs_ttn/index.html @@ -3,9 +3,9 @@ EnvCouplingModelProjTTN}} psi::TTN{T1} env::T{T2} -end

Holds the TTN and the environment.

source
TeNLib.StateEnvsTTNMethod
function StateEnvsTTN(psi::TTN, H::CouplingModel)

Constructor of the StateEnvsTTN from a CouplingModel. Each terms in the CouplingModel are contracted in parallel.

source
TeNLib.StateEnvsTTNMethod
function StateEnvsTTN(psi::TTN, H::CouplingModel, Ms::Vector{TTN}; weight::Float64)

Constructor of StateEnvsTTN from a CouplingModel and a vector of TTN used for excited state search. Each terms in the CouplingModel are contracted in parallel.

source
TeNLib.getpsiMethod
function getpsi(sysenv::StateEnvsTTN)

Returns (shallow copy of) the state psi.

source
TeNLib.getenvMethod
function getenv(sysenv::StateEnvsTTN)

Returns (shallow copy of) the environment env.

source
ITensors.position!Method
function position!(sysenv::StateEnvsTTN, node::Int2;
+end

Holds the TTN and the environment.

source
TeNLib.StateEnvsTTNMethod
function StateEnvsTTN(psi::TTN, H::CouplingModel)

Constructor of the StateEnvsTTN from a CouplingModel. Each terms in the CouplingModel are contracted in parallel.

source
TeNLib.StateEnvsTTNMethod
function StateEnvsTTN(psi::TTN, H::CouplingModel, Ms::Vector{TTN}; weight::Float64)

Constructor of StateEnvsTTN from a CouplingModel and a vector of TTN used for excited state search. Each terms in the CouplingModel are contracted in parallel.

source
TeNLib.getpsiMethod
function getpsi(sysenv::StateEnvsTTN)

Returns (shallow copy of) the state psi.

source
TeNLib.getenvMethod
function getenv(sysenv::StateEnvsTTN)

Returns (shallow copy of) the environment env.

source
ITensors.position!Method
function position!(sysenv::StateEnvsTTN, node::Int2;
                    maxdim::Int = typemax(Int),
                    mindim::Int = 1,
                    cutoff::Float64 = _Float64_Threshold,
                    svd_alg::String = "divide_and_conquer",
-                   normalize::Bool = true)

Moves the orthogonality center of the TTN to node and updates the effective Hamiltonian of the same.

Named arguments and their default values:

  • normalize::Bool = true: Whether to normalize afterwards.
  • maxdim::Int = typemax(Int): Maximum bond dimension after SVD truncation.
  • mindim::Int = 1: Minimum bond dimension after SVD truncation.
  • cutoff::Float64 = Float64_threshold(): Cutoff for SVD truncation.
  • svd_alg::String = "divide_and_conquer".
source
TeNLib.productMethod
function product(sysenv::StateEnvsTTN, v::ITensor)

Returns the Matrix-Vector product between the environment and input ITensor v.

source
Base.copyMethod
function Base.copy(sysenv::StateEnvsTTN)

Shallow copy of StateEnvsTTN.

source
+ normalize::Bool = true)

Moves the orthogonality center of the TTN to node and updates the effective Hamiltonian of the same.

Named arguments and their default values:

source
TeNLib.productMethod
function product(sysenv::StateEnvsTTN, v::ITensor)

Returns the Matrix-Vector product between the environment and input ITensor v.

source
Base.copyMethod
function Base.copy(sysenv::StateEnvsTTN)

Shallow copy of StateEnvsTTN.

source
diff --git a/dev/ttn/sweep_ttn/index.html b/dev/ttn/sweep_ttn/index.html index fc4b5e5..d9228a4 100644 --- a/dev/ttn/sweep_ttn/index.html +++ b/dev/ttn/sweep_ttn/index.html @@ -3,5 +3,5 @@ sweepcount::Int maxchi::Vector{Int} energy::Vector{Float64} -end

Holds historical data after each (full)sweep of the TTN. Requires for convergence check etc.

Default constructor:

source
Base.copyMethod
Base.copy(swdata::SweepDataTTN)

Shallow copy of SweepDataTTN.

source

sweeppath

TeNLib.default_sweeppathFunction
function default_sweeppath(psi::TTN)

For a given a TTN having the default hierarchical binary tree structure, teturns the default path for sweeping through the TTN.

Return values:

  • Vector{Int2}: The list of nodes as the path to be followed during a (half)sweep.
source

Perform a fullsweep

TeNLib.fullsweep!Method
function fullsweep!(sysenv::StateEnvsTTN, sweeppath::Vector{Int2}, solver,
-                    swdata::SweepDataTTN; kwargs...)

Perform a fullsweep of the TTN by solver.

Arguments:

  • sysenv::StateEnvsTTN.
  • sweeppath::Vector{Int2}: The list of nodes as the path to be followed during a (half)sweep. Must have each node atleast once. For the next halfsweep the reverse path is followed.
  • solver: Solver for update. Currently only eig_solver is supported.
  • swdata::SweepDataTTN.

Named arguments and their default values:

  • time_step::Union{Float64, ComplexF64, Nothing} = nothing: Time step for future functionality.
  • normalize::Bool = true: Whether to normalize after update.
  • maxdim::Int = typemax(Int): Maximum bond dimension after SVD truncation.
  • mindim::Int = 1: Minimum bond dimension after SVD truncation.
  • cutoff::Float64 = Float64_threshold(): Cutoff for SVD truncation.
  • svd_alg::String = "divide_and_conquer".
  • noise::Float64 = 0.0.
  • expand_dim::Int = 0 if noise == 0 else 20. Dimension to be expanded (on top of maxdim) during subspace expansion.
  • max_expand_dim::Int = 2 * expand_dim. maximum dimension to be expanded during subspace expansion.
  • expand_numiter::Int = 4. Number of iteration for subspace expansion. Should be greater than 1.
  • linkwise_maxdim::Union{Nothing, Dict{LinkTypeTTN, Int}} = nothing. Specifies maximum bond dimension of a particular link.
  • outputlevel::Int = 1. If 0 prints no information, for 1 outputs after every fullsweep, if 2 prints at every update step.

Named arguments for solver and their default values:

See the documentation of KrylovKit.jl.

  • ishermitian::Bool = true.
  • solver_tol::Float64 = 1E-14.
  • solver_krylovdim::Int = 5.
  • solver_maxiter::Int = 2.
  • solver_outputlevel::Int = 0: See verbosity in KrylovKit.jl.
  • solver_eager::Bool = false.
  • solver_check_convergence::Bool = false.

Return values:

  • ::Float64: Change in Energy ΔE

swdata::SweepDataTTN gets updated.

source
+end

Holds historical data after each (full)sweep of the TTN. Requires for convergence check etc.

Default constructor:

source
Base.copyMethod
Base.copy(swdata::SweepDataTTN)

Shallow copy of SweepDataTTN.

source

sweeppath

TeNLib.default_sweeppathFunction
function default_sweeppath(psi::TTN)

For a given a TTN having the default hierarchical binary tree structure, teturns the default path for sweeping through the TTN.

Return values:

  • Vector{Int2}: The list of nodes as the path to be followed during a (half)sweep.
source

Perform a fullsweep

TeNLib.fullsweep!Method
function fullsweep!(sysenv::StateEnvsTTN, sweeppath::Vector{Int2}, solver,
+                    swdata::SweepDataTTN; kwargs...)

Perform a fullsweep of the TTN by solver.

Arguments:

  • sysenv::StateEnvsTTN.
  • sweeppath::Vector{Int2}: The list of nodes as the path to be followed during a (half)sweep. Must have each node atleast once. For the next halfsweep the reverse path is followed.
  • solver: Solver for update. Currently only eig_solver is supported.
  • swdata::SweepDataTTN.

Named arguments and their default values:

  • time_step::Union{Float64, ComplexF64, Nothing} = nothing: Time step for future functionality.
  • normalize::Bool = true: Whether to normalize after update.
  • maxdim::Int = typemax(Int): Maximum bond dimension after SVD truncation.
  • mindim::Int = 1: Minimum bond dimension after SVD truncation.
  • cutoff::Float64 = Float64_threshold(): Cutoff for SVD truncation.
  • svd_alg::String = "divide_and_conquer".
  • noise::Float64 = 0.0.
  • expand_dim::Int = 0 if noise == 0 else 20. Dimension to be expanded (on top of maxdim) during subspace expansion.
  • max_expand_dim::Int = 2 * expand_dim. maximum dimension to be expanded during subspace expansion.
  • expand_numiter::Int = 4. Number of iteration for subspace expansion. Should be greater than 1.
  • linkwise_maxdim::Union{Nothing, Dict{LinkTypeTTN, Int}} = nothing. Specifies maximum bond dimension of a particular link.
  • outputlevel::Int = 1. If 0 prints no information, for 1 outputs after every fullsweep, if 2 prints at every update step.

Named arguments for solver and their default values:

See the documentation of KrylovKit.jl.

  • ishermitian::Bool = true.
  • solver_tol::Float64 = 1E-14.
  • solver_krylovdim::Int = 5.
  • solver_maxiter::Int = 2.
  • solver_outputlevel::Int = 0: See verbosity in KrylovKit.jl.
  • solver_eager::Bool = false.
  • solver_check_convergence::Bool = false.

Return values:

  • ::Float64: Change in Energy ΔE

swdata::SweepDataTTN gets updated.

source
diff --git a/dev/ttn/ttn/index.html b/dev/ttn/ttn/index.html index 419c920..ecc227f 100644 --- a/dev/ttn/ttn/index.html +++ b/dev/ttn/ttn/index.html @@ -1,5 +1,5 @@ -Tree Tensor Networks · TeNLib.jl

Tree Tensor Networks (TTN)

Tree Tensor Network (TTN) is a loop-free hierarchical tensor network (see belew).

Tree Tensor Network for a system of size 16
Tree Tensor Network

Due to enhanced connectivity in the structure of TTN, it can support long-range quantum correlations comapred to MPS. Moreover, simulations for systems with periodic boundary conditions (PBC) are almost as efficient as the same with open boundary conditions (OBC). TTNs have found their place for simulating 2D or pseudo-2D ladder/cylinder systems with PBC where the performance of MPS is not adequate.

TeNLib.jl implements the unconstrained optimization for obtaining ground as well as excited states as described in Phys. Rev. B 90, 125154 (2014) and SciPost Phys. Lect. Notes 8 (2019).


Each tensor in the TTN are indexed by a pair (Tuple) of Ints = (ll, nn).

In the default scenario, ll denotes the layer index and nn denotes the tensor index at each layer (see the image above). The counting for ll, in the default case, starts at the bottom (towards to top level), while nn counts from left. The structure of the network is defined by a Graph{Int2} object. The link / bond between two neighboring nodes is denoted by a LinkTypeTTN object, an unordered pair of Int2s.

TeNLib.LinkTypeTTNType
struct LinkTypeTTN
+Tree Tensor Networks · TeNLib.jl

Tree Tensor Networks (TTN)

Tree Tensor Network (TTN) is a loop-free hierarchical tensor network (see belew).

Tree Tensor Network for a system of size 16
Tree Tensor Network

Due to enhanced connectivity in the structure of TTN, it can support long-range quantum correlations comapred to MPS. Moreover, simulations for systems with periodic boundary conditions (PBC) are almost as efficient as the same with open boundary conditions (OBC). TTNs have found their place for simulating 2D or pseudo-2D ladder/cylinder systems with PBC where the performance of MPS is not adequate.

TeNLib.jl implements the unconstrained optimization for obtaining ground as well as excited states as described in Phys. Rev. B 90, 125154 (2014) and SciPost Phys. Lect. Notes 8 (2019).


Each tensor in the TTN are indexed by a pair (Tuple) of Ints = (ll, nn).

In the default scenario, ll denotes the layer index and nn denotes the tensor index at each layer (see the image above). The counting for ll, in the default case, starts at the bottom (towards to top level), while nn counts from left. The structure of the network is defined by a Graph{Int2} object. The link / bond between two neighboring nodes is denoted by a LinkTypeTTN object, an unordered pair of Int2s.

TeNLib.LinkTypeTTNType
struct LinkTypeTTN
     first::Int2
     second::Int2
-end

Link / bond between two nodes first and second.

source
Info

The order of the nodes inside LinkTypeTTN is irrelevant, i.e., LinkTypeTTN(node1, node2) == LinkTypeTTN(node2, node1).


Info

TeNLib.jl can automatically handle system-sizes that are not powers of 2. No special care is needed for such system-sizes.

TTN for system-size 12TTN for system-size 14
Sites 1, 4, 7, 11 are directly connected to ll=2 tensorsSites 5, 12 are directly connected to ll=2 tensors
Nodes (1,1), (1,3), (1,5), (1,7) are removedNodes (1,3), (1,7) are removed
TTN size 12TTN size 14
Info

The TTN codes defined in TeNLib.jl can readily work, without any changes, for any loop-free tensor networks, e.g., Fork Tensor Networks.

Tip

For 2D systems, use a mapping from the 2D lattice to a 1D chain using Hilbert curve, as shown in Quantum 5, 556 (2021)

+end

Link / bond between two nodes first and second.

source
Info

The order of the nodes inside LinkTypeTTN is irrelevant, i.e., LinkTypeTTN(node1, node2) == LinkTypeTTN(node2, node1).


Info

TeNLib.jl can automatically handle system-sizes that are not powers of 2. No special care is needed for such system-sizes.

TTN for system-size 12TTN for system-size 14
Sites 1, 4, 7, 11 are directly connected to ll=2 tensorsSites 5, 12 are directly connected to ll=2 tensors
Nodes (1,1), (1,3), (1,5), (1,7) are removedNodes (1,3), (1,7) are removed
TTN size 12TTN size 14
Info

The TTN codes defined in TeNLib.jl can readily work, without any changes, for any loop-free tensor networks, e.g., Fork Tensor Networks.

Tip

For 2D systems, use a mapping from the 2D lattice to a 1D chain using Hilbert curve, as shown in Quantum 5, 556 (2021)

diff --git a/dev/ttn/ttn_gen/index.html b/dev/ttn/ttn_gen/index.html index 1e85548..07e0aee 100644 --- a/dev/ttn/ttn_gen/index.html +++ b/dev/ttn/ttn_gen/index.html @@ -1,10 +1,10 @@ -Generating TTN · TeNLib.jl

Generating TTN

TeNLib.jl defines following functions to generate TTNs with random entries.

For the standard TTN with the default hierarchical binary tree structure, follwoing function can be used.

TeNLib.default_randomTTNFunction
function default_randomTTN(sites::Vector{Index{T}}, chi::Int, qn::QN = QN()) where T

Returns a TTN object, having random elements, from site Indexs sites, initial bond dimension chi and (optional) global QN sector qn. The structure is a default hierarchical binary tree graph. Automatically handles situations where the number of sites is not a power of 2.

Note: For QN conserving TTN, the bond dimension might be off by one or two from chi.

source

The underlying default binary tree for the function above is generated by the following function.

TeNLib.default_graph_sitenodesMethod
function default_graph_sitenodes(N::Int)

Given the total number of sites, N::Int, generates the default hierarchical binary tree graph and a Dict{Int, Int2} object that maps each site to the corresponding node. Automatically handles situations where the number of sites is not a power of 2.

Return values:

  • ::Graph{Int2}: Default hierarchical tree graph to accomodate N number of sites in a TTN.
  • ::Dict{Int, Int2}: Maps each site to the corresponding node.

Example:

graph, sitenodes = default_graph_sitenodes(32)
+Generating TTN · TeNLib.jl

Generating TTN

TeNLib.jl defines following functions to generate TTNs with random entries.

For the standard TTN with the default hierarchical binary tree structure, follwoing function can be used.

TeNLib.default_randomTTNFunction
function default_randomTTN(sites::Vector{Index{T}}, chi::Int, qn::QN = QN()) where T

Returns a TTN object, having random elements, from site Indexs sites, initial bond dimension chi and (optional) global QN sector qn. The structure is a default hierarchical binary tree graph. Automatically handles situations where the number of sites is not a power of 2.

Note: For QN conserving TTN, the bond dimension might be off by one or two from chi.

source

The underlying default binary tree for the function above is generated by the following function.

TeNLib.default_graph_sitenodesMethod
function default_graph_sitenodes(N::Int)

Given the total number of sites, N::Int, generates the default hierarchical binary tree graph and a Dict{Int, Int2} object that maps each site to the corresponding node. Automatically handles situations where the number of sites is not a power of 2.

Return values:

  • ::Graph{Int2}: Default hierarchical tree graph to accomodate N number of sites in a TTN.
  • ::Dict{Int, Int2}: Maps each site to the corresponding node.

Example:

graph, sitenodes = default_graph_sitenodes(32)
 
 sitenodes[1] == (1,1) # true
 sitenodes[2] == (1,1) # tru
 sitenodes[3] == (1,2) # true
 sitenodes[4] == (1,2) # true
 sitenodes[31] == (1,16) # true
-sitenodes[32] == (1,16) # true
source

In the generic scenario, a random TTN with user-defined structure can be generated by the following function.

TeNLib.randomTTNFunction
function randomTTN(sites::Vector{Index{T}}, graph::Graph{Int2},
-                   sitenodes::Dict{Int, Int2}, chi::Int, qn::QN = QN()) where T

Returns a TTN object, having random elements, from site Indexs sites, the underlyting graph, sitenodes::Dict{Int, Int2} that maps each site to the corresponding node, initial bond dimension chi, and (optional) global QN sector qn. The structure is determined by the input graph object.

Note: This function can be used to generate any loop-free tensor network.

Note: For QN conserving TTN, the bond dimension might be off by one or two from chi.

source
Info

The above function can be used to generate any loop-free tensor network.

+sitenodes[32] == (1,16) # true
source

In the generic scenario, a random TTN with user-defined structure can be generated by the following function.

TeNLib.randomTTNFunction
function randomTTN(sites::Vector{Index{T}}, graph::Graph{Int2},
+                   sitenodes::Dict{Int, Int2}, chi::Int, qn::QN = QN()) where T

Returns a TTN object, having random elements, from site Indexs sites, the underlyting graph, sitenodes::Dict{Int, Int2} that maps each site to the corresponding node, initial bond dimension chi, and (optional) global QN sector qn. The structure is determined by the input graph object.

Note: This function can be used to generate any loop-free tensor network.

Note: For QN conserving TTN, the bond dimension might be off by one or two from chi.

source
Info

The above function can be used to generate any loop-free tensor network.

diff --git a/dev/ttn/ttn_struct/index.html b/dev/ttn/ttn_struct/index.html index ca39358..a69efb9 100644 --- a/dev/ttn/ttn_struct/index.html +++ b/dev/ttn/ttn_struct/index.html @@ -4,6 +4,6 @@ graph::Graph{Int2} tensors::Dict{Int2, ITensor} orthocenter::Int2 -end

Tree Tensor Network (TTN) object.

Each tensor is indexed by the tuple of integers (::Int2), (ll, nn), where (usually) ll denotes the layer index and nn denotes the tensor index at each layer.

source
ITensors.siteindsMethod
function ITensors.siteinds(ttn::TTN)

Returns the site Indexs of the TTN.

source
ITensors.siteindMethod
function ITensors.siteind(ttn::TTN, n::Int)

Returns the nth site Index of the TTN.

source
TeNLib.numsitesMethod
function numsites(ttn::TTN)

Returns the number of physical sites in the TTN.

source
TeNLib.getgraphMethod
function getgraph(ttn::TTN)

Returns (shallow copy of) the underlying graph of the TTN.

source
Base.getindexMethod
function Base.getindex(ttn::TTN, node::Int2)
-function Base.getindex(ttn::TTN, ll::Int, nn::Int)

Returns the tensor at the node::Int2 = (ll, nn).

source
Base.setindex!Method
function Base.setindex!(ttn::TTN, tensor::ITensor, node::Int2)
-function Base.setindex!(ttn::TTN, tensor::ITensor, ll::Int, nn::Int)

Sets the tensor at the node::Int2 = (ll, nn). If the node is not the orthogonality center, orthogonality center is set to (typemin(Int), typemin(Int)).

source
ITensors.orthocenterMethod
function orthocenter(ttn::TTN)

Returns the orthogonality center of the TTN.

source
Base.copyMethod
Base.copy(ttn::TTN)

Shallow copy of TTN.

source
TeNLib.isvalidnodeMethod
function isvalidnode(ttn::TTN, node::Int2)

Checks whether the input node::Int2 is a valid node in the TTN graph.

source
TeNLib.isneighborMethod
function isneighbor(ttn::TTN, node1::Int2, node2::Int2)

Checks whether node1 and node2 are neighboring nodes in the TTN.

source
ITensors.findsiteMethod
function ITensors.findsite(ttn::TTN, is)

Returns the first site of the TTN that has at least one Index in common with the Index or ITensor or their collection is.

source
ITensors.findsitesMethod
function ITensors.findsites(ttn::TTN, is)

Returns the sites of the TTN that have Indexs in common with the Index or ITensor or their collection is.

source
TeNLib.findnodeMethod
function findnode(ttn::TTN, is)

Returns the first node of the TTN that has at least one Index in common with the Index or ITensor or their collection is.

source
TeNLib.findnodesMethod
function findnodes(ttn::TTN, is)

Returns the nodes of the TTN that have Indexs in common with the Index or ITensor or their collection is.

source
TeNLib.find_sitenodeMethod
function find_sitenode(ttn::TTN, n::Int)

Return node of the TTN that is associated with the site n.

source
TeNLib.find_sitenodesMethod
function find_sitenodes(ttn::TTN, ns)

Returns nodes of the TTN that are associated with the sites ns (a collection of Ints).

source
ITensors.maxlinkdimMethod
function ITensors.maxlinkdim(ttn::TTN)

Returns the maximum bond/link dimension of the TTN.

source
LinearAlgebra.normalize!Method
function LinearAlgebra.normalize!(ttn::TTN)

Normalizes the TTN. The TTN must have well-defined orthogonality center.

source
Info

To conserve global symmetry in TTN, TeNLib.jl uses a dummy index of dimension one whose flux fixes the superselection sector. This dummy index is attached to one of the tensors of TTN, usually the eccentric central node. Unlike MPS, the fluxes of all tensors in TTN are zero.

ITensors.hasqnsMethod
function ITensors.hasqns(ttn::TTN)

Checks whether the TTN has QNs.

source
TeNLib.find_qnnodeMethod
function find_qnnode(ttn::TTN)

Returns the node where the a dummy QN Index is attached to fix the QN sector. Returns nothing if the TTN does not have QN.

source
TeNLib.moveisometry_to_next!Method
function moveisometry_to_next!(ttn::TTN, node1::Int2, node2::Int2; kwargs...)

Moves the isometry / orthogonality center of the TTN from node1::Int2 to the neighboring node2::Int. node1 and node2 must be neighboring nodes. node1 must be the orthogonality center unless ignore_orthocenter = true.

Note: Does not normalize the TTN afterwards.

Named arguments and their default values.

  • ignore_orthocenter::Bool = false: If set to true, node1 is not required to be the orthogonality center.
  • maxdim::Int = typemax(Int): Maximum bond dimension after SVD truncation.
  • mindim::Int = 1: Minimum bond dimension after SVD truncation.
  • cutoff::Float64 = Float64_threshold(): Cutoff for SVD truncation.
  • svd_alg::String = "divide_and_conquer".
source
TeNLib.isometrize_full!Method
function isometrize_full!(ttn::TTN, node::Int2; kwargs...)

Isometrizes the TTN from scratch with respect to the orthogonality center node::Int2.

Named arguments and their default values.

  • normalize::Bool = true: Whether to normalize the TTN afterwards.
  • maxdim::Int = typemax(Int): Maximum bond dimension after SVD truncation.
  • mindim::Int = 1: Minimum bond dimension after SVD truncation.
  • cutoff::Float64 = Float64_threshold(): Cutoff for SVD truncation.
  • svd_alg::String = "divide_and_conquer".
source
TeNLib.isometrize!Method
function isometrize!(ttn::TTN, node::Int2; kwargs...)

Moves the isometry / orthogonality center of the TTN to a new center node. If the TTN does not have proper orthoginality center, Isometrizes the TTN from scratch.

Named arguments and their default values.

  • normalize::Bool = true: Whether to normalize the TTN afterwards.
  • maxdim::Int = typemax(Int): Maximum bond dimension after SVD truncation.
  • mindim::Int = 1: Minimum bond dimension after SVD truncation.
  • cutoff::Float64 = Float64_threshold(): Cutoff for SVD truncation.
  • svd_alg::String = "divide_and_conquer".
source
+end

Tree Tensor Network (TTN) object.

Each tensor is indexed by the tuple of integers (::Int2), (ll, nn), where (usually) ll denotes the layer index and nn denotes the tensor index at each layer.

source
ITensors.siteindsMethod
function ITensors.siteinds(ttn::TTN)

Returns the site Indexs of the TTN.

source
ITensors.siteindMethod
function ITensors.siteind(ttn::TTN, n::Int)

Returns the nth site Index of the TTN.

source
TeNLib.numsitesMethod
function numsites(ttn::TTN)

Returns the number of physical sites in the TTN.

source
TeNLib.getgraphMethod
function getgraph(ttn::TTN)

Returns (shallow copy of) the underlying graph of the TTN.

source
Base.getindexMethod
function Base.getindex(ttn::TTN, node::Int2)
+function Base.getindex(ttn::TTN, ll::Int, nn::Int)

Returns the tensor at the node::Int2 = (ll, nn).

source
Base.setindex!Method
function Base.setindex!(ttn::TTN, tensor::ITensor, node::Int2)
+function Base.setindex!(ttn::TTN, tensor::ITensor, ll::Int, nn::Int)

Sets the tensor at the node::Int2 = (ll, nn). If the node is not the orthogonality center, orthogonality center is set to (typemin(Int), typemin(Int)).

source
ITensors.orthocenterMethod
function orthocenter(ttn::TTN)

Returns the orthogonality center of the TTN.

source
Base.copyMethod
Base.copy(ttn::TTN)

Shallow copy of TTN.

source
TeNLib.isvalidnodeMethod
function isvalidnode(ttn::TTN, node::Int2)

Checks whether the input node::Int2 is a valid node in the TTN graph.

source
TeNLib.isneighborMethod
function isneighbor(ttn::TTN, node1::Int2, node2::Int2)

Checks whether node1 and node2 are neighboring nodes in the TTN.

source
ITensors.findsiteMethod
function ITensors.findsite(ttn::TTN, is)

Returns the first site of the TTN that has at least one Index in common with the Index or ITensor or their collection is.

source
ITensors.findsitesMethod
function ITensors.findsites(ttn::TTN, is)

Returns the sites of the TTN that have Indexs in common with the Index or ITensor or their collection is.

source
TeNLib.findnodeMethod
function findnode(ttn::TTN, is)

Returns the first node of the TTN that has at least one Index in common with the Index or ITensor or their collection is.

source
TeNLib.findnodesMethod
function findnodes(ttn::TTN, is)

Returns the nodes of the TTN that have Indexs in common with the Index or ITensor or their collection is.

source
TeNLib.find_sitenodeMethod
function find_sitenode(ttn::TTN, n::Int)

Return node of the TTN that is associated with the site n.

source
TeNLib.find_sitenodesMethod
function find_sitenodes(ttn::TTN, ns)

Returns nodes of the TTN that are associated with the sites ns (a collection of Ints).

source
ITensors.maxlinkdimMethod
function ITensors.maxlinkdim(ttn::TTN)

Returns the maximum bond/link dimension of the TTN.

source
LinearAlgebra.normalize!Method
function LinearAlgebra.normalize!(ttn::TTN)

Normalizes the TTN. The TTN must have well-defined orthogonality center.

source
Info

To conserve global symmetry in TTN, TeNLib.jl uses a dummy index of dimension one whose flux fixes the superselection sector. This dummy index is attached to one of the tensors of TTN, usually the eccentric central node. Unlike MPS, the fluxes of all tensors in TTN are zero.

ITensors.hasqnsMethod
function ITensors.hasqns(ttn::TTN)

Checks whether the TTN has QNs.

source
TeNLib.find_qnnodeMethod
function find_qnnode(ttn::TTN)

Returns the node where the a dummy QN Index is attached to fix the QN sector. Returns nothing if the TTN does not have QN.

source
TeNLib.moveisometry_to_next!Method
function moveisometry_to_next!(ttn::TTN, node1::Int2, node2::Int2; kwargs...)

Moves the isometry / orthogonality center of the TTN from node1::Int2 to the neighboring node2::Int. node1 and node2 must be neighboring nodes. node1 must be the orthogonality center unless ignore_orthocenter = true.

Note: Does not normalize the TTN afterwards.

Named arguments and their default values.

  • ignore_orthocenter::Bool = false: If set to true, node1 is not required to be the orthogonality center.
  • maxdim::Int = typemax(Int): Maximum bond dimension after SVD truncation.
  • mindim::Int = 1: Minimum bond dimension after SVD truncation.
  • cutoff::Float64 = Float64_threshold(): Cutoff for SVD truncation.
  • svd_alg::String = "divide_and_conquer".
source
TeNLib.isometrize_full!Method
function isometrize_full!(ttn::TTN, node::Int2; kwargs...)

Isometrizes the TTN from scratch with respect to the orthogonality center node::Int2.

Named arguments and their default values.

  • normalize::Bool = true: Whether to normalize the TTN afterwards.
  • maxdim::Int = typemax(Int): Maximum bond dimension after SVD truncation.
  • mindim::Int = 1: Minimum bond dimension after SVD truncation.
  • cutoff::Float64 = Float64_threshold(): Cutoff for SVD truncation.
  • svd_alg::String = "divide_and_conquer".
source
TeNLib.isometrize!Method
function isometrize!(ttn::TTN, node::Int2; kwargs...)

Moves the isometry / orthogonality center of the TTN to a new center node. If the TTN does not have proper orthoginality center, Isometrizes the TTN from scratch.

Named arguments and their default values.

  • normalize::Bool = true: Whether to normalize the TTN afterwards.
  • maxdim::Int = typemax(Int): Maximum bond dimension after SVD truncation.
  • mindim::Int = 1: Minimum bond dimension after SVD truncation.
  • cutoff::Float64 = Float64_threshold(): Cutoff for SVD truncation.
  • svd_alg::String = "divide_and_conquer".
source
diff --git a/dev/ttn/update_site_ttn/index.html b/dev/ttn/update_site_ttn/index.html index 786d7e5..77549c1 100644 --- a/dev/ttn/update_site_ttn/index.html +++ b/dev/ttn/update_site_ttn/index.html @@ -6,5 +6,5 @@ mindim::Int, cutoff::Float64, svd_alg::String, - kwargs...)

Moves the orthogonality center to pos and update StateEnvsTTN at position pos by solver.

Arguments:

Named arguments and their default values:

Named arguments for solver and their default values:

See the documentation of KrylovKit.jl.

Return values:

source

TeNLib.jl implements the subspace expansion method described in SciPost Phys. Lect. Notes 8 (2019) to increase the bond dimension between two neighboring nodes.

TeNLib.subspace_expand!Method
function subspace_expand!(psi::TTN, node::Int2, nextnode::Int2,
-                          max_expand_dim::Int, noise::Float64)

Enlarges the bond domension between node and nextnode by max_expand_dim using the subspace expansion. The parameter noise controls stength of the perturbation.

source
+ kwargs...)

Moves the orthogonality center to pos and update StateEnvsTTN at position pos by solver.

Arguments:

Named arguments and their default values:

Named arguments for solver and their default values:

See the documentation of KrylovKit.jl.

Return values:

source

TeNLib.jl implements the subspace expansion method described in SciPost Phys. Lect. Notes 8 (2019) to increase the bond dimension between two neighboring nodes.

TeNLib.subspace_expand!Method
function subspace_expand!(psi::TTN, node::Int2, nextnode::Int2,
+                          max_expand_dim::Int, noise::Float64)

Enlarges the bond domension between node and nextnode by max_expand_dim using the subspace expansion. The parameter noise controls stength of the perturbation.

source