DMRJtensor.DMRJtensor
— ModuleDMRjulia (version 0.9.6)
(made for julia v1.5.4+ (March 11, 2021), see included license)
Code: https://github.com/bakerte/DMRjulia.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, 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 Modeling of Molecules and Materials
- Department of Physics & Astronomy, University of Victoria
- Department of Chemistry, University of Victoria
Running the julia kernel with –check-bounds=no can decrease runtimes by 20%
DMRJtensor.Env
— TypeEnv
A global super-type for the environment defined either with envType
or AbstractArray
DMRJtensor.file_extension
— ConstantDMRJtensor.half
— ConstantDMRJtensor.largeType
— TypeDMRJtensor.MPO
— TypeMPO
Abstract types for MPO
DMRJtensor.MPO
— Methodmpo = MPO(H[,regtens=false])
constructor for MPO with tensors H
either a vector of tensors or the MPO. regtens
outputs with the julia Array type
DMRJtensor.MPO
— Methodmpo = MPO(T,H[,regtens=false])
constructor for MPO with tensors H
either a vector of tensors or the MPO
; can request an 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
— 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(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=1])
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)
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
— 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
— MethodV = environment(T...)
Inputs tensors T
into environment V
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.regMPO
— TypeMPO
Abstract types for MPO
DMRJtensor.regMPS
— TypeMPS
Abstract types for MPS
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.:*
— 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.:+
— 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: deparallelizes after every addition
See also: deparallelization
add!
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.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 vector of strings names
representing the new filenames
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
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
Base.eltype
— MethodG = eltype(Y)
eltype
gets element type G
of the Env
, MPS
, or MPO
tensor fields
Base.getindex
— MethodG = getindex(A,i)
getindex
allows to retrieve tensor G
at position i
from Env
, MPS
or MPO
Base.getindex
— MethodG = getindex(A,r)
getindex
allows to retrieve a range r
(ex: r = 2:6) tensor G
from Env
, MPS
or MPO
Base.lastindex
— MethodB = psi[end]
lastindex!
allows to get the end element of an Env
, MPS
, or MPO
Base.length
— MethodG = length(H)
length
prints out the number of entries of the input H
being a Env
, MPS
, or MPO
; this is effecitvely the number of sites
Base.setindex!
— Methodpsi[i] = G
setindex! allows to assign elements G
to an Env
, MPS
, or MPO
at element i
Base.size
— MethodG = size(H,i)
size
prints out the size tuple G
of the tensor field of a Env
, MPS
, or MPO
; this is effectively the number of sites
Base.size
— MethodG = size(H)
size
prints out the size tuple G
of the tensor field of a Env
, MPS
, or MPO
; this is effectively the number of sites
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.applyMPO
— MethodapplyMPO(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
— MethodapplyMPO(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.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
— Methodcorrelation(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.
See also: expect
correlationmatrix
DMRJtensor.correlation
— Methodcorrelation(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.
See also: expect
correlationmatrix
DMRJtensor.correlationmatrix
— Methodcorrelationmatrix(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
Note:
- More efficient than using
mpoterm
s - Use
mpoterm
andapplyMPO
for higher order correlation functions or write a new function
DMRJtensor.correlationmatrix
— Methodcorrelationmatrix(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
Example:
Cup, Cdn, Nup, Ndn, Ndens, F, O, Id = fermionOps()
rho = correlationmatrix(psi,Cup',Cup,F) #density matrix
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.expect
— Methodexpect(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
See also: overlap
DMRJtensor.expect
— Methodexpect(psi,H[,Lbound=,Rbound=,order=])
evaluate <psi
|H
|psi
> for any number of MPOs H
; can specifcy left and right boundaries (Lbound
and Rbound
)
See also: overlap
DMRJtensor.fermionOps
— MethodfermionOps()
Make fermion operators Cup,Cdn,F,Nup,Ndn,Ndens,O,Id
DMRJtensor.fullH
— MethodfullH(mpo)
Generates the full Hamiltonian from an MPO (memory providing); assumes lower left triagular form
DMRJtensor.fullpsi
— Methodfullpsi(psi)
Generates the full wavefunction from an MPS (memory providing)
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
— MethodmakeBoundary(qind,newArrows[,retType=])
makes a boundary tensor 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.makeEnds
— MethodmakeEnds(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
— MethodmakeEnds(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
— MethodmakeEnv(psi,mpo[,Lbound=,Rbound=])
Generates environment tensors for a MPS (psi
) with boundaries Lbound
and Rbound
DMRJtensor.makeEnv
— MethodmakeEnv(dualpsi,psi,mpo[,Lbound=,Rbound=])
Generates environment tensors for a MPS (psi
and its dual dualpsi
) with boundaries Lbound
and Rbound
DMRJtensor.makeMPO
— MethodmakeMPO(H,physSize,Ns[,infinite=,lower=])
Converts function or vector (H
) to each of Ns
MPO tensors; 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)
Example:
spinmag = 0.5;Ns = 10
Sx,Sy,Sz,Sp,Sm,O,Id = spinOps(spinmag)
function H(i::Integer)
return [Id 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 (i.e., from exact diagonalization) for Ns
sites and physInd
size physical index at orthogonality center oc
DMRJtensor.makeqMPO
— MethodmakeqMPO(Qlabels,mpo[,arrows])
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)arrows::Array{Bool,1}
: arrow convention for quantum numbers (default: [false,false,true,true])
DMRJtensor.makeqMPO
— MethodmakeqMPO(Qlabels,mpo[,arrows])
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)arrows::Array{Bool,1}
: arrow convention for quantum numbers (default: [false,false,true,true])
DMRJtensor.makeqMPS
— MethodmakeqMPS(mps,Qlabels[,arrows,newnorm=,setflux=,flux=,randomize=,override=])
creates quantum number MPS from regular MPS according to Qlabels
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)arrows::Array{Bool,1}
: first entry of this tuple is the arrow convention on MPS tensors (default: [false,true,true])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 tensor
DMRJtensor.makeqMPS
— MethodmakeqMPS(Qlabels,mps[,arrows,newnorm=,setflux=,flux=,randomize=,override=])
creates quantum number MPS from regular MPS according to Qlabels
Arguments
mps::MPS
: dense MPSQlabels::Array{Qnum,1}
: quantum number labels on each physical index (uniform physical indices)arrows::Array{Bool,1}
: first entry of this tuple is the arrow convention on MPS tensors (default: [false,true,true])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 tensor
DMRJtensor.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.nameMPO
— MethodDMRJtensor.nameMPS
— MethodDMRJtensor.operator_in_order!
— Methodoperatorinorder!(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.randMPS
— Methodpsi = randMPS(T,physindsize,Ns[,oc=1,m=1])
Generates MPS with data type T
, uniform physical index size physindsize
, with Ns
sites, orthogonality center oc
, and bond dimension m
.
DMRJtensor.randMPS
— Methodpsi = randMPS(physindsize,Ns[,oc=1,m=1])
Generates MPS with data type Float64, uniform physical index size physindsize
, with Ns
sites, orthogonality center oc
, and bond dimension m
.
DMRJtensor.randMPS
— Methodpsi = randMPS(T,physindvec,Ns[,oc=1,m=1])
Generates MPS with data type Float64, physical index size vector physindvec
(repeating over Ns
sites), with Ns
sites, orthogonality center oc
, and bond dimension m
.
DMRJtensor.randMPS
— Methodpsi = randMPS(T,physindvec,Ns[,oc=1,m=1])
Generates 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.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
— MethodspinOps([,s=0.5])
Generates operators Sp,Sm,Sz,Sy,Sx,O,Id for a heisenberg model (spin-s
, default 1/2)
DMRJtensor.tJOps
— MethodtJOps()
Operators for a t-J model Cup,Cdn,F,Nup,Ndn,Ndens,Sp,Sm,Sz,O,Id
DMRJtensor.tensor2disc
— Methodtensor2disc(name,tensor[,ext=".dmrjulia"])
Writes tensor
to disc with the Serialization package and filename name
*ext
See also: tensorfromdisc
DMRJtensor.tensorfromdisc
— MethodA = tensorfromdisc(name[,ext=".dmrjulia"])
Reads tensor A
from disc with the Serialization package and filename name
*ext
See also: tensor2disc
DMRJtensor.transfermatrix
— Methodtransfermatrix([dualpsi,]psi,i,j[,transfermat=])
Forms the transfer matrix (an MPS tensor and its dual 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. If not set otherwise, dualpsi = psi
.
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
— Methodeigen(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)
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