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
Return the number of states, and lookup-dictionaries for translating a state (`SVector`) to a state index, and vice versa, for a system with a given number of components and maximum number of excitations.
81
81
82
82
# Arguments
83
83
- `dims::Union{AbstractVector,Tuple}`: A list of the number of states in each sub-system
84
-
- `excitations::Int`: Maximum number of excitations
84
+
- `n_excitations::Int`: Maximum number of excitations
85
85
86
86
# Returns
87
87
- `nstates`: Number of states
88
88
- `state2idx`: A dictionary for looking up a state index from a state (`SVector`)
89
89
- `idx2state`: A dictionary for looking up state (`SVector`) from a state index
90
90
"""
91
-
functionenr_state_dictionaries(dims::Union{AbstractVector{T},NTuple{N,T}}, excitations::Int) where {T<:Integer,N}
91
+
functionenr_state_dictionaries(dims::Union{AbstractVector{T},NTuple{N,T}}, n_excitations::Int) where {T<:Integer,N}
92
92
# argument checks
93
93
_non_static_array_warning("dims", dims)
94
94
L =length(dims)
95
95
(L >0) ||throw(DomainError(dims, "The argument dims must be of non-zero length"))
96
96
all(>=(1), dims) ||throw(DomainError(dims, "All the elements of dims must be non-zero integers (≥ 1)"))
97
-
(excitations>0) ||throw(DomainError(excitations, "The argument excitations must be a non-zero integer (≥ 1)"))
97
+
(n_excitations>0) ||throw(DomainError(n_excitations, "The argument n_excitations must be a non-zero integer (≥ 1)"))
98
98
99
99
nvec =zeros(Int, L) # Vector
100
100
nexc =0
@@ -106,7 +106,7 @@ function enr_state_dictionaries(dims::Union{AbstractVector{T},NTuple{N,T}}, exci
106
106
nvec[end] +=1
107
107
nexc +=1
108
108
(nvec[idx] < dims[idx]) &&push!(result, nvec)
109
-
while (nexc ==excitations) || (nvec[idx] == dims[idx])
109
+
while (nexc ==n_excitations) || (nvec[idx] == dims[idx])
110
110
idx -=1
111
111
112
112
# if idx < 1, break while-loop and return
@@ -124,25 +124,25 @@ function enr_state_dictionaries(dims::Union{AbstractVector{T},NTuple{N,T}}, exci
Generate the Fock state representation ([`Ket`](@ref)) in an excitation number restricted state space ([`EnrSpace`](@ref)).
131
131
132
-
The arguments `dims` and `excitations` are used to generate [`EnrSpace`](@ref).
132
+
The arguments `dims` and `n_excitations` are used to generate [`EnrSpace`](@ref).
133
133
134
134
The `state` argument is a list of integers that specifies the state (in the number basis representation) for which to generate the Fock state representation.
135
135
136
136
!!! warning "Beware of type-stability!"
137
-
It is highly recommended to use `enr_fock(dims, excitations, state)` with `dims` as `Tuple` or `SVector` from [StaticArrays.jl](https://github.com/JuliaArrays/StaticArrays.jl) to keep type stability. See [this link](https://docs.julialang.org/en/v1/manual/performance-tips/#man-performance-value-type) and the [related Section](@ref doc:Type-Stability) about type stability for more details.
137
+
It is highly recommended to use `enr_fock(dims, n_excitations, state)` with `dims` as `Tuple` or `SVector` from [StaticArrays.jl](https://github.com/JuliaArrays/StaticArrays.jl) to keep type stability. See [this link](https://docs.julialang.org/en/v1/manual/performance-tips/#man-performance-value-type) and the [related Section](@ref doc:Type-Stability) about type stability for more details.
138
138
"""
139
139
functionenr_fock(
140
140
dims::Union{AbstractVector{T},NTuple{N,T}},
141
-
excitations::Int,
141
+
n_excitations::Int,
142
142
state::AbstractVector{T};
143
143
sparse::Union{Bool,Val}=Val(false),
144
144
) where {T<:Integer,N}
145
-
s_enr =EnrSpace(dims, excitations)
145
+
s_enr =EnrSpace(dims, n_excitations)
146
146
returnenr_fock(s_enr, state, sparse = sparse)
147
147
end
148
148
functionenr_fock(s_enr::EnrSpace, state::AbstractVector{T}; sparse::Union{Bool,Val}=Val(false)) where {T<:Integer}
@@ -157,25 +157,25 @@ function enr_fock(s_enr::EnrSpace, state::AbstractVector{T}; sparse::Union{Bool,
Generate the thermal state (density [`Operator`](@ref)) in an excitation number restricted state space ([`EnrSpace`](@ref)).
164
164
165
-
The arguments `dims` and `excitations` are used to generate [`EnrSpace`](@ref).
165
+
The arguments `dims` and `n_excitations` are used to generate [`EnrSpace`](@ref).
166
166
167
167
The argument `n` is a list that specifies the expectation values for number of particles in each sub-system. If `n` is specified as a real number, it will apply to each sub-system.
168
168
169
169
!!! warning "Beware of type-stability!"
170
-
It is highly recommended to use `enr_thermal_dm(dims, excitations, n)` with `dims` as `Tuple` or `SVector` from [StaticArrays.jl](https://github.com/JuliaArrays/StaticArrays.jl) to keep type stability. See [this link](https://docs.julialang.org/en/v1/manual/performance-tips/#man-performance-value-type) and the [related Section](@ref doc:Type-Stability) about type stability for more details.
170
+
It is highly recommended to use `enr_thermal_dm(dims, n_excitations, n)` with `dims` as `Tuple` or `SVector` from [StaticArrays.jl](https://github.com/JuliaArrays/StaticArrays.jl) to keep type stability. See [this link](https://docs.julialang.org/en/v1/manual/performance-tips/#man-performance-value-type) and the [related Section](@ref doc:Type-Stability) about type stability for more details.
Generate a `Tuple` of annihilation operators for each sub-system in an excitation number restricted state space ([`EnrSpace`](@ref)). Thus, the return `Tuple` will have the same length as `dims`.
211
211
212
-
The arguments `dims` and `excitations` are used to generate [`EnrSpace`](@ref).
212
+
The arguments `dims` and `n_excitations` are used to generate [`EnrSpace`](@ref).
213
213
214
214
!!! warning "Beware of type-stability!"
215
-
It is highly recommended to use `enr_destroy(dims, excitations)` with `dims` as `Tuple` or `SVector` from [StaticArrays.jl](https://github.com/JuliaArrays/StaticArrays.jl) to keep type stability. See [this link](https://docs.julialang.org/en/v1/manual/performance-tips/#man-performance-value-type) and the [related Section](@ref doc:Type-Stability) about type stability for more details.
215
+
It is highly recommended to use `enr_destroy(dims, n_excitations)` with `dims` as `Tuple` or `SVector` from [StaticArrays.jl](https://github.com/JuliaArrays/StaticArrays.jl) to keep type stability. See [this link](https://docs.julialang.org/en/v1/manual/performance-tips/#man-performance-value-type) and the [related Section](@ref doc:Type-Stability) about type stability for more details.
216
216
"""
217
-
functionenr_destroy(dims::Union{AbstractVector{T},NTuple{N,T}}, excitations::Int) where {T<:Integer,N}
218
-
s_enr =EnrSpace(dims, excitations)
217
+
functionenr_destroy(dims::Union{AbstractVector{T},NTuple{N,T}}, n_excitations::Int) where {T<:Integer,N}
Generate the identity operator in an excitation number restricted state space ([`EnrSpace`](@ref)).
249
253
250
-
The arguments `dims` and `excitations` are used to generate [`EnrSpace`](@ref).
254
+
The arguments `dims` and `n_excitations` are used to generate [`EnrSpace`](@ref).
251
255
252
256
!!! warning "Beware of type-stability!"
253
-
It is highly recommended to use `enr_identity(dims, excitations)` with `dims` as `Tuple` or `SVector` from [StaticArrays.jl](https://github.com/JuliaArrays/StaticArrays.jl) to keep type stability. See [this link](https://docs.julialang.org/en/v1/manual/performance-tips/#man-performance-value-type) and the [related Section](@ref doc:Type-Stability) about type stability for more details.
257
+
It is highly recommended to use `enr_identity(dims, n_excitations)` with `dims` as `Tuple` or `SVector` from [StaticArrays.jl](https://github.com/JuliaArrays/StaticArrays.jl) to keep type stability. See [this link](https://docs.julialang.org/en/v1/manual/performance-tips/#man-performance-value-type) and the [related Section](@ref doc:Type-Stability) about type stability for more details.
254
258
"""
255
-
functionenr_identity(dims::Union{AbstractVector{T},NTuple{N,T}}, excitations::Int) where {T<:Integer,N}
256
-
s_enr =EnrSpace(dims, excitations)
259
+
functionenr_identity(dims::Union{AbstractVector{T},NTuple{N,T}}, n_excitations::Int) where {T<:Integer,N}
0 commit comments