Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kmsherbertvt committed May 15, 2024
2 parents 8ed60b6 + e968715 commit db59898
Show file tree
Hide file tree
Showing 10 changed files with 725 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
*.jl.cov
*.jl.mem
/docs/Manifest.toml
/docs/build/
/docs/build/
3 changes: 3 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Modules = [
ADAPT.Basics,
ADAPT.Basics.Callbacks,
ADAPT.Basics.Operators,
ADAPT.Basics.Pools,
]
```

Expand All @@ -30,6 +31,8 @@ Modules = [
Modules = [
ADAPT.OptimizationFreeADAPT,
ADAPT.OverlapADAPT,
ADAPT.Degenerate_ADAPT,
ADAPT.Hamiltonians,
]
```

Expand Down
16 changes: 15 additions & 1 deletion src/ADAPT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,18 @@ module ADAPT
# A suite of common operators, especially useful for constructing operator pools.
include("base/Operators.jl")
export Operators

# A suite of common operator pools.
include("base/pools.jl")
export Pools
end
using .Basics
export Ansatz
export VANILLA
export OptimOptimizer
export Callbacks
export Operators
export Pools

module OptimizationFreeADAPT
include("optimizationfree/OptimizationFree.jl")
Expand All @@ -94,12 +99,21 @@ module ADAPT
include("overlap/OverlapADAPT.jl")
export Infidelity
end

module Degenerate_ADAPT
include("degenerateADAPT/DegenerateADAPT.jl")
export DEG_ADAPT
end

module Hamiltonians
# A suite of common lattice Hamiltonians.
include("hamiltonians/latticemodels.jl")
end
end

#=
TODO:
- Some pools. Grab from Diksha's code.
- Lie rank calculation, in pauli-dedicated code.
=#
26 changes: 22 additions & 4 deletions src/base/__paulioperators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,29 @@ function measure_commutator(
return expectation_value(commutator, Ψ)
end

function Base.:(spv1::Vector{ScaledPauli{N}}, spv2::Vector{ScaledPauli{N}}) where {N}
if length(spv1) != length(spv2) return false end
for (sp1,sp2) in zip(spv1, spv2)
if !(sp1sp2)
return false
end
end
return true
end

function otimes(sp::ScaledPauli{N}, p::Pauli{M}) where {N,M}
out_pauli = sp.pauli p.pauli
out_coeff = sp.coeff * get_phase(p)
out = ScaledPauli{N+M}(out_coeff, out_pauli)
return out
end





function otimes(p::Pauli{M}, sp::ScaledPauli{N}) where {M,N}
out_pauli = p.pauli sp.pauli
out_coeff = sp.coeff * get_phase(p)
out = ScaledPauli{N+M}(out_coeff, out_pauli)
return out
end

#= TODO: Calculate DLA
Expand Down
Loading

0 comments on commit db59898

Please sign in to comment.