You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/IntrTree/IntrIterator.jl
+24-25Lines changed: 24 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
-
"""
2
-
abstract type AbstractInteractionIterator{L}
3
-
The abstract type for the iterator of interaction terms. All the concrete subtypes should implement the `iterate` method so that the following usages are both valid where
1
+
"""
2
+
abstract type AbstractInteractionIterator{L}
3
+
The abstract type for the iterator of interaction terms. All the concrete subtypes should implement the `iterate` method so that the following usages are both valid where
4
4
`Ops` is an instance of `AbstractInteractionIterator`.
5
5
```julia
6
6
for O in Ops
7
7
# the i-th loop will give the i-th LocalOperator
8
8
end
9
9
10
-
collect(Ops) # return the vector of all LocalOperators
10
+
collect(Ops) # return the vector of all LocalOperators
11
11
```
12
12
"""
13
13
abstract type AbstractInteractionIterator{L} end
@@ -21,14 +21,14 @@ length(::AbstractInteractionIterator{L}) where L = L
21
21
Op::AbstractLocalOperator
22
22
Z::T
23
23
end
24
-
24
+
25
25
The iterator for on-site terms such as bosonic `n_i` or fermionic `c_i` together with its Jordan-Wigner string`Z_{i+1} Z_{i+2} ... Z_{L}`.
26
26
27
27
# Fields
28
28
Op::AbstractLocalOperator
29
29
The local operator which tells both the operator and its site index.
30
30
31
-
Z::Nothing
31
+
Z::Nothing
32
32
For bosonic operators.
33
33
Z::AbstractTensorMap
34
34
For fermionic operators. Assume all sites are fermionic therefore each site after `Op` will give `Z` operator.
@@ -44,7 +44,7 @@ Direct constructor.
44
44
si::Int64;
45
45
swap::Bool=false,
46
46
Z=nothing)
47
-
Generate the `LocalOperator` object with `Op`, `name`, `si` and kwarg `swap`, details please see the constructors of `LocalOperator`.
47
+
Generate the `LocalOperator` object with `Op`, `name`, `si` and kwarg `swap`, details please see the constructors of `LocalOperator`.
functioniterate(iter::OnSiteInteractionIterator{L, <:AbstractTensorMap}, i::Int64=1) where {L}
79
+
functioniterate(iter::OnSiteInteractionIterator{L, <:AbstractTensorMap}, i::Int64=1) where {L}
80
80
i > L &&returnnothing
81
81
if i == iter.Op.si
82
82
Op_wrap = iter.Op
@@ -111,7 +111,7 @@ end
111
111
end
112
112
113
113
The iterator for two-site terms such as bosonic `n_i n_j` or fermionic `c_i c_j` together with its Jordan-Wigner string `Z_{i+1} Z_{i+2} ... Z_{j}`.
114
-
114
+
115
115
Note the two site indices can be in both ascending and descending order but should not be the same. For the latter case, please use `OnSiteInteractionIterator` to get an on-site term instead.
116
116
117
117
# Fields
@@ -123,7 +123,7 @@ The local operators.
123
123
For bosonic operators.
124
124
Z::AbstractTensorMap
125
125
For fermionic operators. Note we assume both `O₁` and `O₂` are fermionic operators if `Z ≠ nothing`.
126
-
Z::AbstractVector
126
+
Z::AbstractVector{<:AbstractTensorMap}
127
127
Directly give the `Z` operator for each site to deal with the systems mixed with bosons and fermions.
128
128
129
129
# Constructors
@@ -135,7 +135,7 @@ Direct constructor.
135
135
si::NTuple{2, Int64};
136
136
convertRight::Bool=false,
137
137
Z=nothing)
138
-
Generate the `LocalOperator` objects with 2-tuples `Op`, `name` and `si`. If `convertRight == true`, convert the the second operator (with larger site index, can be `O₁` or `O₂`) to a right one (i.e. only have left horizontal leg), which is used to uniquely determine the contraction when calculating ITP.
138
+
Generate the `LocalOperator` objects with 2-tuples `Op`, `name` and `si`. If `convertRight == true`, convert the the second operator (with larger site index, can be `O₁` or `O₂`) to a right one (i.e. only have left horizontal leg), which is used to uniquely determine the contraction when calculating ITP.
Provide the fermion parity operator `Z` and the local physical space `pspace`. Assume a site-independent `Z` or `pspace` if a single object is provided, otherwise, a length-`L` vector is expected to deal with the site-dependent cases.
244
+
Provide the fermion parity operator `Z` and the local physical space `pspace`. Assume a site-independent `Z` or `pspace` if a single object is provided, otherwise, a length-`L` vector is expected to deal with the site-dependent cases.
0 commit comments