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
##### sites is a vector of lattice sites on which the operators act.
11
+
##### Operators is a vector of local operators acting on the sites. Each operator is a sparse matrix in the full local Fock basis.
12
+
13
+
FinalFockSubStates =kron(selectdim.(adjoint.(Operators), 2, config.FockState[sites])...) ##### the final Fock state in the subspace where the operators act after the action of the operators. The non-zero indices of this sparse vector tells us the final posisble Fock sub-states |x'> where the operators take the current configuration, |x> to, and the corresponding non-zero values tell us the expectation value <x'| O | x>.
14
+
localFockDimensions = Operators[begin].m
15
+
localDim =log2(localFockDimensions)
16
+
17
+
estimator::ComplexF64=0.0+0.0im
18
+
##### TODO : This loop can be broadcasted?
19
+
for finalSubState in FinalFockSubStates.nzind
20
+
##### The final fock state is the same in all the sites where the operators do not act.
21
+
finalFullFockState =copy(config.FockState)
22
+
finalFullFockState[sites] =reverse(digits(finalSubState -1, localFockDimensions, pad =length(sites))) ##### a given final fock sub-state is converted into a vector of ints representing the final fock state on each site where the operators act.
23
+
24
+
expectation = FinalFockSubStates[finalSubState] ##### the expectation value <x'| O | x> for the final Fock sub-state |x'>.
25
+
26
+
finalOccupancy =GetOccupancy(finalFullFockState, localDim) ##### the final occupancy vector in the sites sub-space for the final Fock state |x'>.
27
+
@assertsum(finalOccupancy) == config.ParticleCount "Operators being measured must conserve the number of particles."
28
+
29
+
change = finalOccupancy - config.Occupancy ##### the change in the occupancy vector in the sites sub-space.
30
+
annihilated =findall(==(-1), change) ##### the orbitals that are annihilated by the operators.
31
+
created =findall(==(1), change) ##### the orbitals that are created by the operators.
0 commit comments