DMRJtensor.DMRJtensor
— ModuleDMRjulia (version 0.12.0)
(made for julia v1.10.4+ (July 6, 2024), see included license)
Code: https://github.com/bakerte/DMRJtensor.jl
Documentation: T.E. Baker, S. Desrosiers, M. Tremblay, M.P. Thompson "Méthodes de calcul avec réseaux de tenseurs en physique" Canadian Journal of Physics 99, 4 (2021)
[ibid. "Basic tensor network computations in physics" https://arxiv.org/abs/1911.11566 p. 19]
and T.E. Baker and M.P. Thompson "Build your own tensor network library: DMRjulia I. Basic library for the density matrix renormalization group" arxiv: 2109.03120
Funding for this program is graciously provided by:
- Institut quantique (Université de Sherbrooke)
- Département de physique, Université de Sherbrooke
- Canada First Research Excellence Fund (CFREF)
- Institut Transdisciplinaire d'Information Quantique (INTRIQ)
- US-UK Fulbright Commission (Bureau of Education and Cultural Affairs from the United States Department of State)
- Department of Physics, University of York
- Canada Research Chair in Quantum Computing for Modelling of Molecules and Materials
- Department of Physics & Astronomy, University of Victoria
- Department of Chemistry, University of Victoria
- Faculty of Science, University of Victoria
- National Science and Engineering Research Council (NSERC)
DMRJtensor.Env
— TypeEnv
A global super-type for the environment defined either with envType
or AbstractArray
DMRJtensor.file_extension
— ConstantDMRJtensor.half
— ConstantDMRJtensor.largeType
— TypeDMRJtensor.subnumberstrings
— ConstantDMRJtensor.Hterm
— TypeDMRJtensor.MERA
— TypeMERA
Abstract types for MERA
DMRJtensor.MPO
— TypeMPO
Abstract types for MPO
DMRJtensor.MPO
— Methodmpo = MPO(T,H[,regtens=false])
constructor for MPO with an MPO H
; can change the element type T
for the tensors; regtens
outputs with the julia Array type
DMRJtensor.MPO
— Methodcmpo,cpsi = MPS(T,mpo,psi[,oc=1])
Converts psi
(MPS) and mpo
(MPO) to type given by T
DMRJtensor.MPO
— Methodmpo = MPO(T,H[,regtens=false])
constructor for MPO with a network
H
; can change the element type T
for the tensors; regtens
outputs with the julia Array type
DMRJtensor.MPO
— Methodmpo = MPO(H[,regtens=false])
constructor for MPO with an MPO H
; regtens
outputs with the julia Array type
DMRJtensor.MPO
— Methodmpo = MPO(H[,regtens=false])
constructor for MPO with a network
H
; regtens
outputs with the julia Array type
DMRJtensor.MPO
— Methodqmpo,qmps = MPO(Qlabels,mpo,mps[,newnorm=true,setflux=false,flux=...,randomize=true,override=true,lastfluxzero=false])
Creates a quantum number MPO qmpo
from input mpo
and an array of quantum number labels Qlabels
, a vector of Qnum
; also returns a quantum number MPS qmps
from input dense mps
Optional arguments
mps::MPS
: dense MPSQlabels::Array{Array{Qnum,1},1}
: quantum number labels on each physical index (assigns physical index labels mod size of this vector)newnorm::Bool
: set new norm of the MPS tensorsetflux::Bool
: toggle to force this to be the total flux of the MPS tensorflux::Qnum
: quantum number to force total MPS flux to be if setflux=truerandomize::Bool
: randomize last tensor if flux forces a zero tensorlastfluxzero::Bool
: determines whether the rightmost flux should be zero or not
See also: Qnum
DMRJtensor.MPO
— Methodqmpo = MPO(Qlabels,mpo[,regtens=false])
Creates a quantum number MPO qmpo
from input mpo
and Qlabels
, a vector of Qnum
See also: Qnum
DMRJtensor.MPO
— Methodqmpo,qmps = MPO(Qlabels,mpo,mps[,newnorm=true,setflux=false,flux=...,randomize=true,override=true,lastfluxzero=false])
Creates a quantum number MPO qmpo
from input mpo
and Qlabels
, a vector of Qnum
; also returns a quantum number MPS qmps
from input dense mps
Optional arguments
mps::MPS
: dense MPSQlabels::Array{Array{Qnum,1},1}
: quantum number labels on each physical index (assigns physical index labels mod size of this vector)newnorm::Bool
: set new norm of the MPS tensorsetflux::Bool
: toggle to force this to be the total flux of the MPS tensorflux::Qnum
: quantum number to force total MPS flux to be if setflux=truerandomize::Bool
: randomize last tensor if flux forces a zero tensorlastfluxzero::Bool
: determines whether the rightmost flux should be zero or not
See also: Qnum
DMRJtensor.MPO
— MethodDMRJtensor.MPO
— Methodmpo = MPO(H[,regtens=false])
constructor for MPO with an array of TensType
H
; regtens
outputs with the julia Array type
DMRJtensor.MPO
— Methodmpo = MPO(T,H[,regtens=false])
constructor for MPO with an array of TensType
H
; can change the element type T
for the tensors; regtens
outputs with the julia Array type
DMRJtensor.MPOterm
— TypeMPOterm
Abstract type used to store terms of an MPO
DMRJtensor.MPS
— TypeMPS
Abstract types for MPS
DMRJtensor.MPS
— Methodpsi = MPS(type,physindsize,Ns[,regtens=false,oc=1])
Constructs psi
for MPS of tensor type Float64 by making empty tensors of size (1,physindsize
,1) for w indexing 1:Ns
(repeats on physindvec
) with othrogonality center oc
. regtens
avoids conversion to denstens
type (defaulted to perform the conversion for efficiency)
DMRJtensor.MPS
— Methodcpsi,cmpo = MPS(T,psi,mpo[,oc=1])
Converts psi
(MPS) and mpo
(MPO) to type given by T
DMRJtensor.MPS
— Methodpsi = MPS(physindsize,Ns[,regtens=false,oc=1,type=Float64])
Constructs psi
for MPS of tensor type Float64 by making empty tensors of size (1,physindsize
,1) for w indexing 1:Ns
(repeats on physindvec
) with othrogonality center oc
. regtens
avoids conversion to denstens
type (defaulted to perform the conversion for efficiency)
DMRJtensor.MPS
— Methodpsi = MPS(A[,regtens=false,oc=psi.oc,type=...])
Constructs psi
for MPS with tensors A
(MPS format) with orthogonality center oc
. regtens
avoids conversion to denstens
type (defaulted to perform the conversion for efficiency); type
defaults to the input type of the tensors in psi
DMRJtensor.MPS
— Methodpsi = MPS(A[,regtens=false,oc=psi.oc,type=...])
Constructs psi
for MPS with tensors A
(network
) with orthogonality center oc
. regtens
avoids conversion to denstens
type (defaulted to perform the conversion for efficiency); type
defaults to the input type of the tensors in psi
DMRJtensor.MPS
— Methodqmps = MPS(Qlabels[,oc=1,type=Float64])
Creates a quantum number MPS qmps
with quantum numbers assigned from an array of qnum
vectors Qlabels
with orthogonality center oc
and data type type
DMRJtensor.MPS
— Methodqmps = MPS(Qlabels[,oc=1,type=Float64])
Creates a quantum number MPS qmps
with quantum numbers assigned from an array of an array of qnum
(non-uniform and can be shorter than Ns
, which will cause the program to repeat a shorter number) Qlabels
with orthogonality center oc
and data type type
; Ns
is the number of sites in the system
DMRJtensor.MPS
— MethodMPS(Qlabels,mps,mpo[,newnorm=true,setflux=false,flux=...,randomize=true,override=true,lastfluxzero=false])
Converts an MPS mps
and MPO mpo
into a an array of quantum number arrays with quantum numbers assigned from an array of qnum
vectors Qlabels
Optional arguments
mps::MPS
: dense MPSQlabels::Array{Array{Qnum,1},1}
: quantum number labels on each physical index (assigns physical index labels mod size of this vector)newnorm::Bool
: set new norm of the MPS tensorsetflux::Bool
: toggle to force this to be the total flux of the MPS tensorflux::Qnum
: quantum number to force total MPS flux to be if setflux=truerandomize::Bool
: randomize last tensor if flux forces a zero tensorlastfluxzero::Bool
: determines whether the rightmost flux should be zero or not
DMRJtensor.MPS
— MethodMPS(Qlabels,mps[,newnorm=true,setflux=false,flux=...,randomize=true,override=true,lastfluxzero=false])
Converts an MPS mps
into a an array of quantum number arrays with quantum numbers assigned from an array of qnum
vectors Qlabels
Optional arguments
mps::MPS
: dense MPSQlabels::Array{Array{Qnum,1},1}
: quantum number labels on each physical index (assigns physical index labels mod size of this vector)newnorm::Bool
: set new norm of the MPS tensorsetflux::Bool
: toggle to force this to be the total flux of the MPS tensorflux::Qnum
: quantum number to force total MPS flux to be if setflux=truerandomize::Bool
: randomize last tensor if flux forces a zero tensorlastfluxzero::Bool
: determines whether the rightmost flux should be zero or not
DMRJtensor.MPS
— Methodqmps = MPS(Qlabels[,oc=1,type=Float64])
Creates a quantum number MPS qmps
with quantum numbers assigned from an array of qnum
s in Qlabels
with orthogonality center oc
and data type type
; Ns
is the number of sites in the system
DMRJtensor.MPS
— MethodMPS(Qlabels,mps,mpo[,newnorm=true,setflux=false,flux=...,randomize=true,override=true,lastfluxzero=false])
Converts an MPS mps
and MPO mpo
into a quantum number version with Qlabels
assigned uniformly to every site
Optional arguments
mps::MPS
: dense MPSQlabels::Array{Array{Qnum,1},1}
: quantum number labels on each physical index (assigns physical index labels mod size of this vector)newnorm::Bool
: set new norm of the MPS tensorsetflux::Bool
: toggle to force this to be the total flux of the MPS tensorflux::Qnum
: quantum number to force total MPS flux to be if setflux=truerandomize::Bool
: randomize last tensor if flux forces a zero tensorlastfluxzero::Bool
: determines whether the rightmost flux should be zero or not
DMRJtensor.MPS
— MethodMPS(Qlabels,mps[,newnorm=true,setflux=false,flux=...,randomize=true,override=true,lastfluxzero=false])
Converts an MPS mps
into a quantum number version with Qlabels
assigned uniformly to every site
Optional arguments
mps::MPS
: dense MPSQlabels::Array{Array{Qnum,1},1}
: quantum number labels on each physical index (assigns physical index labels mod size of this vector)newnorm::Bool
: set new norm of the MPS tensorsetflux::Bool
: toggle to force this to be the total flux of the MPS tensorflux::Qnum
: quantum number to force total MPS flux to be if setflux=truerandomize::Bool
: randomize last tensor if flux forces a zero tensorlastfluxzero::Bool
: determines whether the rightmost flux should be zero or not
DMRJtensor.MPS
— Methodpsi = MPS(physindvec[,regtens=false,oc=1,type=Float64])
Constructs psi
for MPS of tensor type type
by making empty tensors of size (1,physindvec
[w],1) for w indexing physindvec
with othrogonality center oc
. regtens
avoids conversion to denstens
type (defaulted to perform the conversion for efficiency)
DMRJtensor.MPS
— Methodpsi = MPS(A[,regtens=false,oc=psi.oc,type=...])
Constructs psi
for MPS with tensors A
(Array of tensors or MPS) with orthogonality center oc
. regtens
avoids conversion to denstens
type (defaulted to perform the conversion for efficiency); type
defaults to the input type of the tensors in psi
DMRJtensor.MPS
— Methodpsi = MPS(T,A[,regtens=false,oc=1])
Constructs psi
for MPS of tensor type T
with tensors A
(Array of tensors or MPS) with orthogonality center oc
. regtens
avoids conversion to denstens
type (defaulted to perform the conversion for efficiency)
DMRJtensor.MPS
— Methodpsi = MPS(T,physindvec,Ns[,regtens=false,oc=1])
Constructs psi
for MPS of tensor type T
by making empty tensors of size (1,physindvec
[w],1) for w indexing 1:Ns
(repeats on physindvec
) with othrogonality center oc
. regtens
avoids conversion to denstens
type (defaulted to perform the conversion for efficiency)
DMRJtensor.MPS
— Methodqmps = MPS(Qlabels,arr[,oc=1,newnorm=true,setflux=false,flux=...,randomize=true,override=true,lastfluxzero=false])
Converts an array arr
into a quantum number MPS qmps
with quantum numbers assigned from an array of qnum
vectors Qlabels
Optional arguments
mps::MPS
: dense MPSQlabels::Array{Array{Qnum,1},1}
: quantum number labels on each physical index (assigns physical index labels mod size of this vector)oc::Integer
: Integernewnorm::Bool
: set new norm of the MPS tensorsetflux::Bool
: toggle to force this to be the total flux of the MPS tensorflux::Qnum
: quantum number to force total MPS flux to be if setflux=truerandomize::Bool
: randomize last tensor if flux forces a zero tensorlastfluxzero::Bool
: determines whether the rightmost flux should be zero or not
DMRJtensor.MPS
— Methodpsi = MPS(physindvec,Ns[,regtens=false,oc=1])
Constructs psi
for MPS of tensor type T
by making empty tensors of size (1,physindvec
[w],1) for w indexing 1:Ns
(repeats on physindvec
) with othrogonality center oc
. regtens
avoids conversion to denstens
type (defaulted to perform the conversion for efficiency)
DMRJtensor.TNparams
— TypeTNparams
parameters of a tensor network calculation
DMRJtensor.algvars
— Typealgvars
Struct to hold variables for the MPS optimization function and others
DMRJtensor.envType
— TypeenvType
Vector that holds environments (rank N)
DMRJtensor.environment
— Typeenvironment
Construct this object through Env
. Array that holds environment tensors
Fields:
V::Array{TensType,1}
: vector of environment tensors
See also: Env
DMRJtensor.environment
— MethodDMRJtensor.environment
— MethodDMRJtensor.environment
— MethodDMRJtensor.environment
— MethodV = environment(T...)
Inputs tensors T
into environment V
DMRJtensor.environment
— MethodV = environment(P)
Inputs tensors P
representing an Array
of tensors into environment V
See also: Array
DMRJtensor.environment
— MethodV = environment(W,Ns)
Creates a blank environment of type W
with entries for Ns
tensors
DMRJtensor.largeEnv
— TypeDMRJtensor.largeEnv
— MethodG,K = largeEnv(T,Ns[,Llabel="Lenv_",Lnames=[label*"i" for i = 1:Ns],Rlabel="Renv_",Rnames=[label*"i" for i = 1:Ns],ext=".dmrjulia"])
Creates large environments with Ns
tensors of type T
and retrieved through G
and K
respectively according to filenames specified in Lnames
and Rnames
(default file extension: .dmrjulia
)
DMRJtensor.largeEnv
— MethodG,K = largeEnv(Ns[,Llabel="Lenv_",Lnames=[label*"i" for i = 1:Ns],Rlabel="Renv_",Rnames=[label*"i" for i = 1:Ns],ext=".dmrjulia",type=Float64])
Creates large environments with Ns
tensors and retrieved through G
and K
respectively according to filenames specified in Lnames
and Rnames
(default file extension: .dmrjulia
)
DMRJtensor.largeEnv
— MethodG,K = largeEnv(lenv,renv[,Llabel="Lenv_",Lnames=[label*"i" for i = 1:length(psi)],Rlabel="Renv_",Rnames=[label*"i" for i = 1:length(renv)],ext=".dmrjulia",type=Float64])
Writes tensors from environments lenv
and renv
to hard disk as retrieved through G
and K
respectively according to filenames specified in Lnames
and Rnames
(default file extension: .dmrjulia
)
DMRJtensor.largeMPO
— TypeDMRJtensor.largeMPO
— MethodG = largeMPO(T,Ns[,label="mpo_",names=[label*"i" for i = 1:length(mpo)],ext=".dmrjulia"])
Creates a large MPO type (stored on disk) of element type T
with Ns
tensors but does not write anything to disk initially. Filenames specified in names
(default file extension: .dmrjulia
)
DMRJtensor.largeMPO
— MethodG = largeMPO(Ns[,label="mpo_",names=[label*"i" for i = 1:length(mpo)],ext=".dmrjulia"])
Creates a large MPO type (stored on disk) with Ns
tensors (element type: Float64) but does not write anything to disk initially. Filenames specified in names
(default file extension: .dmrjulia
)
DMRJtensor.largeMPO
— MethodDMRJtensor.largeMPS
— TypeDMRJtensor.largeMPS
— MethodG = largeMPS(T,Ns[,label="mps_",names=[label*"i" for i = 1:length(psi)],ext=".dmrjulia"])
Creates a large MPS type (stored on disk) of element type T
with Ns
tensors but does not write anything to disk initially. Filenames specified in names
(default file extension: .dmrjulia
)
DMRJtensor.largeMPS
— MethodG = largeMPS(Ns[,label="mps_",names=[label*"i" for i = 1:length(psi)],ext=".dmrjulia"])
Creates a large MPS type (stored on disk) with Ns
tensors (element type: Float64) but does not write anything to disk initially. Filenames specified in names
(default file extension: .dmrjulia
)
DMRJtensor.largeMPS
— MethodDMRJtensor.largeenvironment
— Typelargeenvironment
Construct this container with largeEnv
. struct to hold largeEnv
tensors
Fields:
V::Array{String,1}
: filenames where the tensors are stored on disktype::DataType
: DataType of the stored tensors
See also: largeEnv
DMRJtensor.largematrixproductoperator
— Typelargematrixproductoperator
Construct this container with largeMPO
. struct to hold largeMPO
tensors
Fields:
H::Array{String,1}
: filenames where the tensors are stored on disktype::DataType
: DataType of the stored tensors
See also: largeMPO
DMRJtensor.largematrixproductstate
— Typelargematrixproductstate
Construct this container with largeMPS
. struct to hold largeMPS
tensors and orthogonality center
Fields:
A::Array{String,1}
: filenames where the tensors are stored on diskoc::Integer
: orthogonality centertype::DataType
: DataType of the stored tensors
See also: largeMPS
DMRJtensor.matrixproductoperator
— Typematrixproductoperator
Contruct this through MPO
. Struct to hold MPO tensors
Fields:
H::Array{TensType,1}
: vector of MPO tensors
See also: MPO
DMRJtensor.matrixproductstate
— Typematrixproductstate
Contruct this through MPS
. struct to hold regMPS tensors and orthogonality center
Fields:
A::Array{TensType,1}
: vector of MPS tensorsoc::Integer
: orthogonality center
See also: MPS
DMRJtensor.mpoterm
— Typempoterm{W}
Stores terms of an MPO
DMRJtensor.mpoterm
— Methodmpoterm(Qlabels,val,operator,ind,base,trail...)
Same as mpoterm
but converts to quantum number MPO with Qlabels
on the physical indices
See also: mpoterm
DMRJtensor.mpoterm
— Methodmpoterm(val,operator,ind,base,trail...)
Creates an MPO from operators (operator
) with a prefactor val
on sites ind
. Must also provide a base
function which are identity operators for each site. trail
operators can be defined (example: fermion string operators)
Example:
Cup, Cdn, Nup, Ndn, Ndens, F, O, Id = fermionOps()
base = [Id for i = 1:Ns]; #identity operators of the appropriate physical index size for each site
CupCupdag = mpoterm(-1.,[Cup,Cup'],[1,2],base,F); #Cup_1 Cup^dag_2
newpsi = applyMPO(psi,CupCupdag); #applies <Cup_1 Cup^dag_2> to psi
expect(psi,newpsi);
DMRJtensor.paulistring
— TypeDMRJtensor.regMPO
— TyperegMPO
Abstract types for regMPO
DMRJtensor.regMPS
— TyperegMPS
Abstract types for regMPS
TensorPACK.network
— Methodnet = network(input[,groundlevel=1])
Produces net
from a set of input types (any number) input
; groundlevel
gives the number of the bottom level for MPS-MPO systems
#Examples: julia> network(dualpsi,psi,mpo) #generates a network of nametens
; works for any number of MPOs julia> network(dualpeps,peps,mpdo) #same functionality as for the MPO case julia> network(mpo,mera) #creates a MERA network on top of an MPO
Base.:*
— MethodBase.:*
— MethodBase.:*
— MethodBase.:*
— Method*(X,Y)
concatenates two MPSs X
and Y
(same as vcat in Base Julia)
Base.:*
— Method*(psi,c)
makes copy of input MPS psi
and multiplies orthogonality center by a number c
. Some number types require conversaion of psi
See also: convertTensor
MPS
Base.:*
— MethodBase.:*
— MethodBase.:*
— MethodBase.:*
— Method*(c,psi)
makes copy of input MPS psi
and multiplies orthogonality center by a number c
. Some number types require conversaion of psi
See also: convertTensor
MPS
Base.:*
— MethodA + B
functionality for adding (similar to direct sum) of MPOs together; uses joinindex function to make a combined MPO
note: deparallelizes after every addition
See also: deparallelization
add!
Base.:+
— MethodBase.:+
— MethodH + c
Adds a constant c
to a Hamiltonian H
(commutative)
Base.:+
— MethodA + B
functionality for adding (similar to direct sum) of MPOs together; uses joinindex function to make a combined MPO
Note: Calls add!
so will run compressMPO!
on the result
See also: deparallelization
add!
mult!
Base.:-
— MethodH - c
Adds a constant c
to a Hamiltonian H
Base.:/
— Method/(psi,c)
makes copy of input MPS psi
and divides orthogonality center by a number c
. Some number types require conversaion of psi
See also: convertTensor
MPS
Base.Multimedia.display
— MethodBase.Multimedia.display
— MethodBase.conj!
— Methodpsi = conj!(psi)
Conjugates all elements in an MPS
in-place; outputs psi
which was input
See also conj
Base.conj
— MethodBase.copy
— MethodG = copy(names,X[,ext=".dmrjulia",copyext=ext])
Copies tensors from largeEnv
input X
to a new tensor with a single string names
which is used to generate a vector of names representing the new filenames with input extension ext
and the new extension copyext
Base.copy
— MethodG = copy(names,X[,ext=".dmrjulia",copyext=ext])
Copies tensors from largeMPO
input X
to a new tensor with a vector of a single string names
which is used to generate a vector of names representing the new filenames with input extension ext
and the new extension copyext
Base.copy
— MethodG = copy(names,X[,ext=".dmrjulia",copyext=ext])
Copies tensors from largeMPS
input X
to a new tensor with a vector of a single string names
which is used to generate a vector of names representing the new filenames with input extension ext
and the new extension copyext
Base.copy
— MethodG = copy(names,X[,ext=".dmrjulia",copyext=ext])
Copies tensors from largeEnv
input X
to a new tensor with a vector of strings names
representing the new filenames with input extension ext
and the new extension copyext
Base.copy
— MethodG = copy(names,X[,ext=".dmrjulia",copyext=ext])
Copies tensors from largeMPO
input X
to a new tensor with a vector of strings names
representing the new filenames with input extension ext
and the new extension copyext
Base.copy
— MethodG = copy(names,X[,ext=".dmrjulia",copyext=ext])
Copies tensors from largeMPS
input X
to a new tensor with a vector of strings names
representing the new filenames with input extension ext
and the new extension copyext
Base.copy
— MethodnewG = copy(G)
Copies an Env
to new output container of the same type; type stable (where deepcopy is type-unstable inherently)
Base.copy
— Methodnewmpo = copy(mpo)
Copies an MPO
to new output container of the same type; type stable (where deepcopy is type-unstable inherently)
Base.copy
— Methodnewpsi = copy(psi)
Copies an MPS
to new output container of the same type; type stable (where deepcopy is type-unstable inherently)
Base.eltype
— MethodBase.eltype
— MethodG = eltype(Y)
eltype
gets element type G
of the Env
Base.eltype
— MethodG = eltype(Y)
eltype
gets element type G
of the MPO
Base.eltype
— MethodG = eltype(Y)
eltype
gets element type G
of the MPS
Base.getindex
— MethodG = getindex(A,i)
getindex
allows to retrieve tensor G
at position i
from MERA
Base.getindex
— MethodG = getindex(A,i)
getindex
allows to retrieve tensor G
at position i
from largeEnv
Base.getindex
— MethodG = getindex(A,i)
getindex
allows to retrieve tensor G
at position i
from largeMPO
Base.getindex
— MethodG = getindex(A,i)
getindex
allows to retrieve tensor G
at position i
from largeMPS
Base.getindex
— MethodG = getindex(A,i)
getindex
allows to retrieve tensor G
at position i
from Env
Base.getindex
— MethodG = getindex(A,i)
getindex
allows to retrieve tensor G
at position i
from MPO
Base.getindex
— MethodG = getindex(A,i)
getindex
allows to retrieve tensor G
at position i
from MPS
Base.getindex
— MethodG = getindex(A,r)
getindex
allows to retrieve a range r
(ex: r = 2:6) tensor G
from Env
Base.getindex
— MethodG = getindex(A,r)
getindex
allows to retrieve a range r
(ex: r = 2:6) tensor G
from MPO
Base.getindex
— MethodG = getindex(A,r)
getindex
allows to retrieve a range r
(ex: r = 2:6) tensor G
from MPS
Base.lastindex
— MethodB = psi[end]
lastindex!
allows to get the end element of an Env
Base.lastindex
— MethodB = psi[end]
lastindex!
allows to get the end element of an MPO
Base.lastindex
— MethodB = psi[end]
lastindex!
allows to get the end element of an MPS
Base.length
— MethodBase.length
— MethodBase.length
— MethodG = length(H)
length
prints out the number of entries of the input H
being a MERA
; this is the number of tensors in the layer of isometries or unitaries
Base.length
— MethodG = length(H)
length
prints out the number of entries of the input H
being a MPO
; this is effecitvely the number of sites
Base.length
— MethodG = length(H)
length
prints out the number of entries of the input H
being a MPS
; this is effecitvely the number of sites
Base.length
— MethodG = length(H)
length
prints out the number of entries of the input H
being a largeEnv
; this is effecitvely the number of sites
Base.length
— MethodG = length(H)
length
prints out the number of entries of the input H
being a largeMPO
; this is effecitvely the number of sites
Base.length
— MethodG = length(H)
length
prints out the number of entries of the input H
being a largeMPS
; this is effecitvely the number of sites
Base.length
— MethodG = length(H)
length
prints out the number of entries of the input H
being a Env
; this is effecitvely the number of sites
Base.setindex!
— MethodLenv[i] = G
setindex!
allows to assign elements G
to an largeEnv
at element i
Base.setindex!
— MethodLenv[i] = G
setindex!
allows to assign elements G
to an largeMPO
at element i
Base.setindex!
— MethodLenv[i] = G
setindex!
allows to assign elements G
to an largeMPS
at element i
Base.setindex!
— MethodLenv[i] = G
setindex!
allows to assign elements G
to an Env
at element i
Base.setindex!
— Methodmpo[i] = G
setindex!
allows to assign elements G
to an MPO
at element i
Base.setindex!
— Methodpsi[i] = G
setindex!
allows to assign elements G
to an MPS
at element i
Base.size
— MethodG = size(H,i)
size
prints out the size tuple G
of the tensor field of a MPO
; this is effectively the number of sites in a tuple
Base.size
— MethodG = size(H)
size
prints out the size tuple G
of the tensor field of a MPO
; this is effectively the number of sites in a tuple
Base.size
— MethodG = size(H,i)
size
prints out the size tuple G
of the tensor field of a MPS
; this is effectively the number of sites in a tuple
Base.size
— MethodG = size(H)
size
prints out the size tuple G
of the tensor field of a MPS
; this is effectively the number of sites in a tuple
Base.size
— MethodG = size(H,i)
size
prints out the size tuple G
of the tensor field of a Env
; this is effectively the number of sites in a tuple
Base.size
— MethodG = size(H)
size
prints out the size tuple G
of the tensor field of a Env
; this is effectively the number of sites in a tuple
DMRJtensor.Lupdate!
— MethodLupdate!(i,Lenv,psi,dualpsi,mpo)
Updates left environment's (Lenv
) i
+1 site from info on the site i
based on dual MPS (dualpsi
), MPS (psi), and MPO (
mpo`)
DMRJtensor.Lupdate!
— MethodLupdate!(i,Lenv,psi,mpo)
Updates left environment's (Lenv
) i
+1 site from info on the site i
based on MPS (psi) and MPO (
mpo`)
DMRJtensor.Lupdate
— MethodLupdate(Lenv,dualpsi,psi,mpo)
Updates left environment tensor Lenv
with dual MPS dualpsi
, MPS psi
, and MPO mpo
DMRJtensor.Omat
— MethodOmat(m)
Generates a bulk matrix product operator with reserved string "O" for zero with a matrix of size m x m
. Can multiply this object to get bulk MPO for a given system.
Example:
H = bulkMPO(5) #["O" for i = 1:5,j = 1:5]
#XXZ model
H[1,1] = H[end,end] = "I"
H[2,1] = "S"*Char(0x207B)
H[3,1] = "S"*Char(0x207A)
H[4,1] = "Sz"
H[end,2] = half*"S"*Char(0x207A)
H[end,3] = half*"S"*Char(0x207B)
H[end,4] = "Sz"
H*H*H #multiply 3 sites together
DMRJtensor.Rupdate!
— MethodRupdate!(i,Renv,dualpsi,psi,mpo)
Updates right environment's (Renv
) i
-1 site from info on the site i
based on dual MPS (dualpsi
), MPS (psi), and MPO (
mpo`)
DMRJtensor.Rupdate!
— MethodRupdate!(i,Renv,psi,mpo)
Updates right environment's (Renv
) i
-1 site from info on the site i
based on MPS (psi) and MPO (
mpo`)
DMRJtensor.Rupdate
— MethodRupdate(Renv,dualpsi,psi,mpo)
Updates right environment tensor Renv
with dual MPS dualpsi
, MPS psi
, and MPO mpo
DMRJtensor.XXZ
— FunctionXXZ(i[,spinmag=0.5,J=0.5])
Creates a bulk MPO of the Heisenberg model for uniform coupling J
, and spin magnitude spinmag
See also: XXZ
DMRJtensor.applyMPO
— Methodnewpsi = applyMPO(psi,H[,m=1,cutoff=0.])
Applies MPO (H
) to an MPS (psi
) and truncates to maximum bond dimension m
and cutoff cutoff
DMRJtensor.applyMPO
— Methodnewpsi = applyMPO(psi,H...[,m=1,cutoff=0.])
Applies MPOs (H
) to an MPS (psi
) and truncates to maximum bond dimension m
and cutoff cutoff
. Not recommended except for small problems since bond dimension is not truncated uniformly.
DMRJtensor.applyOps!
— Methodpsi = applyOps!(psi,sites,Op[,trail=ones(1,1)])
Applies operator Op
(any TensType
) in-place to the MPS psi
at sites sites
, a vector of integers. A trailing operator trail
can be applied if not the default.
DMRJtensor.applyOps
— Methodnewpsi = applyOps(psi,sites,Op[,trail=ones(1,1)])
Applies operator Op
(any TensType
) to the MPS psi
at sites sites
, a vector of integers. A trailing operator trail
can be applied if not the default.
DMRJtensor.applylocalF!
— MethodapplylocalF!(tens, i)
(in-place) effectively apply a chain of F (fermion phase) operator by a single manipulation on the specified index.
See also: applylocalF
DMRJtensor.applylocalF
— MethodapplylocalF(tens, i)
effectively apply a chain of F (fermion phase) operator by a single manipulation on the specified index.
See also: applylocalF!
DMRJtensor.assignflux!
— Methodassignflux!(i,mps,QnumMat,storeVal)
Assigns flux to the right link index on an MPS tensor
Arguments
i::intType
: current positionmps::MPS
: MPSQnumMat::Array{Array{Qnum,1},1}
: quantum number matrix for the physical indexstoreVal::Array{T,1}
: maximum value found in MPS tensor, determine quantum number
DMRJtensor.boundaryMove!
— MethodboundaryMove!(psi,i,mpo,Lenv,Renv)
Move orthogonality center of psi
to site i
and updates left and right environments Lenv
and Renv
using MPO mpo
See also: move!
DMRJtensor.boundaryMove!
— MethodboundaryMove!(dualpsi,psi,i,mpo,Lenv,Renv)
Move orthogonality center of psi
and dualpsi
to site i
and updates left and right environments Lenv
and Renv
using MPO mpo
See also: move!
DMRJtensor.boundaryMove
— MethodboundaryMove(psi,i,mpo,Lenv,Renv)
Copies psi
and moves orthogonality center of psi
to site i
and updates left and right environments Lenv
and Renv
using MPO mpo
See also: move!
DMRJtensor.boundaryMove
— MethodboundaryMove(dualpsi,psi,i,mpo,Lenv,Renv)
Copies psi
and moves orthogonality center of psi
and dualpsi
to site i
and updates left and right environments Lenv
and Renv
using MPO mpo
See also: move!
DMRJtensor.bulkMPO
— MethodbulkMPO(m)
Generates a bulk matrix product operator with reserved string "O" for zero with a matrix of size m x m
. Can multiply this object to get bulk MPO for a given system.
Example:
Example:
H = bulkMPO(5) #["O" for i = 1:5,j = 1:5]
#XXZ model
H[1,1] = H[end,end] = "I"
H[2,1] = "S"*Char(0x207B)
H[3,1] = "S"*Char(0x207A)
H[4,1] = "Sz"
H[end,2] = half*"S"*Char(0x207A)
H[end,3] = half*"S"*Char(0x207B)
H[end,4] = "Sz"
H*H*H #multiply 3 sites together
DMRJtensor.compressMPO!
— MethodcompressMPO!(W[,sweeps=,cutoff=,deltam=,minsweep=,nozeros=])
compresses MPO (W
; or several M
) with SVD compression for sweeps
sweeps, cutoff
applied to the SVD, deltam
target for teh bond dimension compression, and nozeros
defaulted to true to eliminate all zeros in the SVD
DMRJtensor.compressMPO!
— MethodcompressMPO!(W[,sweeps=,cutoff=,deltam=,minsweep=,nozeros=])
compresses an array of MPOs (W
) in parallel with SVD compression for sweeps
sweeps, cutoff
applied to the SVD, deltam
target for teh bond dimension compression, and nozeros
defaulted to true to eliminate all zeros in the SVD
DMRJtensor.compressMPO
— MethodcompressMPO(W,sweeps=,cutoff=,deltam=,minsweep=,nozeros=])
Same as compressMPO!
but a copy is made of the original vector of MPOs
See also: compressMPO!
DMRJtensor.correlation
— MethodT = correlation(dualpsi,psi,inputoperators...[,sites=ntuple(i->1,length(inputoperators)),trail=()])
Computes the general correlation on the input MPS psi
with operators defined in the tuple inputoperators
. The sites
command specifies which sites to allow for the operators to be applied (i.e., some operators can skip some sites) and the trail
option allows for a trailing operator like the Fermion sign operator; output is a tensor T
of rank equal to the size of inputoperators
See also: expect
correlationmatrix
DMRJtensor.correlation
— MethodT = correlation(psi,inputoperators...[,sites=ntuple(i->1,length(inputoperators)),trail=()])
Computes the general correlation on the input MPS psi
with operators defined in the tuple inputoperators
. The sites
command specifies which sites to allow for the operators to be applied (i.e., some operators can skip some sites) and the trail
option allows for a trailing operator like the Fermion sign operator; output is a tensor T
of rank equal to the size of inputoperators
See also: expect
correlationmatrix
DMRJtensor.correlationmatrix
— Methodrho = correlationmatrix(dualpsi,psi,Cc,Ca[,F,silent=])
Compute the correlation funciton (example, <dualpsi
|Cc
i . Ca
j|psi
>) on all sites; can also specify a trail F
for Fermion strings; silent
toggles output of every line; outputs matrix rho
Note:
- More efficient than using
mpoterm
s orcorrelation
- Use
mpoterm
andapplyMPO
for higher order correlation functions or write a new function
DMRJtensor.correlationmatrix
— MethodA = correlationmatrix(psi,Cc,Ca[,F,silent=])
Compute the correlation funciton (example, <psi
|Cc
i . Ca
j|psi
>) on all sites; can also specify a trail F
for Fermion strings; silent
toggles output of every line; outputs matrix rho
Note:
- More efficient than using
mpoterm
s orcorrelation
- Use
mpoterm
andapplyMPO
for higher order correlation functions or write a new function
Example:
Cup, Cdn, Nup, Ndn, Ndens, F, O, Id = fermionOps()
rho = correlationmatrix(psi,Cup',Cup,F) #density matrix
DMRJtensor.defaultBoundary
— Methodtensor = defaultBoundary(A)
Creates a tensor tensor
that has no elements for any input tensor A
(both tensors of the same type)
DMRJtensor.deparallelize!
— Methoddeparallelize!(W[,sweeps=])
Applies sweeps
to MPO (W
) to compress the bond dimension
DMRJtensor.deparallelize!
— Methoddeparallelize!(M[,left=])
Deparallelizes a matrix-equivalent of a rank-4 tensor M
; toggle the decomposition into the left
or right
DMRJtensor.deparallelize!
— Methoddeparallelize!(W[,sweeps=])
Deparallelize an array of MPOs (W
) for sweeps
passes; compressed MPO appears in first entry
DMRJtensor.deparallelize
— MethodDMRJtensor.elnumtype
— MethodG = elnumtype(op...)
Gives type G
of input containers op
, a tuple containing MPS
, MPO
, or Env
types
DMRJtensor.emptyTensor
— MethodB = emptyTensor(A)
Generates a tensor with no inputs from an input array of Qtens
DMRJtensor.emptyTensor
— MethodB = emptyTensor(A)
Generates a tensor with no inputs from an input array of tens
DMRJtensor.emptyTensor
— MethodB = emptyTensor(A)
Generates a tensor with no inputs from an input array of Array
DMRJtensor.emptyTensor
— MethodB = emptyTensor(A)
Generates a tensor with no inputs from an input network
of Qtens
DMRJtensor.emptyTensor
— MethodB = emptyTensor(A)
Generates a tensor with no inputs from an input network
of tens
DMRJtensor.emptyTensor
— MethodB = emptyTensor(A)
Generates a tensor with no inputs from an input network
of Array
DMRJtensor.expect
— Methodexpval = expect(dualpsi,psi,H[,Lbound=,Rbound=,order=])
evaluate <dualpsi
|H
|psi
> for any number of MPOs H
; can specifcy left and right boundaries (Lbound
and Rbound
); dualpsi
is conjugated inside of the algorithm; output is an expectation value expval
See also: overlap
DMRJtensor.expect
— Methodexpval = expect(psi,H[,Lbound=,Rbound=,order=])
evaluate <psi
|H
|psi
> for any number of MPOs H
; can specifcy left and right boundaries (Lbound
and Rbound
); output is an expectation value expval
See also: overlap
DMRJtensor.fermionOps
— MethodCup,Cdn,F,Nup,Ndn,Ndens,O,Id = fermionOps()
Make fermion operators Cup,Cdn,F,Nup,Ndn,Ndens,O,Id
#Outputs:
Cup
: spin-up annihilation operatorCdn
: spin-down annihilation operatorF
: Jordan-Wigner Fermion stringNup
: spin-up number operatorNdn
: spin-dn number operatorNdens
: total-spin number operatorO
: zero matrixId
: identity matrix
DMRJtensor.format_matrix
— MethodDMRJtensor.fullH
— MethodH = fullH(mpo)
Generates the full Hamiltonian from an MPO (memory providing); assumes lower left triagular form
DMRJtensor.fullpsi
— Methodvect = fullpsi(psi)
Generates the full wavefunction vect
from an MPS psi
(memory providing)
DMRJtensor.get_tensors
— MethodB = get_tensors(A)
Unified function for obtaining the vector of tensors from an MERA
DMRJtensor.get_tensors
— MethodB = get_tensors(A)
Unified function for obtaining the vector of tensors from an MPO
DMRJtensor.get_tensors
— MethodB = get_tensors(A)
Unified function for obtaining the vector of tensors from an MPS
DMRJtensor.heisenbergMPO
— MethodheisenbergMPO(i[,spinmag=0.5,J=0.5,Ops=spinOps(spinmag)])
Creates a bulk MPO of the Heisenberg model for uniform coupling J
, spin magnitude spinmag
, and operator set Ops
#Example: julia> En = Vector{Float64}(undef,8) julia> for Ns = 3:10 mpo = makeMPO(XXZ,2,Ns) psi = randMPS(2,Ns) En[Ns-2] = dmrg(psi,mpo,sweeps=50,m=100,cutoff=1E-9) end
#Expected outputs: 3 -1.0 4 -0.9571067811865475 5 -1.9278862533179937 6 -2.0019953568985334 7 -2.836239680686649 8 -3.3749325986878933 9 -3.7363216980340077 10 -4.258035204636598
See also: XXZ
DMRJtensor.hubbardMPO
— MethodhubbardMPO(i[,t=1.0,mu=-2.0,HubU=4.0,Ops=fermionOps()])
Creates a bulk MPO of the Hubbard model for uniform kinetic energy t
, and spin magnitude spinmag
See also: XXZ
DMRJtensor.invDfactor
— MethodinvDfactor(D)
Finds nearest factor of 2 to the magnitude of D
DMRJtensor.largeLenv
— MethodG = largeLenv(T,Ns[,label="Lenv_",names=[label*"i" for i = 1:Ns],ext=".dmrjulia"])
Creates a large environment type (stored on disk) of element type T
with Ns
tensors but does not write anything to disk initially. Filenames specified in names
(default file extension: .dmrjulia
)
DMRJtensor.largeLenv
— MethodG = largeLenv(Ns[,label="Lenv_",names=[label*"i" for i = 1:Ns],ext=".dmrjulia"])
Creates a large environment type (stored on disk) with Ns
tensors (element type: Float64) but does not write anything to disk initially. Filenames specified in names
(default file extension: .dmrjulia
)
DMRJtensor.largeLenv
— MethodDMRJtensor.largeRenv
— MethodG = largeRenv(T,Ns[,label="Renv_",names=[label*"i" for i = 1:Ns],ext=".dmrjulia"])
Creates a large environment type (stored on disk) of element type T
with Ns
tensors but does not write anything to disk initially. Filenames specified in names
(default file extension: .dmrjulia
)
DMRJtensor.largeRenv
— MethodG = largeRenv(Ns[,label="Renv_",names=[label*"i" for i = 1:Ns],ext=".dmrjulia"])
Creates a large environment type (stored on disk) with Ns
tensors (element type: Float64) but does not write anything to disk initially. Filenames specified in names
(default file extension: .dmrjulia
)
DMRJtensor.largeRenv
— MethodDMRJtensor.leftnormalize!
— Methodpsi,D,V = leftnormalize!(psi)
Creates a left-normalized MPS in-place from psi
and returns the external tensors D
and V
DMRJtensor.leftnormalize
— Methodnewpsi,D,V = leftnormalize(psi)
Creates a left-normalized MPS newpsi
from psi
and returns the external tensors D
and V
DMRJtensor.libtest
— Methodtestlib([,tests=,path=libdir*"/test/"])
Tests all functions in the files enumerated in tests
. Default is to check all test functionality in the library. Used in nightly builds. See format in /tests/
folder
See also: libdir
DMRJtensor.loadEnv
— MethodG,K = loadEnv(Ns[,Llabel="Lenv_",Lnames=[label*"i" for i = 1:Ns],Rlabel="Renv_",Rnames=[label*"i" for i = 1:Ns],ext=".dmrjulia"])
If environment tensors are stored on hard disk, then they can be retrieved by using loadEnv
DMRJtensor.loadLenv
— MethodG = loadLenv(Ns[,label="Lenv_",names=[label*"i" for i = 1:Ns],ext=".dmrjulia"])
If left environment tensors are stored on hard disk, then they can be retrieved by using loadLenv
DMRJtensor.loadMPO
— MethodG = loadMPO(Ns[,label="mpo_",names=[label*"i" for i = 1:Ns],ext=".dmrjulia"])
If MPO tensors are stored on hard disk, then they can be retrieved by using loadMPO
DMRJtensor.loadMPS
— MethodG = loadMPS(Ns[,label="mps_",names=[label*"i" for i = 1:Ns],ext=".dmrjulia"])
If MPS tensors are stored on hard disk, then they can be retrieved by using loadMPS
DMRJtensor.loadRenv
— MethodG = loadRenv(Ns[,label="Renv_",names=[label*"i" for i = 1:Ns],ext=".dmrjulia"])
If right environment tensors are stored on hard disk, then they can be retrieved by using loadRenv
DMRJtensor.makeBoundary
— MethodLbound = makeBoundary(qind,newArrows[,retType=])
makes a boundary tensor Lbound
for an input from the quantum numbers qind
and arrows newArrows
; can also define type of resulting Qtensor retType
(default Float64
)
#Note:
- dense tensors are just ones(1,1,1,...)
See also: makeEnds
DMRJtensor.makeEdgeEnv
— MethodLbound = makeEdgeEnv(dualpsi,psi[,mpovec,boundary=defaultBoundary,left=true])
Created leftmost boundary tensor for the MPS psi
, dual MPS dualpsi
, any number of MPOs mpovec
; boundary
creates a tensor of the appropriate type and left
makes either a left (true) or right (false) tensor
DMRJtensor.makeEnds
— MethodLenv,Renv = makeEnds(dualpsi,psi[,mpovec,Lbound=,Rbound=])
Generates first and last environments for a given system of variable MPOs
Arguments:
dualpsi::MPS
: dual MPSpsi::MPS
: MPSmpovec::MPO
: MPOsLbound::TensType
: left boundaryRbound::TensType
: right boundary
DMRJtensor.makeEnds
— MethodLenv,Renv = makeEnds(psi[,mpovec,Lbound=,Rbound=])
Generates first and last environment tensors for a given system of variable MPOs. Same as other implementation but dualpsi
=psi
Arguments:
psi::MPS
: MPSmpovec::MPO
: MPOsLbound::TensType
: left boundaryRbound::TensType
: right boundary
DMRJtensor.makeEnv
— MethodLenv,Renv = makeEnv(psi,mpo[,Lbound=,Rbound=])
Generates environment tensors for a MPS (psi
) with boundaries Lbound
and Rbound
DMRJtensor.makeEnv
— MethodLenv,Renv = makeEnv(dualpsi,psi,mpo[,Lbound=defaultBoundary,Rbound=defaultBoundary,Llabel="Lenv_",Rlabel="Renv_"])
Generates environment tensors for a MPS (psi
and its dual dualpsi
) with boundaries Lbound
and Rbound
; labels Llabel
and Rlabel
are for large-types
DMRJtensor.makeMPO
— Methodmpo = makeMPO(H,physSize,Ns[,lower=])
Converts a function producing a bulk MPO tensor H
input i
the site index into an MPO mpo
; physSize
can be a vector (one element for the physical index size on each site) or a number (uniform sites); lower
signifies the input is the lower triangular form (default) and is represented by a tensor diagrammatically as
s2
|
a1 – W – a2 = W[a1,s1,s2,a2] | s1
Example:
spinmag = 0.5;Ns = 10
Sp,Sm,Sz,Sx,Sy,O,Id = spinOps(spinmag)
function H(i::Integer)
return [Id O O;
Sz O O;
O Sz Id]
end
isingmpo = makeMPO(H,size(Id,1),Ns)
DMRJtensor.makeMPO
— Methodmpo = makeMPO(H,physSize,Ns[,lower=])
Converts a function producing a bulk MPO tensor H
input i
the site index into an MPO mpo
; physSize
is a vector (one element for the physical index size on each site); lower
signifies the input is the lower triangular form (default) and is represented by a tensor diagrammatically as
s2
|
a1 – W – a2 = W[a1,s1,s2,a2] | s1
Example:
spinmag = 0.5;Ns = 10
Sp,Sm,Sz,Sx,Sy,O,Id = spinOps(spinmag)
function H(i::Integer)
return [Id O O;
Sz O O;
O Sz Id]
end
isingmpo = makeMPO(H,size(Id,1),Ns)
DMRJtensor.makeMPO
— Methodmpo = makeMPO(H,physSize[,lower=])
Converts vector (H
) of matrices into a full MPO mpo
; physSize
is a number (uniform sites); lower
signifies the input is the lower triangular form (default) and is represented by a tensor diagrammatically as
s2
|
a1 – W – a2 = W[a1,s1,s2,a2] | s1
Example:
spinmag = 0.5;Ns = 10
Sp,Sm,Sz,Sx,Sy,O,Id = spinOps(spinmag)
function H(i::Integer)
return [Id O O;
Sz O O;
O Sz Id]
end
isingmpo = makeMPO(H,size(Id,1),Ns)
DMRJtensor.makeMPO
— Methodmpo = makeMPO(H,physSize[,lower=])
Converts vector (H
) of matrices into a full MPO mpo
; physSize
is a vector (one element for the physical index size on each site); lower
signifies the input is the lower triangular form (default) and is represented by a tensor diagrammatically as
s2
|
a1 – W – a2 = W[a1,s1,s2,a2] | s1
Example:
spinmag = 0.5;Ns = 10
Sp,Sm,Sz,Sx,Sy,O,Id = spinOps(spinmag)
function H(i::Integer)
return [Id O O;
Sz O O;
O Sz Id]
end
isingmpo = makeMPO(H,size(Id,1),Ns)
DMRJtensor.makeMPO
— Methodmpo = makeMPO(H,physSize,Ns[,lower=])
Converts a bulk MPO tensor H
for Ns
sites; physSize
is a vector (one element for the physical index size on each site); lower
signifies the input is the lower triangular form (default) and is represented by a tensor diagrammatically as
s2
|
a1 – W – a2 = W[a1,s1,s2,a2] | s1
Example:
spinmag = 0.5;Ns = 10
Sp,Sm,Sz,Sx,Sy,O,Id = spinOps(spinmag)
function H(i::Integer)
return [Id O O;
Sz O O;
O Sz Id]
end
isingmpo = makeMPO(H,size(Id,1),Ns)
DMRJtensor.makeMPO
— Methodmpo = makeMPO(H,physSize,Ns[,lower=])
Converts a bulk MPO tensor H
into an MPO mpo
of Ns
sites; physSize
is a number (uniform sites); lower
signifies the input is the lower triangular form (default) and is represented by a tensor diagrammatically as
s2
|
a1 – W – a2 = W[a1,s1,s2,a2] | s1
Example:
spinmag = 0.5;Ns = 10
Sp,Sm,Sz,Sx,Sy,O,Id = spinOps(spinmag)
function H(i::Integer)
return [Id O O;
Sz O O;
O Sz Id]
end
isingmpo = makeMPO(H,size(Id,1),Ns)
DMRJtensor.makeMPS
— MethodmakeMPS(vect,physInd[,Ns=,oc=])
generates an MPS from a single vector expressed as a denstens
(i.e., from exact diagonalization) for Ns
sites and physInd
size physical index at orthogonality center oc
DMRJtensor.makeMPS
— MethodmakeMPS(vect,physInd[,Ns=,oc=])
generates an MPS from a single vector (i.e., from exact diagonalization) for Ns
sites and physInd
size physical index at orthogonality center oc
DMRJtensor.makeMPS
— MethodmakeMPS(vect,physInd[,Ns=,oc=])
generates an MPS from a single vector expressed as a denstens
(i.e., from exact diagonalization) for Ns
sites and physInd
an integer that is equal on all sites for the size physical index at orthogonality center oc
DMRJtensor.makeqMPO
— Methodmpo = makeqMPO(Qlabels,mpo)
Generates quantum number MPO from a dense Hamiltonian based on Qlabels
Arguments:
mpo::MPO
: dense MPOQlabels::Array{Array{Qnum,1},1}
: quantum numbers for physical indices (modulus size of vector)
DMRJtensor.makeqMPO
— Methodmpo = makeqMPO(Qlabels,mpo)
Generates quantum number MPO from a dense Hamiltonian based on Qlabels
Arguments:
mpo::MPO
: dense MPOQlabels::Array{Qnum,1}
: quantum numbers for physical indices (uniform)
DMRJtensor.makeqMPS
— MethodmakeqMPS(mps,Qlabels[,newnorm=true,setflux=false,flux=...,randomize=true,override=true,lastfluxzero=false])
creates quantum number MPS from regular MPS according to Qlabels
Optional arguments
mps::MPS
: dense MPSQlabels::Array{Array{Qnum,1},1}
: quantum number labels on each physical index (assigns physical index labels mod size of this vector)newnorm::Bool
: set new norm of the MPS tensorsetflux::Bool
: toggle to force this to be the total flux of the MPS tensorflux::Qnum
: quantum number to force total MPS flux to be if setflux=truerandomize::Bool
: randomize last tensor if flux forces a zero tensorlastfluxzero::Bool
: determines whether the rightmost flux should be zero or not
DMRJtensor.makeqMPS
— MethodmakeqMPS(Qlabels,mps[,newnorm=true,setflux=false,flux=...,randomize=true,override=true,lastfluxzero=false])
creates quantum number MPS from regular MPS according to Qlabels
Optional arguments
mps::MPS
: dense MPSQlabels::Array{Array{Qnum,1},1}
: quantum number labels on each physical index (assigns physical index labels mod size of this vector)newnorm::Bool
: set new norm of the MPS tensorsetflux::Bool
: toggle to force this to be the total flux of the MPS tensorflux::Qnum
: quantum number to force total MPS flux to be if setflux=truerandomize::Bool
: randomize last tensor if flux forces a zero tensorlastfluxzero::Bool
: determines whether the rightmost flux should be zero or not
DMRJtensor.makeqMPS
— MethodmakeqMPS(Qlabels,arr[,newnorm=true,setflux=false,flux=...,randomize=true,override=true,lastfluxzero=false])
creates quantum number MPS from an input array or network
(arr
) according to Qlabels
Optional arguments:
mps::MPS
: dense MPSQlabels::Array{Array{Qnum,1},1}
: quantum number labels on each physical index (assigns physical index labels mod size of this vector)newnorm::Bool
: set new norm of the MPS tensorsetflux::Bool
: toggle to force this to be the total flux of the MPS tensorflux::Qnum
: quantum number to force total MPS flux to be if setflux=truerandomize::Bool
: randomize last tensor if flux forces a zero tensorlastfluxzero::Bool
: determines whether the rightmost flux should be zero or not
DMRJtensor.maketerm
— MethodDMRJtensor.maketerm
— MethodDMRJtensor.move!
— Methodmove!(psi,newoc[,m=,cutoff=,minm=])
in-place move orthgononality center of psi
to a new site, newoc
, with a maximum bond dimenion m
, cutoff cutoff
, and minimum bond dimension minm
; toggle truncation of tensor during movement with condition
See also: move
DMRJtensor.move
— MethodDMRJtensor.moveL!
— MethodmoveL!(psi[,cutoff=,m=,minm=,condition=])
acts in-place to move psi
's orthogonality center left one space, with a maximum bond dimenion m
, cutoff cutoff
, and minimum bond dimension minm
; toggle truncation of tensor during movement with condition
See also: moveL
DMRJtensor.moveL!
— MethodD,truncerr = moveL(Lpsi,Rpsi[,cutoff=,m=,minm=,condition=])
moves psi
's orthogonality center left one space, with a maximum bond dimenion m
, cutoff cutoff
, minimum bond dimension minm
; toggle truncation of tensor during movement with condition
; returns psi[iL],psi[iR],D from the SVD, and the truncation error. Modifies Rpsi
See also: moveL!
DMRJtensor.moveL
— MethodD,truncerr = moveL(Lpsi,Rpsi[,cutoff=,m=,minm=,condition=])
moves psi
's orthogonality center left one space, with a maximum bond dimenion m
, cutoff cutoff
, minimum bond dimension minm
; toggle truncation of tensor during movement with condition
; returns psi[iL],psi[iR],D from the SVD, and the truncation error. Does not modify Lpsi
and Rpsi
See also: moveL!
DMRJtensor.moveR!
— MethodD,truncerr = moveR!(psi[,cutoff=,m=,minm=,condition=])
acts in-place to move psi
's orthogonality center right one space, with a maximum bond dimenion m
, cutoff cutoff
, and minimum bond dimension minm
; toggle truncation of tensor during movement with condition
See also: moveR
DMRJtensor.moveR!
— MethodD,truncerr = moveR!(Lpsi,Rpsi[,cutoff=,m=,minm=,condition=])
moves psi
's orthogonality center right one space, with a maximum bond dimenion m
, cutoff cutoff
, minimum bond dimension minm
; toggle truncation of tensor during movement with condition
; returns psi[iL],psi[iR],D from the SVD, and the truncation error Modifies Lpsi
See also: moveR!
DMRJtensor.moveR
— MethodD,truncerr = moveR(Lpsi,Rpsi[,cutoff=,m=,minm=,condition=])
moves psi
's orthogonality center right one space, with a maximum bond dimenion m
, cutoff cutoff
, minimum bond dimension minm
; toggle truncation of tensor during movement with condition
; returns psi[iL],psi[iR],D from the SVD, and the truncation error
See also: moveR!
DMRJtensor.movecenter!
— MethodDMRJtensor.mult
— MethodDMRJtensor.mult
— MethodDMRJtensor.mult
— MethodDMRJtensor.mult
— MethodDMRJtensor.nameMPO
— MethodDMRJtensor.nameMPS
— MethodDMRJtensor.operator_in_order!
— Methodoperator_in_order!(pos,sizes)
Increments elements of input vector pos
by one step (last element first) with sizes of a tensor sizes
such that pos
. For use in correlation
function.
DMRJtensor.optimize
— Methodinfovals: stores current energy (skips initialization for it), truncation error, entanglement entropy on requested bond (default center), largest m value, noise parameter <–-switch to second slot
DMRJtensor.penalty!
— Methodpenalty!(mpo,lambda,psi[,compress=])
Adds penalty to Hamiltonian (mpo
), H0, of the form H0 + lambda
* |psi
><psi
|; toggle to compress resulting wavefunction
See also: penalty
DMRJtensor.penalty
— MethodDMRJtensor.permutations
— MethodG = permutations(nelem)
Heap algorithm for finding permutations of nelem
elements. Output G
is an Vector of all permutations stored as vectors. For example, a permutation of [1,2,3,4] is [2,1,3,4].
DMRJtensor.qubitOps
— Methodox,oy,oz,op,om,Rx,Ry,Rz,H,O,Id = qubits([,d=2,angle=pi/4])
Creates a set of Pauli operators for a certain number of states d
and angle for a rotation gate angle
#Outputs:
ox
: Pauli-x operatoroy
: Pauli-y operatoroz
: Pauli-z operatorop
: raising operatorom
: lowering operatorRx
: rotation of x-axis operatorRy
: rotation of y-axis operatorRz
: rotation of z-axis operatorH
: Hadamard gateO
: zero matrixId
: identity matrix
DMRJtensor.qubitOps
— Methodox,oy,oz,op,om,Rx,Ry,Rz,H,O,Id = qubits(d[,angle=pi/4])
Creates a set of Pauli operators for a certain number of states d
and angle for a rotation gate angle
#Outputs:
ox
: Pauli-x operatoroy
: Pauli-y operatoroz
: Pauli-z operatorop
: raising operatorom
: lowering operatorRx
: rotation of x-axis operatorRy
: rotation of y-axis operatorRz
: rotation of z-axis operatorH
: Hadamard gateO
: zero matrixId
: identity matrix
DMRJtensor.randMPS
— Methodpsi = randMPS(T,physindsize,Ns[,oc=1,m=1])
Generates random MPS with data type T
, uniform physical index size physindsize
(integer), with Ns
sites, orthogonality center oc
, and bond dimension m
.
DMRJtensor.randMPS
— Methodpsi = randMPS(physindsize,Ns[,oc=1,m=1])
Generates random MPS with data type Float64, uniform physical index size physindsize
, with Ns
sites, orthogonality center oc
, and bond dimension m
.
DMRJtensor.randMPS
— Methodpsi = randMPS(mpo[,oc=...,m=...,datatype=...,physind=...])
Generates random MPS from an input MPO mpo
; parameters chosen for a generic classical product state in terms of the orthogonality center, bond dimension, data type in each tensor, and physical indices
DMRJtensor.randMPS
— Methodnewpsi = randMPS(psi[,oc=...,m=...,datatype=...,physind=...])
Generates random MPS from an input MPS psi
; parameters taken from psi
for orthogonality center, bond dimension, data type in each tensor, and physical indices
DMRJtensor.randMPS
— Methodpsi = randMPS(Qlabel,Ns[,m=2,type=Float64,flux=...])
generates a random MPS from qnum
s on a given site stored in an array of vectors Qlabel
for Ns
sites (will repeat if Ns
is longer than array); bond dimension m
; type
for the element types; and overall flux
(default zero of type given in Qlabel
)
DMRJtensor.randMPS
— Methodpsi = randMPS(Qlabel,Ns[,m=2,type=Float64,flux=...])
generates a random MPS from qnum
s on a given site stored in a vector Qlabel
for Ns
sites; bond dimension m
; type
for the element types; and overall flux
(default zero of type given in Qlabel
)
DMRJtensor.randMPS
— Methodpsi = randMPS(physindvec[,oc=1,m=1])
Generates random MPS with data type Float64, physical index size vector physindvec
, with Ns
sites, orthogonality center oc
, and bond dimension m
.
DMRJtensor.randMPS
— Methodpsi = randMPS(T,physindvec,Ns[,oc=1,m=1])
Generates random MPS with data type T
, physical index size vector physindvec
(repeating over Ns
sites), with Ns
sites, orthogonality center oc
, and bond dimension m
.
DMRJtensor.randMPS
— Methodpsi = randMPS(physindvec,Ns[,oc=1,m=1])
Generates random MPS with data type Float64, physical index size vector physindvec
(repeating over Ns
sites, physindvec
can be smaller than Ns
where the inputs will repeat), orthogonality center oc
, and bond dimension m
.
DMRJtensor.reorder!
— Methodreorder!(C[,Ncols=])
Reorders the Ncols
columns of C
according to the Fiedler vector reordering in place if site is not 0
See also: reorder
DMRJtensor.reorder
— Methodreorder(C[,Ncols=])
Reorders the Ncols
columns of C
according to the Fiedler vector reordering if site is not 0
See also: reorder!
DMRJtensor.rightnormalize!
— MethodU,D,psi = rightnormalize!(psi)
Creates a right-normalized MPS in-place from psi
and returns the external tensors U
and D
DMRJtensor.rightnormalize
— MethodU,D,newpsi = rightnormalize(psi)
Creates a right-normalized MPS newpsi
from psi
and returns the external tensors U
and D
DMRJtensor.spinOps
— MethodSp,Sm,Sz,Sy,Sx,O,Id = spinOps(s)
Generates operators for a heisenberg model (spin-s
)
#Outputs:
Sx
: spin-x operatorSy
: spin-y operatorSz
: spin-z operatorSp
: raising operatorSm
: lowering operatorH
: Hadamard gateO
: zero matrixId
: identity matrix
DMRJtensor.spinOps
— MethodSp,Sm,Sz,Sy,Sx,O,Id = spinOps([,s=0.5])
Generates operators for a heisenberg model (spin-s
, default 1/2)
#Outputs:
Sx
: spin-x operatorSy
: spin-y operatorSz
: spin-z operatorSp
: raising operatorSm
: lowering operatorH
: Hadamard gateO
: zero matrixId
: identity matrix
DMRJtensor.substringnumber
— MethodDMRJtensor.tJOps
— MethodCup,Cdn,F,Nup,Ndn,Ndens,Sp,Sm,Sz,O,Id = tJOps()
Operators for a t-J model
#Outputs:
Cup
: spin-up annihilation operatorCdn
: spin-down annihilation operatorF
: Jordan-Wigner Fermion stringNup
: spin-up number operatorNdn
: spin-dn number operatorNdens
: total-spin number operatorSp
: spin-raising operatorSm
: spin-lowering operatorSz
: spin-z operatorO
: zero matrixId
: identity matrix
DMRJtensor.tjMPO
— MethodtjMPO(i[,t=1.0,mu=0.0,J=1.0])
Creates a bulk MPO of the t-J model for uniform kinetic energy t
, onsite energy mu
, and spin coupling J
See also: XXZ
DMRJtensor.transfermatrix
— Methodtransfermatrix(psi,i,j[,transfermat=])
Forms the transfer matrix (an MPS psi
) between sites i
and j
(inclusive). If not specified, the transfermat
field will initialize to the transfer matrix from the i-1
site
The form of the transfer matrix must be is as follows (dual wavefunction tensor on top, conjugated)
1 –––––– 3 | | | | 2 –––––– 4
There is no in-place version of this function
DMRJtensor.transfermatrix
— Methodtransfermatrix(dualpsi,psi,i,j[,transfermat=])
Forms the transfer matrix (an MPS psi
and its dual dualpsi
contracted along the physical index) between sites i
and j
(inclusive). If not specified, the transfermat
field will initialize to the transfer matrix from the i-1
site
The form of the transfer matrix must be is as follows (dual wavefunction tensor on top, conjugated)
1 –––––– 3 | | | | 2 –––––– 4
There is no in-place version of this function
TensorPACK.add!
— Methodadd!(A,B)
functionality for adding (similar to direct sum) of MPOs together and replacing A
; uses joinindex function to make a combined MPO
note: deparallelizes after every addition
See also: deparallelization
+
TensorPACK.div!
— Methoddiv!(psi,c)
takes input MPS psi
and divides orthogonality center by a number c
. Some number types require conversaion of psi
See also: convertTensor
MPS
TensorPACK.eigen
— MethodD,U,truncerr,mag = eigen(H)
Computes eigenvalue decomposition of an input MPO H
that is contracted into the Hamiltonian tensor (will give a fault if the resulting array is too large); useful for small systems
#Inputs:
A
: AnyTensType
in the library
#Outputs:
D
: A diagonal matrix containing eigenvaluesU
: A unitary matrix (UDU' is A)truncerr
: total truncation error (L-1 norm)mag
: magnitude of the output tensor
TensorPACK.mult!
— Methodmult!(A,B)
functionality for adding (similar to direct sum) of MPOs together and replacing A
; uses joinindex function to make a combined MPO
note: Does not compress the bond dimension (recommend to use compressMPO! afterwards)
See also: compressMPO!
*
TensorPACK.mult!
— Methodmult!(psi,c)
takes input MPS psi
and multiplies orthogonality center by a number c
. Some number types require conversaion of psi
See also: convertTensor
MPS
TensorPACK.mult!
— Methodmult!(c,psi)
takes input MPS psi
and multiplies orthogonality center by a number c
. Some number types require conversaion of psi
See also: convertTensor
MPS