text:
# Use
#    @warnpcfail precompile(args...)
# if you want to be warned when a precompile directive fails
macro warnpcfail(ex::Expr)
    modl = __module__
    file = __source__.file === nothing ? "?" : String(__source__.file)
    line = __source__.line
    quote
        $(esc(ex)) || @warn """precompile directive
     $($(Expr(:quote, ex)))
 failed. Please report an issue in $($modl) (after checking for duplicates) or remove this directive.""" _file=$file _line=$line
    end
end

function _precompile_()
    ccall(:jl_generating_output, Cint, ()) == 1 || return nothing
    Base.precompile(Tuple{Type{BosonDestroy},Symbol,Symbol,Vararg{Union{Int64, Symbol}, N} where N})
    Base.precompile(Tuple{Type{Corr},BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{Type{Corr},OpSum})
    Base.precompile(Tuple{Type{Corr},scal{Int64}})
    Base.precompile(Tuple{Type{ExpVal},BosonCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{Type{ExpVal},BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{Type{ExpVal},OpProd})
    Base.precompile(Tuple{Type{ExpVal},OpSumAnalytic})
    Base.precompile(Tuple{Type{ExpVal},OpSum})
    Base.precompile(Tuple{Type{ExpVal},scal{Int64}})
    Base.precompile(Tuple{Type{ExpVal},σminus{Tuple{Symbol}}})
    Base.precompile(Tuple{Type{ExpVal},σplus{Tuple{Symbol}}})
    Base.precompile(Tuple{Type{ExpVal},σ{Tuple{Symbol}}})
    Base.precompile(Tuple{Type{OpProdIter{false}},OpProd})
    Base.precompile(Tuple{Type{OpProdIter{true}},OpProd})
    Base.precompile(Tuple{Type{OpSumAnalytic},Symbol,BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{Type{OpSumAnalytic},Symbol,Corr})
    Base.precompile(Tuple{Type{OpSumAnalytic},Symbol,OpProd})
    Base.precompile(Tuple{Type{OpSumAnalytic},Symbol,OpSumAnalytic})
    Base.precompile(Tuple{Type{OpSumAnalytic},Symbol,scal{Int64}})
    Base.precompile(Tuple{Type{OpSumAnalytic},Symbol,δ})
    Base.precompile(Tuple{Type{OpSumAnalytic},Symbol,σplus{Tuple{Symbol}}})
    Base.precompile(Tuple{Type{OpSumAnalytic},Symbol,σ{Tuple{Symbol}}})
    Base.precompile(Tuple{Type{param},Symbol,Char,Int64,Vararg{Union{Int64, Symbol}, N} where N})
    Base.precompile(Tuple{Type{param},Symbol,Char,Symbol,Vararg{Union{Int64, Symbol}, N} where N})
    Base.precompile(Tuple{Type{param},Symbol,Char,Tuple{Int64, Symbol}})
    Base.precompile(Tuple{Type{param},Symbol,Char,Tuple{Symbol, Int64, Symbol}})
    Base.precompile(Tuple{Type{param},Symbol,Char,Tuple{Symbol, Symbol, Int64}})
    Base.precompile(Tuple{Type{param},Symbol,Int64})
    Base.precompile(Tuple{Type{param},Symbol,Symbol,Vararg{Union{Int64, Symbol}, N} where N})
    Base.precompile(Tuple{Type{param},Symbol,Symbol})
    Base.precompile(Tuple{Type{param},Symbol,Tuple{}})
    Base.precompile(Tuple{Type{param},Symbol})
    Base.precompile(Tuple{Type{scal},Complex{Rational{Int64}}})
    Base.precompile(Tuple{Type{δ},Int64,Symbol})
    Base.precompile(Tuple{Type{σ},SpatialIndex,Symbol,Vararg{Symbol, N} where N})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Int64, Symbol}},BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Int64}},BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Int64}},BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Int64}},Corr})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Int64}},ExpVal})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Int64}},OpProd})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Int64}},scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Int64}},scal{Complex{Rational{Int64}}}})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Int64}},scal{Int64}})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Int64}},scal{Rational{Int64}}})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Int64}},δ})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Int64}},σminus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Symbol, Symbol}},BosonDestroy{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Symbol, Symbol}},OpProd})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Symbol}},BosonCreate{Tuple{Int64, Int64, Symbol}}})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Symbol}},BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Symbol}},BosonCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Symbol}},BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Symbol}},Corr})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Symbol}},ExpVal})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Symbol}},OpProd})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Symbol}},OpSum})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Symbol}},param{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Symbol}},param{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Symbol}},scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Symbol}},scal{Complex{Rational{Int64}}}})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Symbol}},scal{Float64}})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Symbol}},scal{Int64}})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Symbol}},scal{Rational{Int64}}})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{Symbol}},δ})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{}},BosonDestroy{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),BosonCreate{Tuple{}},OpProd})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Int64, Int64, Symbol}},BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Int64, Symbol}},OpProd})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Int64, Symbol}},σminus{Tuple{Int64, Symbol}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Int64, Symbol}},σplus{Tuple{}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Int64, Symbol}},σ{Tuple{Int64, Symbol}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Int64, Symbol}},σ{Tuple{}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Int64}},BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Int64}},BosonCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Int64}},BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Int64}},Corr})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Int64}},ExpVal})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Int64}},OpProd})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Int64}},OpSum})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Int64}},scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Int64}},scal{Complex{Rational{Int64}}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Int64}},scal{Int64}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Int64}},scal{Rational{Int64}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Int64}},δ})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Symbol, Symbol}},BosonCreate{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Symbol, Symbol}},BosonDestroy{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Symbol, Symbol}},OpProd})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Symbol, Symbol}},OpSumAnalytic})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Symbol, Symbol}},param{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Symbol, Symbol}},δ})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Symbol, Symbol}},σplus{Tuple{}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Symbol, Symbol}},σ{Tuple{}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Symbol}},BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Symbol}},BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Symbol}},BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Symbol}},Corr})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Symbol}},ExpVal})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Symbol}},OpProd})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Symbol}},OpSum})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Symbol}},param{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Symbol}},param{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Symbol}},scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Symbol}},scal{Complex{Rational{Int64}}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Symbol}},scal{Float64}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Symbol}},scal{Int64}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Symbol}},scal{Rational{Int64}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{Symbol}},δ})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{}},BosonCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{}},BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{}},Int64})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{}},OpProd})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{}},OpSumAnalytic})
    Base.precompile(Tuple{typeof(*),BosonDestroy{Tuple{}},param{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),Corr,OpProd})
    Base.precompile(Tuple{typeof(*),Corr,scal{Int64}})
    Base.precompile(Tuple{typeof(*),ExpVal,BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),ExpVal,Corr})
    Base.precompile(Tuple{typeof(*),ExpVal,ExpVal})
    Base.precompile(Tuple{typeof(*),ExpVal,OpProd})
    Base.precompile(Tuple{typeof(*),ExpVal,scal{Int64}})
    Base.precompile(Tuple{typeof(*),ExpVal,σplus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),ExpVal,σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),FermionCreate{Tuple{Symbol}},FermionCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),FermionCreate{Tuple{}},FermionDestroy{Tuple{}}})
    Base.precompile(Tuple{typeof(*),FermionDestroy{Tuple{Symbol}},FermionCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),FermionDestroy{Tuple{Symbol}},FermionDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),Float64,δ})
    Base.precompile(Tuple{typeof(*),Int64,BosonDestroy{Tuple{}}})
    Base.precompile(Tuple{typeof(*),OpProd,BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),OpProd,BosonCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),OpProd,BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),OpProd,BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),OpProd,Corr})
    Base.precompile(Tuple{typeof(*),OpProd,OpProd})
    Base.precompile(Tuple{typeof(*),OpProd,OpSumAnalytic})
    Base.precompile(Tuple{typeof(*),OpProd,OpSum})
    Base.precompile(Tuple{typeof(*),OpProd,param{Tuple{Int64, Symbol}}})
    Base.precompile(Tuple{typeof(*),OpProd,param{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),OpProd,param{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),OpProd,scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(*),OpProd,scal{Float64}})
    Base.precompile(Tuple{typeof(*),OpProd,scal{Int64}})
    Base.precompile(Tuple{typeof(*),OpProd,δ})
    Base.precompile(Tuple{typeof(*),OpProd,σminus{Tuple{Int64, Symbol}}})
    Base.precompile(Tuple{typeof(*),OpProd,σminus{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),OpProd,σplus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),OpProd,σplus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),OpProd,σ{Tuple{Int64, Symbol}}})
    Base.precompile(Tuple{typeof(*),OpProd,σ{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),OpProd,σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),OpSum,BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),OpSum,BosonCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),OpSum,BosonDestroy{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),OpSum,BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),OpSum,Corr})
    Base.precompile(Tuple{typeof(*),OpSum,ExpVal})
    Base.precompile(Tuple{typeof(*),OpSum,OpProd})
    Base.precompile(Tuple{typeof(*),OpSum,OpSum})
    Base.precompile(Tuple{typeof(*),OpSum,scal{Int64}})
    Base.precompile(Tuple{typeof(*),OpSum,σminus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),OpSum,σminus{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),OpSum,σminus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),OpSum,σminus{Tuple{}}})
    Base.precompile(Tuple{typeof(*),OpSum,σplus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),OpSum,σ{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),OpSum,σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),OpSumAnalytic,BosonCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),OpSumAnalytic,BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),OpSumAnalytic,OpProd})
    Base.precompile(Tuple{typeof(*),OpSumAnalytic,OpSumAnalytic})
    Base.precompile(Tuple{typeof(*),OpSumAnalytic,param{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),OpSumAnalytic,scal{Int64}})
    Base.precompile(Tuple{typeof(*),OpSumAnalytic,σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),param{Tuple{Int64, Symbol}},OpProd})
    Base.precompile(Tuple{typeof(*),param{Tuple{Int64, Symbol}},param{Tuple{}}})
    Base.precompile(Tuple{typeof(*),param{Tuple{Int64}},ExpVal})
    Base.precompile(Tuple{typeof(*),param{Tuple{Int64}},OpProd})
    Base.precompile(Tuple{typeof(*),param{Tuple{Int64}},param{Tuple{Int64, Symbol}}})
    Base.precompile(Tuple{typeof(*),param{Tuple{Int64}},param{Tuple{}}})
    Base.precompile(Tuple{typeof(*),param{Tuple{Int64}},σplus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),param{Tuple{Int64}},σ{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),param{Tuple{Symbol, Symbol}},BosonCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),param{Tuple{Symbol, Symbol}},BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),param{Tuple{Symbol, Symbol}},ExpVal})
    Base.precompile(Tuple{typeof(*),param{Tuple{Symbol, Symbol}},OpProd})
    Base.precompile(Tuple{typeof(*),param{Tuple{Symbol, Symbol}},param{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),param{Tuple{Symbol, Symbol}},scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(*),param{Tuple{Symbol, Symbol}},scal{Complex{Rational{Int64}}}})
    Base.precompile(Tuple{typeof(*),param{Tuple{Symbol, Symbol}},scal{Int64}})
    Base.precompile(Tuple{typeof(*),param{Tuple{Symbol, Symbol}},δ})
    Base.precompile(Tuple{typeof(*),param{Tuple{Symbol, Symbol}},σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),param{Tuple{Symbol}},BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),param{Tuple{Symbol}},ExpVal})
    Base.precompile(Tuple{typeof(*),param{Tuple{Symbol}},OpProd})
    Base.precompile(Tuple{typeof(*),param{Tuple{Symbol}},OpSum})
    Base.precompile(Tuple{typeof(*),param{Tuple{Symbol}},param{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),param{Tuple{Symbol}},param{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),param{Tuple{Symbol}},scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(*),param{Tuple{Symbol}},scal{Complex{Rational{Int64}}}})
    Base.precompile(Tuple{typeof(*),param{Tuple{Symbol}},scal{Int64}})
    Base.precompile(Tuple{typeof(*),param{Tuple{Symbol}},δ})
    Base.precompile(Tuple{typeof(*),param{Tuple{Symbol}},σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),param{Tuple{}},BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),param{Tuple{}},Corr})
    Base.precompile(Tuple{typeof(*),param{Tuple{}},ExpVal})
    Base.precompile(Tuple{typeof(*),param{Tuple{}},OpProd})
    Base.precompile(Tuple{typeof(*),param{Tuple{}},param{Tuple{}}})
    Base.precompile(Tuple{typeof(*),param{Tuple{}},scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(*),param{Tuple{}},σ{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),scal{Complex{Int64}},BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),scal{Complex{Int64}},OpProd})
    Base.precompile(Tuple{typeof(*),scal{Complex{Int64}},OpSumAnalytic})
    Base.precompile(Tuple{typeof(*),scal{Complex{Int64}},scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(*),scal{Complex{Int64}},scal{Int64}})
    Base.precompile(Tuple{typeof(*),scal{Complex{Int64}},scal{Rational{Int64}}})
    Base.precompile(Tuple{typeof(*),scal{Complex{Int64}},σminus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),scal{Complex{Int64}},σminus{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),scal{Complex{Int64}},σplus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),scal{Complex{Int64}},σplus{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),scal{Complex{Int64}},σ{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),scal{Complex{Int64}},σ{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),scal{Complex{Int64}},σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),scal{Complex{Int64}},σ{Tuple{}}})
    Base.precompile(Tuple{typeof(*),scal{Complex{Rational{Int64}}},OpProd})
    Base.precompile(Tuple{typeof(*),scal{Complex{Rational{Int64}}},OpSumAnalytic})
    Base.precompile(Tuple{typeof(*),scal{Complex{Rational{Int64}}},param{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),scal{Complex{Rational{Int64}}},param{Tuple{}}})
    Base.precompile(Tuple{typeof(*),scal{Complex{Rational{Int64}}},scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(*),scal{Complex{Rational{Int64}}},scal{Complex{Rational{Int64}}}})
    Base.precompile(Tuple{typeof(*),scal{Complex{Rational{Int64}}},scal{Int64}})
    Base.precompile(Tuple{typeof(*),scal{Complex{Rational{Int64}}},scal{Rational{Int64}}})
    Base.precompile(Tuple{typeof(*),scal{Complex{Rational{Int64}}},σplus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),scal{Complex{Rational{Int64}}},σ{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),scal{Complex{Rational{Int64}}},σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),scal{Float64},OpProd})
    Base.precompile(Tuple{typeof(*),scal{Float64},scal{Float64}})
    Base.precompile(Tuple{typeof(*),scal{Float64},scal{Int64}})
    Base.precompile(Tuple{typeof(*),scal{Float64},δ})
    Base.precompile(Tuple{typeof(*),scal{Int64},BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),scal{Int64},ExpVal})
    Base.precompile(Tuple{typeof(*),scal{Int64},OpProd})
    Base.precompile(Tuple{typeof(*),scal{Int64},OpSumAnalytic})
    Base.precompile(Tuple{typeof(*),scal{Int64},param{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),scal{Int64},scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(*),scal{Int64},scal{Complex{Rational{Int64}}}})
    Base.precompile(Tuple{typeof(*),scal{Int64},δ})
    Base.precompile(Tuple{typeof(*),scal{Int64},σminus{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),scal{Int64},σplus{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),scal{Int64},σ{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),scal{Int64},σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),scal{Rational{Int64}},BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),scal{Rational{Int64}},OpProd})
    Base.precompile(Tuple{typeof(*),scal{Rational{Int64}},OpSumAnalytic})
    Base.precompile(Tuple{typeof(*),scal{Rational{Int64}},scal{Int64}})
    Base.precompile(Tuple{typeof(*),scal{Rational{Int64}},scal{Rational{Int64}}})
    Base.precompile(Tuple{typeof(*),δ,BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),δ,BosonDestroy{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),δ,OpProd})
    Base.precompile(Tuple{typeof(*),δ,scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(*),δ,scal{Complex{Rational{Int64}}}})
    Base.precompile(Tuple{typeof(*),δ,scal{Float64}})
    Base.precompile(Tuple{typeof(*),δ,scal{Int64}})
    Base.precompile(Tuple{typeof(*),δ,δ})
    Base.precompile(Tuple{typeof(*),δ,σminus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),δ,σplus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),δ,σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),σminus{Tuple{Int64, Symbol}},σplus{Tuple{}}})
    Base.precompile(Tuple{typeof(*),σminus{Tuple{Int64}},BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),σminus{Tuple{Int64}},BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),σminus{Tuple{Int64}},scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(*),σminus{Tuple{Int64}},scal{Int64}})
    Base.precompile(Tuple{typeof(*),σminus{Tuple{Int64}},σminus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),σminus{Tuple{Int64}},σplus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),σminus{Tuple{Symbol, Symbol}},OpProd})
    Base.precompile(Tuple{typeof(*),σminus{Tuple{Symbol, Symbol}},OpSum})
    Base.precompile(Tuple{typeof(*),σminus{Tuple{Symbol, Symbol}},scal{Int64}})
    Base.precompile(Tuple{typeof(*),σminus{Tuple{Symbol, Symbol}},σminus{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),σminus{Tuple{Symbol, Symbol}},σplus{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),σminus{Tuple{Symbol}},BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),σminus{Tuple{Symbol}},OpProd})
    Base.precompile(Tuple{typeof(*),σminus{Tuple{Symbol}},OpSum})
    Base.precompile(Tuple{typeof(*),σminus{Tuple{Symbol}},scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(*),σminus{Tuple{Symbol}},scal{Int64}})
    Base.precompile(Tuple{typeof(*),σminus{Tuple{Symbol}},σminus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),σminus{Tuple{Symbol}},σplus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),σminus{Tuple{}},OpProd})
    Base.precompile(Tuple{typeof(*),σminus{Tuple{}},scal{Int64}})
    Base.precompile(Tuple{typeof(*),σminus{Tuple{}},σminus{Tuple{}}})
    Base.precompile(Tuple{typeof(*),σminus{Tuple{}},σplus{Tuple{}}})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{Int64}},BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{Int64}},BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{Int64}},Corr})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{Int64}},ExpVal})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{Int64}},OpProd})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{Int64}},OpSum})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{Int64}},scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{Int64}},scal{Int64}})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{Int64}},σplus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{Symbol, Symbol}},OpProd})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{Symbol, Symbol}},OpSum})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{Symbol, Symbol}},scal{Int64}})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{Symbol, Symbol}},σminus{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{Symbol, Symbol}},σplus{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{Symbol}},BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{Symbol}},BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{Symbol}},OpProd})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{Symbol}},OpSum})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{Symbol}},scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{Symbol}},scal{Int64}})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{Symbol}},σplus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{}},OpProd})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{}},scal{Int64}})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{}},σminus{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),σplus{Tuple{}},σplus{Tuple{}}})
    Base.precompile(Tuple{typeof(*),σ{Tuple{Int64, Symbol}},σ{Tuple{}}})
    Base.precompile(Tuple{typeof(*),σ{Tuple{Int64}},BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),σ{Tuple{Int64}},BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),σ{Tuple{Int64}},Corr})
    Base.precompile(Tuple{typeof(*),σ{Tuple{Int64}},ExpVal})
    Base.precompile(Tuple{typeof(*),σ{Tuple{Int64}},OpProd})
    Base.precompile(Tuple{typeof(*),σ{Tuple{Int64}},OpSum})
    Base.precompile(Tuple{typeof(*),σ{Tuple{Int64}},scal{Complex{Rational{Int64}}}})
    Base.precompile(Tuple{typeof(*),σ{Tuple{Int64}},scal{Rational{Int64}}})
    Base.precompile(Tuple{typeof(*),σ{Tuple{Int64}},σ{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),σ{Tuple{Symbol, Symbol}},σ{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),σ{Tuple{Symbol}},BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),σ{Tuple{Symbol}},BosonCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),σ{Tuple{Symbol}},BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(*),σ{Tuple{Symbol}},BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),σ{Tuple{Symbol}},OpProd})
    Base.precompile(Tuple{typeof(*),σ{Tuple{Symbol}},OpSumAnalytic})
    Base.precompile(Tuple{typeof(*),σ{Tuple{Symbol}},OpSum})
    Base.precompile(Tuple{typeof(*),σ{Tuple{Symbol}},scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(*),σ{Tuple{Symbol}},scal{Complex{Rational{Int64}}}})
    Base.precompile(Tuple{typeof(*),σ{Tuple{Symbol}},scal{Int64}})
    Base.precompile(Tuple{typeof(*),σ{Tuple{Symbol}},scal{Rational{Int64}}})
    Base.precompile(Tuple{typeof(*),σ{Tuple{Symbol}},δ})
    Base.precompile(Tuple{typeof(*),σ{Tuple{Symbol}},σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(*),σ{Tuple{}},σ{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(*),σ{Tuple{}},σ{Tuple{}}})
    Base.precompile(Tuple{typeof(+),BosonCreate{Tuple{Int64}},OpProd})
    Base.precompile(Tuple{typeof(+),BosonCreate{Tuple{Symbol}},BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(+),BosonCreate{Tuple{Symbol}},OpProd})
    Base.precompile(Tuple{typeof(+),BosonCreate{Tuple{Symbol}},OpSumAnalytic})
    Base.precompile(Tuple{typeof(+),BosonCreate{Tuple{Symbol}},OpSum})
    Base.precompile(Tuple{typeof(+),BosonDestroy{Tuple{Int64}},BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(+),BosonDestroy{Tuple{Int64}},OpProd})
    Base.precompile(Tuple{typeof(+),BosonDestroy{Tuple{Int64}},OpSum})
    Base.precompile(Tuple{typeof(+),BosonDestroy{Tuple{Symbol}},OpProd})
    Base.precompile(Tuple{typeof(+),BosonDestroy{Tuple{Symbol}},OpSumAnalytic})
    Base.precompile(Tuple{typeof(+),BosonDestroy{Tuple{Symbol}},OpSum})
    Base.precompile(Tuple{typeof(+),BosonDestroy{Tuple{}},Int64})
    Base.precompile(Tuple{typeof(+),Corr,OpProd})
    Base.precompile(Tuple{typeof(+),Corr,OpSum})
    Base.precompile(Tuple{typeof(+),Int64,BosonDestroy{Tuple{}}})
    Base.precompile(Tuple{typeof(+),OpProd,OpProd})
    Base.precompile(Tuple{typeof(+),OpProd,OpSumAnalytic})
    Base.precompile(Tuple{typeof(+),OpProd,OpSum})
    Base.precompile(Tuple{typeof(+),OpProd,scal{Complex{Rational{Int64}}}})
    Base.precompile(Tuple{typeof(+),OpProd,scal{Int64}})
    Base.precompile(Tuple{typeof(+),OpProd,δ})
    Base.precompile(Tuple{typeof(+),OpProd,σminus{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(+),OpSum,OpSum})
    Base.precompile(Tuple{typeof(+),OpSumAnalytic,BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(+),OpSumAnalytic,OpSumAnalytic})
    Base.precompile(Tuple{typeof(+),OpSumAnalytic,OpSum})
    Base.precompile(Tuple{typeof(+),OpSumAnalytic,scal{Int64}})
    Base.precompile(Tuple{typeof(+),scal{Complex{Int64}},OpProd})
    Base.precompile(Tuple{typeof(+),scal{Complex{Int64}},OpSumAnalytic})
    Base.precompile(Tuple{typeof(+),scal{Complex{Int64}},OpSum})
    Base.precompile(Tuple{typeof(+),scal{Complex{Int64}},scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(+),scal{Complex{Rational{Int64}}},OpSumAnalytic})
    Base.precompile(Tuple{typeof(+),scal{Complex{Rational{Int64}}},OpSum})
    Base.precompile(Tuple{typeof(+),scal{Complex{Rational{Int64}}},scal{Complex{Rational{Int64}}}})
    Base.precompile(Tuple{typeof(+),scal{Complex{Rational{Int64}}},σ{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(+),scal{Complex{Rational{Int64}}},σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(+),scal{Float64},OpProd})
    Base.precompile(Tuple{typeof(+),scal{Float64},OpSum})
    Base.precompile(Tuple{typeof(+),scal{Float64},scal{Float64}})
    Base.precompile(Tuple{typeof(+),scal{Int64},Corr})
    Base.precompile(Tuple{typeof(+),scal{Int64},ExpVal})
    Base.precompile(Tuple{typeof(+),scal{Int64},OpSumAnalytic})
    Base.precompile(Tuple{typeof(+),scal{Int64},OpSum})
    Base.precompile(Tuple{typeof(+),scal{Int64},scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(+),scal{Int64},scal{Complex{Rational{Int64}}}})
    Base.precompile(Tuple{typeof(+),scal{Int64},scal{Rational{Int64}}})
    Base.precompile(Tuple{typeof(+),scal{Rational{Int64}},OpProd})
    Base.precompile(Tuple{typeof(+),scal{Rational{Int64}},OpSum})
    Base.precompile(Tuple{typeof(+),scal{Rational{Int64}},scal{Complex{Rational{Int64}}}})
    Base.precompile(Tuple{typeof(+),σplus{Tuple{Int64}},OpProd})
    Base.precompile(Tuple{typeof(+),σ{Tuple{Int64}},OpProd})
    Base.precompile(Tuple{typeof(+),σ{Tuple{Symbol}},OpProd})
    Base.precompile(Tuple{typeof(-),BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(-),BosonDestroy{Tuple{}},Int64})
    Base.precompile(Tuple{typeof(-),Corr,Corr})
    Base.precompile(Tuple{typeof(-),Int64,BosonDestroy{Tuple{}}})
    Base.precompile(Tuple{typeof(-),OpProd,OpSum})
    Base.precompile(Tuple{typeof(-),OpProd})
    Base.precompile(Tuple{typeof(-),OpSum,OpProd})
    Base.precompile(Tuple{typeof(-),OpSum,OpSum})
    Base.precompile(Tuple{typeof(-),OpSum,scal{Int64}})
    Base.precompile(Tuple{typeof(-),OpSumAnalytic,OpProd})
    Base.precompile(Tuple{typeof(-),OpSumAnalytic,OpSumAnalytic})
    Base.precompile(Tuple{typeof(-),OpSumAnalytic,OpSum})
    Base.precompile(Tuple{typeof(-),OpSumAnalytic})
    Base.precompile(Tuple{typeof(-),OpSum})
    Base.precompile(Tuple{typeof(-),param{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(-),param{Tuple{Symbol}},param{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(-),param{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(-),scal{Int64},OpProd})
    Base.precompile(Tuple{typeof(-),scal{Int64},OpSum})
    Base.precompile(Tuple{typeof(-),scal{Int64}})
    Base.precompile(Tuple{typeof(-),δ,OpProd})
    Base.precompile(Tuple{typeof(-),δ})
    Base.precompile(Tuple{typeof(-),σminus{Tuple{Symbol, Symbol}},σplus{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(-),σplus{Tuple{Symbol}},σminus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(==),ExpVal,ExpVal})
    Base.precompile(Tuple{typeof(==),param{Tuple{Int64, Symbol}},param{Tuple{Int64, Symbol}}})
    Base.precompile(Tuple{typeof(==),param{Tuple{Int64, Symbol}},param{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(==),param{Tuple{Int64}},param{Tuple{Int64, Symbol}}})
    Base.precompile(Tuple{typeof(==),param{Tuple{Int64}},param{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(==),param{Tuple{Symbol, Int64, Symbol}},param{Tuple{Symbol, Int64, Symbol}}})
    Base.precompile(Tuple{typeof(==),param{Tuple{Symbol, Symbol, Int64}},param{Tuple{Symbol, Symbol, Int64}}})
    Base.precompile(Tuple{typeof(==),param{Tuple{Symbol, Symbol}},param{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(==),param{Tuple{Symbol, Symbol}},param{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(==),param{Tuple{Symbol}},param{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(==),param{Tuple{}},param{Tuple{Int64, Symbol}}})
    Base.precompile(Tuple{typeof(==),param{Tuple{}},param{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(==),param{Tuple{}},param{Tuple{}}})
    Base.precompile(Tuple{typeof(==),scal{Complex{Int64}},scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(==),scal{Complex{Int64}},scal{Int64}})
    Base.precompile(Tuple{typeof(==),scal{Complex{Rational{Int64}}},scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(==),scal{Complex{Rational{Int64}}},scal{Complex{Rational{Int64}}}})
    Base.precompile(Tuple{typeof(==),scal{Complex{Rational{Int64}}},scal{Int64}})
    Base.precompile(Tuple{typeof(==),scal{Complex{Rational{Int64}}},scal{Rational{Int64}}})
    Base.precompile(Tuple{typeof(==),scal{Float64},scal{Float64}})
    Base.precompile(Tuple{typeof(==),scal{Float64},scal{Rational{Int64}}})
    Base.precompile(Tuple{typeof(==),scal{Int64},scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(==),scal{Int64},scal{Float64}})
    Base.precompile(Tuple{typeof(==),scal{Int64},scal{Int64}})
    Base.precompile(Tuple{typeof(==),scal{Rational{Int64}},scal{Rational{Int64}}})
    Base.precompile(Tuple{typeof(Avac),BosonCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(Avac),BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(Avac),BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(Avac),FermionCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(Avac),FermionDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(Avac),OpProd})
    Base.precompile(Tuple{typeof(Avac),OpSumAnalytic})
    Base.precompile(Tuple{typeof(Avac),OpSum})
    Base.precompile(Tuple{typeof(Avac),scal{Complex{Rational{Int64}}}})
    Base.precompile(Tuple{typeof(Avac),scal{Float64}})
    Base.precompile(Tuple{typeof(Avac),scal{Int64}})
    Base.precompile(Tuple{typeof(Avac),scal{Rational{Int64}}})
    Base.precompile(Tuple{typeof(Avac),δ})
    Base.precompile(Tuple{typeof(Avac),σminus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(Avac),σminus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(Avac),σplus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(Avac),σplus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(Avac),σ{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(Avac),σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(CorrExpTup_isless),NTuple{4, Int64},Tuple{Int64, Int64}})
    Base.precompile(Tuple{typeof(CorrOrExp),BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(CorrOrExp),OpProd})
    Base.precompile(Tuple{typeof(_sortedOpProd),Corr,Corr})
    Base.precompile(Tuple{typeof(_sortedOpProd),Corr})
    Base.precompile(Tuple{typeof(_sortedOpProd),ExpVal,Corr,Vararg{Corr, N} where N})
    Base.precompile(Tuple{typeof(_sortedOpProd),ExpVal,Corr})
    Base.precompile(Tuple{typeof(_sortedOpProd),ExpVal,ExpVal,Vararg{Operator, N} where N})
    Base.precompile(Tuple{typeof(_sortedOpProd),param{Tuple{}},Corr})
    Base.precompile(Tuple{typeof(_sortedOpProd),param{Tuple{}},ExpVal,Vararg{Operator, N} where N})
    Base.precompile(Tuple{typeof(_sortedOpProd),scal{Int64},Corr})
    Base.precompile(Tuple{typeof(_sortedOpProd),scal{Int64},ExpVal,Vararg{Operator, N} where N})
    Base.precompile(Tuple{typeof(_sortedOpSum),Vector{OpProd}})
    Base.precompile(Tuple{typeof(_sortedOpSum),Vector{Operator}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{param{Tuple{}}},Vector{BaseOperator},Tuple{Tuple{Int64, Int64, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{param{Tuple{}}},Vector{BaseOperator},Tuple{Tuple{Int64}, Tuple{Int64, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{param{Tuple{}}},Vector{BaseOperator},Tuple{Tuple{Int64}, Tuple{Int64}, Tuple{Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{scal{Int64}, param{Tuple{Int64}}},Vector{σplus{Tuple{Int64}}},Tuple{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{scal{Int64}, param{Tuple{Int64}}},Vector{σ{Tuple{Int64}}},Tuple{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{scal{Int64}, param{Tuple{}}},Vector{BosonDestroy{Tuple{Int64}}},Tuple{Tuple{Int64, Int64, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{scal{Int64}, param{Tuple{}}},Vector{BosonDestroy{Tuple{Int64}}},Tuple{Tuple{Int64}, Tuple{Int64, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{scal{Int64}, param{Tuple{}}},Vector{BosonDestroy{Tuple{Int64}}},Tuple{Tuple{Int64}, Tuple{Int64}, Tuple{Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{scal{Int64}},Vector{BosonDestroy{Tuple{Int64}}},Tuple{Tuple{Int64, Int64, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{scal{Int64}},Vector{BosonDestroy{Tuple{Int64}}},Tuple{Tuple{Int64}, Tuple{Int64, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{scal{Int64}},Vector{BosonDestroy{Tuple{Int64}}},Tuple{Tuple{Int64}, Tuple{Int64}, Tuple{Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{scal{Int64}},Vector{BosonDestroy{Tuple{Int64}}},Tuple{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BaseOperator},NTuple{4, Tuple{Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BaseOperator},Tuple{NTuple{4, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BaseOperator},Tuple{Tuple{Int64, Int64, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BaseOperator},Tuple{Tuple{Int64, Int64}, Tuple{Int64, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BaseOperator},Tuple{Tuple{Int64, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BaseOperator},Tuple{Tuple{Int64}, Tuple{Int64, Int64, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BaseOperator},Tuple{Tuple{Int64}, Tuple{Int64, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BaseOperator},Tuple{Tuple{Int64}, Tuple{Int64}, Tuple{Int64, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BaseOperator},Tuple{Tuple{Int64}, Tuple{Int64}, Tuple{Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BaseOperator},Tuple{Tuple{Int64}, Tuple{Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BosonDestroy{Tuple{Int64}}},NTuple{4, Tuple{Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BosonDestroy{Tuple{Int64}}},NTuple{5, Tuple{Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BosonDestroy{Tuple{Int64}}},Tuple{NTuple{4, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BosonDestroy{Tuple{Int64}}},Tuple{NTuple{5, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BosonDestroy{Tuple{Int64}}},Tuple{Tuple{Int64, Int64}, Tuple{Int64, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BosonDestroy{Tuple{Int64}}},Tuple{Tuple{Int64, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BosonDestroy{Tuple{Int64}}},Tuple{Tuple{Int64}, NTuple{4, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BosonDestroy{Tuple{Int64}}},Tuple{Tuple{Int64}, Tuple{Int64, Int64, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BosonDestroy{Tuple{Int64}}},Tuple{Tuple{Int64}, Tuple{Int64, Int64}, Tuple{Int64, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BosonDestroy{Tuple{Int64}}},Tuple{Tuple{Int64}, Tuple{Int64}, Tuple{Int64, Int64, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BosonDestroy{Tuple{Int64}}},Tuple{Tuple{Int64}, Tuple{Int64}, Tuple{Int64, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BosonDestroy{Tuple{Int64}}},Tuple{Tuple{Int64}, Tuple{Int64}, Tuple{Int64}, Tuple{Int64, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BosonDestroy{Tuple{Int64}}},Tuple{Tuple{Int64}, Tuple{Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BosonDestroy},Tuple{Tuple{Int64, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{BosonDestroy},Tuple{Tuple{Int64}, Tuple{Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{σ{Tuple{Symbol}}},Tuple{Tuple{Int64, Int64}}})
    Base.precompile(Tuple{typeof(_sumterm),Tuple{},Vector{σ{Tuple{Symbol}}},Tuple{Tuple{Int64}, Tuple{Int64}}})
    Base.precompile(Tuple{typeof(_vacExpVal),OpProd})
    Base.precompile(Tuple{typeof(_vacExpVal),OpSumAnalytic})
    Base.precompile(Tuple{typeof(_vacExpVal),OpSum})
    Base.precompile(Tuple{typeof(_vacExpVal),scal{Complex{Rational{Int64}}}})
    Base.precompile(Tuple{typeof(_vacExpVal),scal{Float64}})
    Base.precompile(Tuple{typeof(_vacExpVal),scal{Int64}})
    Base.precompile(Tuple{typeof(_vacExpVal),scal{Rational{Int64}}})
    Base.precompile(Tuple{typeof(_vacExpVal),δ})
    Base.precompile(Tuple{typeof(_vacExpVal),σ{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(_vacExpVal),σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(adjoint),BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(adjoint),BosonCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(adjoint),BosonDestroy{Tuple{Int64, Int64, Symbol}}})
    Base.precompile(Tuple{typeof(adjoint),BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(adjoint),BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(adjoint),BosonDestroy{Tuple{}}})
    Base.precompile(Tuple{typeof(adjoint),Corr})
    Base.precompile(Tuple{typeof(adjoint),ExpVal})
    Base.precompile(Tuple{typeof(adjoint),FermionCreate{Tuple{}}})
    Base.precompile(Tuple{typeof(adjoint),FermionDestroy{Tuple{}}})
    Base.precompile(Tuple{typeof(adjoint),OpProd})
    Base.precompile(Tuple{typeof(adjoint),OpSumAnalytic})
    Base.precompile(Tuple{typeof(adjoint),param{Tuple{Int64, Symbol}}})
    Base.precompile(Tuple{typeof(adjoint),param{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(adjoint),param{Tuple{Symbol, Int64, Symbol}}})
    Base.precompile(Tuple{typeof(adjoint),param{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(adjoint),param{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(adjoint),param{Tuple{}}})
    Base.precompile(Tuple{typeof(adjoint),scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(adjoint),scal{Float64}})
    Base.precompile(Tuple{typeof(adjoint),σminus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(adjoint),σminus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(adjoint),σplus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(adjoint),σplus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(adjoint),σ{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(adjoint),σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(ascorr),BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(ascorr),BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(ascorr),Corr})
    Base.precompile(Tuple{typeof(ascorr),OpProd})
    Base.precompile(Tuple{typeof(ascorr),OpSumAnalytic})
    Base.precompile(Tuple{typeof(ascorr),OpSum})
    Base.precompile(Tuple{typeof(ascorr),scal{Int64}})
    Base.precompile(Tuple{typeof(basetype),Type})
    Base.precompile(Tuple{typeof(basetype),σplus{Tuple{}}})
    Base.precompile(Tuple{typeof(comm),BosonCreate{Tuple{Int64}},BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(comm),BosonCreate{Tuple{Int64}},OpProd})
    Base.precompile(Tuple{typeof(comm),BosonCreate{Tuple{Symbol}},BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(comm),BosonCreate{Tuple{Symbol}},OpProd})
    Base.precompile(Tuple{typeof(comm),BosonCreate{Tuple{Symbol}},OpSumAnalytic})
    Base.precompile(Tuple{typeof(comm),BosonCreate{Tuple{Symbol}},OpSum})
    Base.precompile(Tuple{typeof(comm),BosonCreate{Tuple{Symbol}},param{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(comm),BosonCreate{Tuple{Symbol}},scal{Rational{Int64}}})
    Base.precompile(Tuple{typeof(comm),BosonCreate{Tuple{Symbol}},σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(comm),BosonDestroy{Tuple{Int64}},OpProd})
    Base.precompile(Tuple{typeof(comm),BosonDestroy{Tuple{Int64}},OpSum})
    Base.precompile(Tuple{typeof(comm),BosonDestroy{Tuple{Symbol}},OpProd})
    Base.precompile(Tuple{typeof(comm),BosonDestroy{Tuple{Symbol}},OpSumAnalytic})
    Base.precompile(Tuple{typeof(comm),BosonDestroy{Tuple{Symbol}},OpSum})
    Base.precompile(Tuple{typeof(comm),BosonDestroy{Tuple{Symbol}},param{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(comm),BosonDestroy{Tuple{Symbol}},scal{Rational{Int64}}})
    Base.precompile(Tuple{typeof(comm),BosonDestroy{Tuple{Symbol}},σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(comm),FermionCreate{Tuple{Symbol}},FermionCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(comm),FermionCreate{Tuple{}},FermionDestroy{Tuple{}}})
    Base.precompile(Tuple{typeof(comm),FermionDestroy{Tuple{Symbol}},FermionCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(comm),FermionDestroy{Tuple{Symbol}},FermionDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(comm),OpProd,OpProd})
    Base.precompile(Tuple{typeof(comm),OpProd,OpSumAnalytic})
    Base.precompile(Tuple{typeof(comm),OpProd,OpSum})
    Base.precompile(Tuple{typeof(comm),OpProd,param{Tuple{}}})
    Base.precompile(Tuple{typeof(comm),OpSum,BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(comm),OpSum,OpProd})
    Base.precompile(Tuple{typeof(comm),OpSum,OpSum})
    Base.precompile(Tuple{typeof(comm),OpSum,param{Tuple{}}})
    Base.precompile(Tuple{typeof(comm),OpSumAnalytic,BosonCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(comm),OpSumAnalytic,BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(comm),OpSumAnalytic,OpProd})
    Base.precompile(Tuple{typeof(comm),OpSumAnalytic,OpSumAnalytic})
    Base.precompile(Tuple{typeof(comm),OpSumAnalytic,OpSum})
    Base.precompile(Tuple{typeof(comm),OpSumAnalytic,param{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(comm),OpSumAnalytic,param{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(comm),OpSumAnalytic,scal{Rational{Int64}}})
    Base.precompile(Tuple{typeof(comm),OpSumAnalytic,σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(comm),param{Tuple{Symbol, Symbol}},OpProd})
    Base.precompile(Tuple{typeof(comm),param{Tuple{Symbol, Symbol}},OpSumAnalytic})
    Base.precompile(Tuple{typeof(comm),param{Tuple{Symbol}},OpProd})
    Base.precompile(Tuple{typeof(comm),param{Tuple{Symbol}},OpSumAnalytic})
    Base.precompile(Tuple{typeof(comm),param{Tuple{}},OpProd})
    Base.precompile(Tuple{typeof(comm),param{Tuple{}},OpSum})
    Base.precompile(Tuple{typeof(comm),scal{Complex{Int64}},OpProd})
    Base.precompile(Tuple{typeof(comm),scal{Complex{Int64}},OpSumAnalytic})
    Base.precompile(Tuple{typeof(comm),scal{Complex{Rational{Int64}}},OpProd})
    Base.precompile(Tuple{typeof(comm),scal{Complex{Rational{Int64}}},OpSumAnalytic})
    Base.precompile(Tuple{typeof(comm),scal{Complex{Rational{Int64}}},σ{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(comm),scal{Float64},OpProd})
    Base.precompile(Tuple{typeof(comm),scal{Float64},δ})
    Base.precompile(Tuple{typeof(comm),scal{Int64},OpProd})
    Base.precompile(Tuple{typeof(comm),scal{Int64},OpSumAnalytic})
    Base.precompile(Tuple{typeof(comm),scal{Rational{Int64}},OpProd})
    Base.precompile(Tuple{typeof(comm),scal{Rational{Int64}},OpSumAnalytic})
    Base.precompile(Tuple{typeof(comm),scal{Rational{Int64}},σ{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(comm),δ,OpProd})
    Base.precompile(Tuple{typeof(comm),σminus{Tuple{Int64, Symbol}},σplus{Tuple{}}})
    Base.precompile(Tuple{typeof(comm),σminus{Tuple{Int64}},OpProd})
    Base.precompile(Tuple{typeof(comm),σminus{Tuple{Int64}},OpSum})
    Base.precompile(Tuple{typeof(comm),σminus{Tuple{Int64}},scal{Int64}})
    Base.precompile(Tuple{typeof(comm),σminus{Tuple{Int64}},σminus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(comm),σminus{Tuple{Int64}},σplus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(comm),σminus{Tuple{Symbol, Symbol}},σplus{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(comm),σminus{Tuple{Symbol}},OpProd})
    Base.precompile(Tuple{typeof(comm),σminus{Tuple{Symbol}},OpSum})
    Base.precompile(Tuple{typeof(comm),σplus{Tuple{Int64}},OpProd})
    Base.precompile(Tuple{typeof(comm),σplus{Tuple{Int64}},OpSum})
    Base.precompile(Tuple{typeof(comm),σplus{Tuple{Int64}},scal{Int64}})
    Base.precompile(Tuple{typeof(comm),σplus{Tuple{Int64}},σminus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(comm),σplus{Tuple{Int64}},σplus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(comm),σplus{Tuple{Symbol}},OpProd})
    Base.precompile(Tuple{typeof(comm),σplus{Tuple{Symbol}},OpSum})
    Base.precompile(Tuple{typeof(comm),σ{Tuple{Int64, Symbol}},σ{Tuple{}}})
    Base.precompile(Tuple{typeof(comm),σ{Tuple{Int64}},OpProd})
    Base.precompile(Tuple{typeof(comm),σ{Tuple{Int64}},param{Tuple{}}})
    Base.precompile(Tuple{typeof(comm),σ{Tuple{Int64}},scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(comm),σ{Tuple{Int64}},scal{Int64}})
    Base.precompile(Tuple{typeof(comm),σ{Tuple{Symbol}},OpProd})
    Base.precompile(Tuple{typeof(comm),σ{Tuple{Symbol}},OpSumAnalytic})
    Base.precompile(Tuple{typeof(comm),σ{Tuple{Symbol}},OpSum})
    Base.precompile(Tuple{typeof(comm),σ{Tuple{Symbol}},param{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(comm),σ{Tuple{Symbol}},param{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(comm),σ{Tuple{Symbol}},scal{Complex{Rational{Int64}}}})
    Base.precompile(Tuple{typeof(comm),σ{Tuple{Symbol}},scal{Rational{Int64}}})
    Base.precompile(Tuple{typeof(distribute_indices!),Vector{Symbol},BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(distribute_indices!),Vector{Symbol},BosonCreate{Tuple{}}})
    Base.precompile(Tuple{typeof(distribute_indices!),Vector{Symbol},BosonDestroy{Tuple{Int64, Symbol}}})
    Base.precompile(Tuple{typeof(distribute_indices!),Vector{Symbol},BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(distribute_indices!),Vector{Symbol},Corr})
    Base.precompile(Tuple{typeof(distribute_indices!),Vector{Symbol},ExpVal})
    Base.precompile(Tuple{typeof(distribute_indices!),Vector{Symbol},OpProd})
    Base.precompile(Tuple{typeof(distribute_indices!),Vector{Symbol},OpSum})
    Base.precompile(Tuple{typeof(distribute_indices!),Vector{Symbol},param{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(distribute_indices!),Vector{Symbol},σminus{Tuple{Int64, Symbol}}})
    Base.precompile(Tuple{typeof(distribute_indices!),Vector{Symbol},σplus{Tuple{}}})
    Base.precompile(Tuple{typeof(distribute_indices!),Vector{Symbol},σ{Tuple{Int64, Symbol}}})
    Base.precompile(Tuple{typeof(distribute_indices!),Vector{Symbol},σ{Tuple{}}})
    Base.precompile(Tuple{typeof(exchange_inds),OpProd,Symbol,Symbol})
    Base.precompile(Tuple{typeof(exptuple),BosonCreate{Tuple{Int64, Symbol}}})
    Base.precompile(Tuple{typeof(exptuple),BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(exptuple),BosonCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(exptuple),BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(exptuple),BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(exptuple),ExpVal})
    Base.precompile(Tuple{typeof(exptuple),param{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(exptuple),param{Tuple{}}})
    Base.precompile(Tuple{typeof(exptuple),scal{Int64}})
    Base.precompile(Tuple{typeof(exptuple),σminus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(exptuple),σplus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(exptuple),σplus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(exptuple),σ{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(exptuple),σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(extindices),OpSumAnalytic})
    Base.precompile(Tuple{typeof(indextuple),BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(isapprox),OpProd,OpProd})
    Base.precompile(Tuple{typeof(isapprox),OpSum,OpSum})
    Base.precompile(Tuple{typeof(isapprox),scal{Float64},scal{Float64}})
    Base.precompile(Tuple{typeof(isapprox),scal{Float64},scal{Int64}})
    Base.precompile(Tuple{typeof(isapprox),δ,δ})
    Base.precompile(Tuple{typeof(isless),ExpVal,Corr})
    Base.precompile(Tuple{typeof(isless),ExpVal,ExpVal})
    Base.precompile(Tuple{typeof(iterate),OpProdIter{false},BosonCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(iterate),OpProdIter{false},BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(iterate),OpProdIter{false},BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(iterate),OpProdIter{false},ExpVal})
    Base.precompile(Tuple{typeof(iterate),OpProdIter{false},FermionCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(iterate),OpProdIter{false},FermionDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(iterate),OpProdIter{false},σminus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(iterate),OpProdIter{false},σminus{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(iterate),OpProdIter{false},σminus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(iterate),OpProdIter{false},σminus{Tuple{}}})
    Base.precompile(Tuple{typeof(iterate),OpProdIter{false},σ{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(iterate),OpProdIter{false},σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(iterate),OpProdIter{true},BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(iterate),OpProdIter{true},BosonCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(iterate),OpProdIter{true},Corr})
    Base.precompile(Tuple{typeof(iterate),OpProdIter{true},ExpVal})
    Base.precompile(Tuple{typeof(iterate),OpProdIter{true},σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(iterlesseq),OpProdIter{false},OpProdIter{false}})
    Base.precompile(Tuple{typeof(latex),BosonCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(latex),BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(latex),Corr})
    Base.precompile(Tuple{typeof(latex),ExpVal})
    Base.precompile(Tuple{typeof(latex),OpProd})
    Base.precompile(Tuple{typeof(latex),OpSumAnalytic})
    Base.precompile(Tuple{typeof(latex),OpSum})
    Base.precompile(Tuple{typeof(latex),param{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(latex),param{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(latex),scal{Complex{Int64}}})
    Base.precompile(Tuple{typeof(latex),scal{Complex{Rational{Int64}}}})
    Base.precompile(Tuple{typeof(latex),scal{Float64}})
    Base.precompile(Tuple{typeof(latex),scal{Int64}})
    Base.precompile(Tuple{typeof(latex),δ})
    Base.precompile(Tuple{typeof(latex),σplus{Tuple{}}})
    Base.precompile(Tuple{typeof(latex),σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(latex),σ{Tuple{}}})
    Base.precompile(Tuple{typeof(length),BosonCreate{Tuple{Int64, Symbol}}})
    Base.precompile(Tuple{typeof(length),BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(length),BosonCreate{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(length),BosonCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(length),BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(length),BosonDestroy{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(length),BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(length),Corr})
    Base.precompile(Tuple{typeof(length),ExpVal})
    Base.precompile(Tuple{typeof(length),FermionCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(length),FermionDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(length),param{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(length),param{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(length),param{Tuple{}}})
    Base.precompile(Tuple{typeof(length),δ})
    Base.precompile(Tuple{typeof(length),σminus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(length),σminus{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(length),σminus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(length),σminus{Tuple{}}})
    Base.precompile(Tuple{typeof(length),σplus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(length),σplus{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(length),σplus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(length),σplus{Tuple{}}})
    Base.precompile(Tuple{typeof(length),σ{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(length),σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(optuple),BosonCreate{Tuple{Int64, Symbol}}})
    Base.precompile(Tuple{typeof(optuple),BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(optuple),BosonCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(optuple),BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(optuple),BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(optuple),ExpVal})
    Base.precompile(Tuple{typeof(optuple),param{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(optuple),param{Tuple{}}})
    Base.precompile(Tuple{typeof(optuple),scal{Int64}})
    Base.precompile(Tuple{typeof(optuple),σminus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(optuple),σplus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(optuple),σplus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(optuple),σ{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(optuple),σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(parse_paramstr),String})
    Base.precompile(Tuple{typeof(preftuple),BosonCreate{Tuple{Int64, Symbol}}})
    Base.precompile(Tuple{typeof(preftuple),BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(preftuple),BosonCreate{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(preftuple),BosonCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(preftuple),BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(preftuple),BosonDestroy{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(preftuple),BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(preftuple),BosonDestroy{Tuple{}}})
    Base.precompile(Tuple{typeof(preftuple),ExpVal})
    Base.precompile(Tuple{typeof(preftuple),FermionCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(preftuple),FermionDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(preftuple),param{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(preftuple),param{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(preftuple),param{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(preftuple),param{Tuple{}}})
    Base.precompile(Tuple{typeof(preftuple),scal{Int64}})
    Base.precompile(Tuple{typeof(preftuple),δ})
    Base.precompile(Tuple{typeof(preftuple),σminus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(preftuple),σminus{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(preftuple),σminus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(preftuple),σminus{Tuple{}}})
    Base.precompile(Tuple{typeof(preftuple),σplus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(preftuple),σplus{Tuple{Symbol, Symbol}}})
    Base.precompile(Tuple{typeof(preftuple),σplus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(preftuple),σplus{Tuple{}}})
    Base.precompile(Tuple{typeof(preftuple),σ{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(preftuple),σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(print),IOBuffer,BosonCreate{Tuple{Int64, Symbol}}})
    Base.precompile(Tuple{typeof(print),IOBuffer,BosonCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(print),IOBuffer,BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(print),IOBuffer,BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(print),IOBuffer,ExpVal})
    Base.precompile(Tuple{typeof(print),IOBuffer,OpProd})
    Base.precompile(Tuple{typeof(print),IOBuffer,OpSumAnalytic})
    Base.precompile(Tuple{typeof(print),IOBuffer,OpSum})
    Base.precompile(Tuple{typeof(print),IOBuffer,σplus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(print),IOBuffer,σ{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(prodcorr),Tuple{ExpVal, ExpVal},Tuple{}})
    Base.precompile(Tuple{typeof(prodcorr),Tuple{param{Tuple{}}},Tuple{BosonCreate{Tuple{Int64}}, BosonDestroy{Tuple{Int64}}, BosonDestroy{Tuple{Int64}}}})
    Base.precompile(Tuple{typeof(prodcorr),Tuple{scal{Int64}, param{Tuple{Int64}}},Tuple{σplus{Tuple{Int64}}}})
    Base.precompile(Tuple{typeof(prodcorr),Tuple{scal{Int64}, param{Tuple{Int64}}},Tuple{σ{Tuple{Int64}}}})
    Base.precompile(Tuple{typeof(prodcorr),Tuple{scal{Int64}, param{Tuple{}}},Tuple{BosonDestroy{Tuple{Int64}}, BosonDestroy{Tuple{Int64}}, BosonDestroy{Tuple{Int64}}}})
    Base.precompile(Tuple{typeof(prodcorr),Tuple{scal{Int64}, param{Tuple{}}},Tuple{}})
    Base.precompile(Tuple{typeof(prodcorr),Tuple{scal{Int64}},Tuple{BosonDestroy{Tuple{Int64}}, BosonDestroy{Tuple{Int64}}, BosonDestroy{Tuple{Int64}}}})
    Base.precompile(Tuple{typeof(prodcorr),Tuple{scal{Int64}},Tuple{BosonDestroy{Tuple{Int64}}}})
    Base.precompile(Tuple{typeof(prodcorr),Tuple{},NTuple{4, BosonDestroy{Tuple{Int64}}}})
    Base.precompile(Tuple{typeof(prodcorr),Tuple{},NTuple{5, BosonDestroy{Tuple{Int64}}}})
    Base.precompile(Tuple{typeof(prodcorr),Tuple{},Tuple{BosonCreate{Tuple{Int64, Symbol}}, BosonDestroy{Tuple{Int64}}}})
    Base.precompile(Tuple{typeof(prodcorr),Tuple{},Tuple{BosonCreate{Tuple{Int64}}, BosonDestroy{Tuple{Int64}}, σ{Tuple{Int64}}}})
    Base.precompile(Tuple{typeof(prodcorr),Tuple{},Tuple{BosonCreate{Tuple{Symbol}}, BosonCreate{Tuple{Symbol}}, BosonDestroy{Tuple{Symbol}}, σ{Tuple{Symbol}}}})
    Base.precompile(Tuple{typeof(prodcorr),Tuple{},Tuple{BosonCreate{Tuple{Symbol}}, BosonDestroy{Tuple{Symbol}}}})
    Base.precompile(Tuple{typeof(prodcorr),Tuple{},Tuple{BosonCreate{Tuple{Symbol}}, σ{Tuple{Symbol}}}})
    Base.precompile(Tuple{typeof(prodcorr),Tuple{},Tuple{BosonDestroy{Tuple{Int64}}, BosonDestroy{Tuple{Int64}}}})
    Base.precompile(Tuple{typeof(prodcorr),Tuple{},Tuple{BosonDestroy{Tuple{Int64}}, BosonDestroy{Tuple{Symbol}}}})
    Base.precompile(Tuple{typeof(prodcorr),Tuple{},Tuple{σplus{Tuple{Symbol}}, σminus{Tuple{Symbol}}}})
    Base.precompile(Tuple{typeof(prodcorr),Tuple{},Tuple{σ{Tuple{Symbol}}, σ{Tuple{Symbol}}}})
    Base.precompile(Tuple{typeof(prodtuple),BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(prodtuple),OpProd})
    Base.precompile(Tuple{typeof(prodtuples),OpSum})
    Base.precompile(Tuple{typeof(replace_index),Corr,Symbol,Symbol})
    Base.precompile(Tuple{typeof(replace_index),ExpVal,Symbol,Symbol})
    Base.precompile(Tuple{typeof(replace_index),OpProd,Symbol,Int64})
    Base.precompile(Tuple{typeof(replace_index),OpProd,Symbol,Symbol})
    Base.precompile(Tuple{typeof(replace_index),OpSum,Symbol,Symbol})
    Base.precompile(Tuple{typeof(replace_index),OpSumAnalytic,Symbol,Symbol})
    Base.precompile(Tuple{typeof(replace_index),scal{Complex{Int64}},Symbol,Symbol})
    Base.precompile(Tuple{typeof(replace_index),scal{Complex{Rational{Int64}}},Symbol,Symbol})
    Base.precompile(Tuple{typeof(separate_prefac),Corr})
    Base.precompile(Tuple{typeof(show),IOBuffer,MIME{Symbol("text/latex")},OpSum})
    Base.precompile(Tuple{typeof(sumindextuple),BosonCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(sumindextuple),BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(sumindextuple),Corr})
    Base.precompile(Tuple{typeof(sumindextuple),ExpVal})
    Base.precompile(Tuple{typeof(sumindextuple),OpProd})
    Base.precompile(Tuple{typeof(sumindextuple),σminus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(sumindextuple),σplus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(sumindextuple),σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(sumtuple),BosonDestroy{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(sumtuple),OpSum})
    Base.precompile(Tuple{typeof(symmetric_index_nums),OpProd})
    Base.precompile(Tuple{typeof(use_σpm),Bool})
    Base.precompile(Tuple{typeof(vacA),BosonCreate{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(vacA),BosonCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(vacA),BosonDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(vacA),FermionCreate{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(vacA),FermionDestroy{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(vacA),OpProd})
    Base.precompile(Tuple{typeof(vacA),OpSumAnalytic})
    Base.precompile(Tuple{typeof(vacA),OpSum})
    Base.precompile(Tuple{typeof(vacA),scal{Complex{Rational{Int64}}}})
    Base.precompile(Tuple{typeof(vacA),scal{Float64}})
    Base.precompile(Tuple{typeof(vacA),scal{Int64}})
    Base.precompile(Tuple{typeof(vacA),δ})
    Base.precompile(Tuple{typeof(vacA),σminus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(vacA),σplus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(vacA),σplus{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(vacA),σ{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(vacA),σ{Tuple{Symbol}}})
    Base.precompile(Tuple{typeof(vacExpVal),OpProd,OpSum})
    Base.precompile(Tuple{typeof(vacExpVal),OpProd})
    Base.precompile(Tuple{typeof(vacExpVal),OpSumAnalytic})
    Base.precompile(Tuple{typeof(vacExpVal),OpSum})
    Base.precompile(Tuple{typeof(vacExpVal),scal{Int64},OpSum})
    Base.precompile(Tuple{typeof(vacExpVal),σplus{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(vacExpVal),σ{Tuple{Int64}}})
    Base.precompile(Tuple{typeof(σm),Int64,Vararg{Any, N} where N})
    Base.precompile(Tuple{typeof(σm),Int64})
    Base.precompile(Tuple{typeof(σm),Symbol,Vararg{Symbol, N} where N})
    Base.precompile(Tuple{typeof(σm),Symbol})
    Base.precompile(Tuple{typeof(σm),Tuple{Symbol, Symbol}})
    Base.precompile(Tuple{typeof(σm)})
    Base.precompile(Tuple{typeof(σp),Int64})
    Base.precompile(Tuple{typeof(σp),Symbol})
    Base.precompile(Tuple{typeof(σp),Tuple{Symbol, Symbol}})
    Base.precompile(Tuple{typeof(σp)})
    Base.precompile(Tuple{typeof(σx),Int64})
    Base.precompile(Tuple{typeof(σx),Symbol,Vararg{Any, N} where N})
    Base.precompile(Tuple{typeof(σx),Symbol})
    Base.precompile(Tuple{typeof(σx),Tuple{Symbol, Symbol}})
    Base.precompile(Tuple{typeof(σx)})
    Base.precompile(Tuple{typeof(σy),Int64})
    Base.precompile(Tuple{typeof(σy),Symbol,Vararg{Symbol, N} where N})
    Base.precompile(Tuple{typeof(σy),Symbol})
    Base.precompile(Tuple{typeof(σy)})
    Base.precompile(Tuple{typeof(σz),Int64,Vararg{Any, N} where N})
    Base.precompile(Tuple{typeof(σz),Int64})
    Base.precompile(Tuple{typeof(σz),Symbol,Vararg{Symbol, N} where N})
    Base.precompile(Tuple{typeof(σz),Symbol})
    Base.precompile(Tuple{typeof(σz)})
    Base.precompile(Tuple{var"##24#ann",Int64,Vararg{Any, N} where N})
    Base.precompile(Tuple{var"##24#ann",Int64})
    Base.precompile(Tuple{var"##24#ann",String})
    Base.precompile(Tuple{var"##24#ann",Symbol,Vararg{Symbol, N} where N})
    Base.precompile(Tuple{var"##24#ann",Symbol})
    Base.precompile(Tuple{var"##24#ann"})
    Base.precompile(Tuple{var"##25#cre",Int64,Vararg{Any, N} where N})
    Base.precompile(Tuple{var"##25#cre",Int64})
    Base.precompile(Tuple{var"##25#cre",Symbol,Vararg{Symbol, N} where N})
    Base.precompile(Tuple{var"##25#cre",Symbol})
    Base.precompile(Tuple{var"##25#cre"})
    Base.precompile(Tuple{var"##28#ann",Symbol})
    Base.precompile(Tuple{var"##28#ann"})
    Base.precompile(Tuple{var"##29#cre",Symbol,Vararg{Symbol, N} where N})
    Base.precompile(Tuple{var"##29#cre",Symbol})
    Base.precompile(Tuple{var"##29#cre"})
end


text:
module FLoops

# Use README as the docstring of the module:
@doc let path = joinpath(dirname(@__DIR__), "README.md")
    include_dependency(path)
    doc = read(path, String)
    doc = replace(doc, r"^```julia"m => "```jldoctest README")
    doc = replace(
        doc,
        "https://juliafolds.github.io/FLoops.jl/dev/tutorials/sequential/" => "@ref tutorials-sequential",
    )
    doc = replace(
        doc,
        "https://juliafolds.github.io/FLoops.jl/dev/tutorials/parallel/#tutorials-executor" => "@ref tutorials-executor",
    )
    doc = replace(
        doc,
        "https://juliafolds.github.io/FLoops.jl/dev/tutorials/parallel/" => "@ref tutorials-parallel",
    )
    doc
end FLoops

export @floop, @init, @reduce, DistributedEx, SequentialEx, ThreadedEx

using BangBang.Extras: broadcast_inplace!!
using BangBang: materialize!!, push!!
using Base.Meta: isexpr
using FLoopsBase: AbstractScratchSpace, EXTRA_STATE_VARIABLES
using InitialValues: InitialValue
using JuliaVariables: JuliaVariables, Var, simplify_ex
using MLStyle: @match
using Setfield: @set
using Serialization: AbstractSerializer, Serialization
using Transducers:
    @return_if_reduced,
    Cat,
    DefaultInit,
    DistributedEx,
    Executor,
    IdentityTransducer,
    Map,
    MapCat,
    NotA,
    OnInit,
    PreferParallel,
    ProductRF,
    ReduceIf,
    Reduction,
    SequentialEx,
    ThreadedEx,
    Transducers,
    complete,
    extract_transducer,
    foldl_nocomplete,
    foldxd,
    foldxl,
    foldxt,
    maybe_set_simd,
    next,
    reduced,
    right,
    transduce,
    unreduced,
    whencombine,
    wheninit

if isdefined(JuliaVariables, :solve!)
    using JuliaVariables: solve!
else
    const solve! = JuliaVariables.solve
end
if isdefined(JuliaVariables, :solve_from_local!)
    using JuliaVariables: solve_from_local!
else
    const solve_from_local! = JuliaVariables.solve_from_local
end

if !@isdefined isnothing
    using Compat: isnothing
end

include("utils.jl")
include("macro.jl")
include("reduce.jl")
include("scratchspace.jl")
include("checkboxes.jl")

end # module

ext: jl


text:
using PyPreferences
using Test

@testset "PyPreferences.jl" begin
    # Write your tests here.
end


text:
using Dates

const BASE_PATH = normpath(joinpath(@__DIR__, "..", ".."))

# remove old log (it will grow fast)
isfile("$(BASE_PATH)sar_stats.log") && rm("$(BASE_PATH)sar_stats.log")

function logger(
    payload::Any,
    message::String = "",
    console::Bool = false;
    failed::Bool = false,
)
    open("$(BASE_PATH)sar_stats.log", "a") do io
        println(io, "$(Dates.now()) # $message")
        println(io, payload)
        println(io, "")
        if console
            println("$(Dates.now()) # $message # $payload")
        end
    end
end

max_stars_repo_name: Agapanthus/server-diary

max_issues_repo_name: Agapanthus/server-diary

max_forks_repo_name: Agapanthus/server-diary


text:
# Autogenerated wrapper script for HarfBuzz_ICU_jll for x86_64-w64-mingw32
export libharfbuzz_icu

using Cairo_jll
using Fontconfig_jll
using FreeType2_jll
using Glib_jll
using Graphite2_jll
using Libffi_jll
using HarfBuzz_jll
using ICU_jll
JLLWrappers.@generate_wrapper_header("HarfBuzz_ICU")
JLLWrappers.@declare_library_product(libharfbuzz_icu, "libharfbuzz-icu-0.dll")
function __init__()
    JLLWrappers.@generate_init_header(Cairo_jll, Fontconfig_jll, FreeType2_jll, Glib_jll, Graphite2_jll, Libffi_jll, HarfBuzz_jll, ICU_jll)
    JLLWrappers.@init_library_product(
        libharfbuzz_icu,
        "bin\\libharfbuzz-icu-0.dll",
        RTLD_LAZY | RTLD_DEEPBIND,
    )

    JLLWrappers.@generate_init_footer()
end  # __init__()


text:
# --------------------------------------------------------------------------
# ACE1.jl: Julia implementation of the Atomic Cluster Expansion
# Copyright (c) 2019 Christoph Ortner <christophortner0@gmail.com>
# Licensed under ASL - see ASL.md for terms and conditions.
# --------------------------------------------------------------------------

using ACE1, Test, Printf, LinearAlgebra, StaticArrays, BenchmarkTools,
      JuLIP, JuLIP.Testing

##
@testset "ACE1.jl" begin
    # ------------------------------------------
    #   basic polynomial basis building blocks
    include("polynomials/test_ylm.jl")
    include("polynomials/test_rylm.jl")
    include("polynomials/test_transforms.jl")
    include("polynomials/test_orthpolys.jl")

    # --------------------------------------------
    # core permutation-invariant functionality
    include("test_1pbasis.jl")
    include("test_pibasis.jl")
    include("test_pipot.jl")

    # ------------------------
    #   rotation_invariance
    # TODO: implement a check whether Sympy is available and run test conditionally
    include("rpi/test_cg.jl")
    include("rpi/test_rpibasis.jl")

    # ----------------------
    #   pair potentials
    include("pair/test_pair_basis.jl")
    include("pair/test_pair_pot.jl")
    include("pair/test_repulsion.jl")

    # ----------------------
    #   miscallaneous ...
    # TODO: These tests are current failing - should be re-examined and fixed
    # include("compat/test_compat.jl")

    include("test_any.jl")
    include("polynomials/test_multitrans.jl")
end


text:
"""
    AbstractVTKDataset

Abstract type representing any structured or unstructured VTK dataset.

The dataset classification is described in the
[VTK file format
specification](https://vtk.org/wp-content/uploads/2015/04/file-formats.pdf),
page 12.
"""
abstract type AbstractVTKDataset end

"""
    StructuredVTKDataset <: AbstractVTKDataset

Abstract type representing a structured VTK dataset.

Subtypes are `VTKImageData`, `VTKRectilinearGrid` and `VTKStructuredGrid`.
"""
abstract type StructuredVTKDataset <: AbstractVTKDataset end

struct VTKImageData <: StructuredVTKDataset end
struct VTKRectilinearGrid <: StructuredVTKDataset end
struct VTKStructuredGrid <: StructuredVTKDataset end

"""
    UnstructuredVTKDataset <: AbstractVTKDataset

Abstract type representing an unstructured VTK dataset.

Subtypes are `VTKPolyData` and `VTKUnstructuredGrid`.
"""
abstract type UnstructuredVTKDataset <: AbstractVTKDataset end

struct VTKPolyData <: UnstructuredVTKDataset end
struct VTKUnstructuredGrid <: UnstructuredVTKDataset end

file_extension(::VTKImageData) = ".vti"
file_extension(::VTKRectilinearGrid) = ".vtr"
file_extension(::VTKStructuredGrid) = ".vts"
file_extension(::VTKPolyData) = ".vtp"
file_extension(::VTKUnstructuredGrid) = ".vtu"

xml_name(::VTKImageData) = "ImageData"
xml_name(::VTKRectilinearGrid) = "RectilinearGrid"
xml_name(::VTKStructuredGrid) = "StructuredGrid"
xml_name(::VTKPolyData) = "PolyData"
xml_name(::VTKUnstructuredGrid) = "UnstructuredGrid"


text:
# Run tests on Beyns contour integral method

using NonlinearEigenproblemsTest
using NonlinearEigenproblems
using Test
using Random
using LinearAlgebra

@testset "Beyn contour" begin

    nep=nep_gallery("dep0")
    @bench @testset "disk at origin" begin
        Random.seed!(0);

        λ,v=contour_beyn(nep,logger=displaylevel,radius=1,neigs=1,sanity_check=false)

        for i = 1:size(λ,1)
            @info "$i: $(λ[i])"
            M=compute_Mder(nep,λ[i])
            minimum(svdvals(M))
            @test minimum(svdvals(M)) < eps()*1000
            @test norm(compute_Mlincomb(nep,λ[i],v[:,i]))/norm(v[:,i]) < eps()*500
        end

        λ,v=contour_beyn(nep,logger=displaylevel,radius=0.4,k=2,N=100,sanity_check=false)
        M=compute_Mder(nep,λ[1])
        minimum(svdvals(M))
        @test minimum(svdvals(M))<eps()*1000

    end
    @bench @testset "shifted disk" begin

        λ,v=contour_beyn(nep,logger=displaylevel,σ=0.2,radius=1.0,
                         neigs=4,sanity_check=false)

        @test size(λ,1)==3
        for i = 1:3
            @info "$i: $(λ[i])"
            M=compute_Mder(nep,λ[i])
            minimum(svdvals(M))
            @test minimum(svdvals(M)) < eps()*10000
            @test norm(compute_Mlincomb(nep,λ[i],v[:,i]))/norm(v[:,i]) < eps()*10000
        end

    end

end


text:
@agent Organism GridAgent{2} begin
    species::Symbol
    phages_inside::Vector{Int}
    kind::Symbol
    state::Symbol
    time_in_state::Int
    type::Symbol
end

Base.@kwdef mutable struct Parameters
    bacteria_count::Int = 265
    phages_count::Int = 148
    environment::Symbol = :semi_solid
    diffuse::Bool = true
    a::Float64 = 0.0
    b::Float64 = 0.08
    m::Float64 = 27.0
    α::Float64 = 8.0
    κ::Float64 = 0.05
    moi_proxy_radius::Int = 1
    infection_distance::Int = 1
    latent_period::Int = 5
    burst_size::Int = 4
    carrying_capacity::Int = 3 * bacteria_count
    growth_rate::Float64 = 0.6
    decay_factor::Float64 = 0.02
    p_burst = 0.9
end


text:
# Consatructs finite difference approximation of
# nonlinear reaction diffusion equation.

function reaction_diffusion_equation(;L=10.0, steps=5, nx=51, c=1.0, sigma=0.1, process_noise=0.0, measurement_noise=0.0)
    dx = L / (nx - 1)
    dt = sigma * dx^2

    xs = range(0.0, length=nx, stop=L)

    function f(u0, d)
        u = copy(u0)
        un = copy(u0)
        for t in 1:steps
            u = copy(un)
            # FD approximation of heat equation
            f_local(v) = v[2:end - 1, :] .* (1 .- v[2:end - 1, :]) .* ( v[2:end - 1, :] .- 0.5)
            laplacian(v) = (v[1:end - 2, :] + v[3:end, :] - 2v[2:end - 1, :]) / dx^2

            # Euler step for time
            un[2:end - 1, :] = u[2:end - 1, :] + dt * (laplacian(u) + f_local(u) / 2 ) +
                                    process_noise*randn(size(u[2:end - 1, :]))

            # Boundary condition
            un[1:1, :]   = d;
            un[end:end, :] = d;
        end
        return u
    end

    function g(u, d)
        return [d + measurement_noise*randn(1, size(d, 2));
                u[end ÷ 2:end ÷ 2, :] + measurement_noise*randn(1, size(u, 2))]
    end
    return f, g
end

max_stars_repo_name: imanchester/REN

max_issues_repo_name: imanchester/REN

max_forks_repo_name: imanchester/REN


text:
module CudaPOMDPs

using POMDPs
"""
    CudaPOMDP{S,A,O}
Abstract base type for a partially observable Markov decision process that run on GPUs.
    S: state type
    A: action type
    O: observation type
"""

abstract type CudaPOMDP{S, A, O} <: POMDP{S, A, O} end

export CudaPOMDP

end


text:
using Gadfly, DataArrays

plot(x=rand(100), y=rand(100), color=rand(100), shape=rand(1:8, 100),
     Geom.point)


text:
# Based on the the "Contour Following Algorithm" described in Chapter 5 of
# Costa, L., Cesar, Jr., R., Laplante, P. (2009). Shape Classification and Analysis. Boca Raton: CRC Press, https://doi.org/10.1201/9780849379406
function trace_boundary(t::CostaOuter, labels::AbstractArray, N::Int = 0)
    N = N == 0 ? maximum(labels) : N
    boundary = [Vector{CartesianIndex{2}}(undef, 0) for n = 1:N]
    # By padding we will avoid having to do out-of-bounds checking when we
    # consider a pixel's neighbourhood.
    labels_padded = padarray(labels, Fill(0, (2,2)))
    # Labeled neighbourhood used by the contour-tracking algorithm which follows
    # the Freeman chain-code convention.
    # 3 2 1
    # 4 P 0
    # 5 6 7
    N₈ = OffsetVector(CartesianIndex.([(0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1), (1, 0), (1, 1)]), 0:7)
    invert = OffsetVector([4, 5, 6, 7, 0, 1, 2, 3], 0:7)
    isfirst = fill(true, N)
    nrow, ncol = size(labels)
    for p in CartesianIndices((0:nrow + 1, 0:ncol + 1))
        l = labels_padded[p]
        l₀ = labels_padded[p + N₈[0]]
        if l == 0 && l₀ != 0 && isfirst[l₀]
            B₁ = p
            push!(boundary[l₀], B₁)
            isfirst[l₀] = false
            pₙ₊₁, curr2next  = find_second_outer(p, N₈, labels_padded, l₀)
            while pₙ₊₁ != B₁
                push!(boundary[l₀], pₙ₊₁)
                prev2curr = curr2next
                pₙ₊₁, curr2next = find_next_outer(pₙ₊₁, prev2curr, N₈, labels_padded, l₀, invert)
            end
        end
    end
    boundary
end

function find_second_outer(p, N₈, labels, l)
    # Because we are tracing an outer contour, once we find the first pixel
    # there *must* be second pixel so we can be sure that this function will
    # always return from within the "if" statement.
    for r = 4:9
        pₙ₊₁ = p + N₈[mod(r, 8)]
        pₙ₊₂ = p + N₈[mod(r + 1, 8)]
        if labels[pₙ₊₁] == 0 && labels[pₙ₊₂] == l
            return pₙ₊₁, r
        end
    end
end

function find_next_outer(p, prev2curr, N₈, labels, l, invert)
    # These initial values will be overwritten in the loop.
    pₙ₊₁ = p
    curr2next = prev2curr

    curr2prev = invert[prev2curr]
    for r = 0:6
        dₑ =  mod(curr2prev + r, 8)
        dₗ =  mod(curr2prev + r + 1, 8)
        pₑ = p + N₈[dₑ]
        pₗ = p + N₈[dₗ]
        if labels[pₑ] == 0 && labels[pₗ] == l
            pₙ₊₁ =  pₑ
            curr2next = dₑ
        end
    end
    pₙ₊₁, curr2next
end


text:
using BinDeps
using Libdl
using Conda

@BinDeps.setup

## First install fftw
fftw = library_dependency("libfftw3")
fftw_threads = library_dependency("libfftw3_threads")

# Conda just dumps the binaries into the right place
usr = usrdir(fftw)
if !isdir(usr)
    mkdir(usr)
end
Conda.add("fftw", usr)

# Dummy build processes
provides(BuildProcess,
         (@build_steps begin
          end),
         fftw)
provides(BuildProcess,
         (@build_steps begin
          end),
         fftw_threads)
# ...because this does not work:
#provides(Binaries, "usr", fftw)
#provides(Binaries, "usr", fftw_threads)

@BinDeps.install Dict(
    :libfftw3 => :fftw,
    :libfftw3_threads => :fftw_threads
)

## Now fftw is in place, download and build finufft
libfinufft = library_dependency("libfinufft")

provides(Sources,
         URI("https://github.com/flatironinstitute/finufft/archive/1.1.1.zip"),
         libfinufft,
         unpacked_dir = "finufft-1.1.1")

rootdir = joinpath(BinDeps.srcdir(libfinufft), "finufft-1.1.1")
libname = "libfinufft." * Libdl.dlext
libfile = joinpath(BinDeps.libdir(libfinufft),libname)
buildfile = joinpath(rootdir, "lib", "libfinufft.so")

@show lib = BinDeps.libdir(fftw)
@show inc = BinDeps.includedir(fftw)

# "FFTWOMPSUFFIX=threads" because Conda doesn't supply libfftw3_omp
if Sys.KERNEL == :Darwin
    buildcmd = `make lib/libfinufft.so LIBRARY_PATH=$lib CPATH=$inc FFTWOMPSUFFIX=threads CXX=g++-8 CC=gcc-8`
else
    buildcmd = `make lib/libfinufft.so LIBRARY_PATH=$lib CPATH=$inc FFTWOMPSUFFIX=threads`
end

finufftbuild =
    @build_steps begin
        GetSources(libfinufft)
        @build_steps begin
            ChangeDirectory(rootdir)
            buildcmd
            CreateDirectory(libdir(libfinufft))
            `cp $buildfile $libfile`
        end
    end
run(finufftbuild)

# Just add to deps.jl to bypass BinDeps checking
depsfile_location = joinpath(splitdir(Base.source_path())[1],"deps.jl")
fh = open(depsfile_location, "a")
write(fh, "\n@checked_lib libfinufft \"$libfile\"\n")
close(fh)


text:
using SphericalHarmonics
using Test, LinearAlgebra, StaticArrays, BenchmarkTools

@testset "SphericalHarmonics" begin
   include("test_ylm.jl")
   include("test_cg.jl")
end


text:
using VsRecorder
using VsRecorder.Scenes: BattleMain

@testset "Battle Main" begin
    config = vs_setup(
        PokemonBattle,
        language = VsI18n.ZHS,
        init_descriptors = false,
        parse_type = PARSE_BOTH_PLAYERS
    )
    ctx = VsRecorderBase.initialize(config)

    frame = VsFrame(image = VsRecorder.load_data("scenes", "zhs", "battle-main.png"))
    parsed = vs_tryparse_scene(BattleMain, frame, ctx)
    @test parsed.player_a_pokes == PokemonID[:incineroar, :grimmsnarl]
    @test parsed.player_b_pokes == PokemonID[:zacian, :regieleki]
end


text:
using CayleyDickson
using Base.Test: @test, @test_throws

@test begin
    a = CayleyDickson.randomBigInt()
    b = CayleyDickson.randomBigInt()
    l = Exo1Binion(Exo1Real(a, b))
    r = Exo1Binion(a, 0, b, 0)
    l == r
end

@test begin
    a = CayleyDickson.randomBigFloat()
    isreal(Exo1Binion(a))
end

@test begin
    a = 1
    !isreal(Exo1Binion(a, a, a, a))
end

@test begin
    z = random(Exo1Binion{Int})
    z == +(z)
end

@test begin
    a = 1
    real(Exo1Binion(a)) == a
end

@test begin
    a = 1
    b = 2
    c = 3
    l = unreal(Exo1Binion(0, a, b, c))
    r = [a, b, c]
    l == r
end

@test begin
    io = IOBuffer()
    show(io, Exo1Binion(1, 2, 3, 4))
    l = String(take!(io))
    r = "[1: 1, i: 2, a: 3, ia: 4]"
    l == r
end

@test begin
    a = CayleyDickson.randomBigInt()
    b = CayleyDickson.randomBigFloat()
    l = Exo1Binion(Binion(a, b))
    r = Exo1Binion(a, b)
    l == r
end

@test begin
    a = CayleyDickson.randomBigInt()
    b = CayleyDickson.randomBigFloat()
    c = CayleyDickson.randomBigInt()
    l = Exo1Binion(a, b, c)
    r = Exo1Binion(a, b, c, 0)
    l == r
end

@test begin
    x = random(Exo1Binion{BigFloat})
    y = random(Exo1Binion{BigFloat})
    x != y
end

@test begin
    a = CayleyDickson.randomBigInt()
    z = random(Exo1Binion{BigInt})
    l = a + z
    r = z + a
    l == r
end

@test begin
    a = random(Binion{BigInt})
    z = random(Exo1Binion{BigInt})
    l = a + z
    r = z + a
    l == r
end

@test begin
    a = CayleyDickson.randomBigInt()
    z = random(Exo1Binion{BigInt})
    l = a - z
    r = -(z - a)
    l == r
end

@test begin
    a = random(Binion{BigInt})
    z = random(Exo1Binion{BigInt})
    l = a - z
    r = -(z - a)
    l == r
end

@test begin
    x = random(Exo1Binion{BigInt})
    y = random(Exo1Binion{BigInt})
    l = x + y
    r = y + x
    l == r
end

@test begin
    x = random(Exo1Binion{BigInt})
    y = random(Exo1Binion{BigInt})
    l = x * y
    r = y * x
    l != r
end

@test begin
    x = random(Exo1Binion{BigInt})
    y = random(Exo1Binion{BigInt})
    z = random(Exo1Binion{BigInt})
    l = associator(x, y, z)
    r = zero(Exo1Binion{BigInt})
    l == r
end

@test begin
    x = random(Exo1Binion{BigInt})
    y = random(Exo1Binion{BigInt})
    l = x - y
    r = -(y - x)
    l == r
end

@test begin
    x = random(Exo1Binion{BigInt})
    y = random(Exo1Binion{BigInt})
    z = random(Exo1Binion{BigInt})
    l = (x + y) + z
    r = x + (y + z)
    l == r
end

@test begin
    x = random(Exo1Binion{BigInt})
    y = random(Exo1Binion{BigInt})
    z = random(Exo1Binion{BigInt})
    l = (x * y) * z
    r = x * (y * z)
    l == r
end

@test begin
    x = random(Exo1Binion{BigInt})
    conj(conj(x)) == x
end

@test begin
    x = random(Exo1Binion{Rational{BigInt}})
    inv(inv(x)) == x
end

@test begin
    x = random(Exo1Binion{BigInt})
    y = random(Exo1Binion{BigInt})
    l = conj(x * y)
    r = conj(y) * conj(x)
    l == r
end

@test begin
    x = random(Exo1Binion{BigInt})
    y = random(Exo1Binion{BigInt})
    l = conj(x + y)
    r = conj(x) + conj(y)
    l == r
end

@test begin
    x = random(Exo1Binion{BigInt})
    y = random(Exo1Binion{BigInt})
    l = conj(x - y)
    r = conj(x) - conj(y)
    l == r
end

@test begin
    x = random(Exo1Binion{Rational{BigInt}})
    y = random(Exo1Binion{Rational{BigInt}})
    l = inv(x * y)
    r = inv(y) * inv(x)
    l == r
end

@test begin
    x = random(Exo1Binion{Rational{BigInt}})
    y = random(Exo1Binion{Rational{BigInt}})
    l = inv(x / y)
    r = y / x
    l == r
end

@test begin
    x = random(Exo1Binion{Rational{BigInt}})
    y = random(Exo1Binion{Rational{BigInt}})
    l = inv(x \ y)
    r = y \ x
    l == r
end

@test begin
    x = random(Exo1Binion{BigInt})
    y = random(Exo1Binion{BigInt})
    z = random(Exo1Binion{BigInt})
    l = x * (y + z)
    r = (x * y) + (x * z)
    l == r
end

@test begin
    a = CayleyDickson.randomBigInt()
    x = random(Exo1Binion{BigInt})
    y = random(Exo1Binion{BigInt})
    l = a * (x + y)
    r = (a * x) + (a * y)
    l == r
end

@test begin
    a = CayleyDickson.randomBigInt()
    x = random(Exo1Binion{BigInt})
    l = a * x
    r = x * a
    l == r
end

@test begin
    a = random(Binion{BigInt})
    x = random(Exo1Binion{BigInt})
    l = a * x
    r = x * a
    l != r
end

@test begin
    x = random(Exo1Binion{BigInt})
    y = random(Exo1Binion{BigInt})
    z = random(Exo1Binion{BigInt})
    l = (x + y) * z
    r = (x * z) + (y * z)
    l == r
end

@test begin
    x = random(Exo1Binion{BigInt})
    y = random(Exo1Binion{BigInt})
    z = random(Exo1Binion{BigInt})
    l = x * (y - z)
    r = (x * y) - (x * z)
    l == r
end

@test begin
    x = random(Exo1Binion{BigInt})
    y = random(Exo1Binion{BigInt})
    z = random(Exo1Binion{BigInt})
    l = (x - y) * z
    r = (x * z) - (y * z)
    l == r
end

@test begin
    x = random(Exo1Binion{BigInt})
    quadrance(x) > big(0) || quadrance(x) == big(0)
end

@test begin
    x = random(Exo1Binion{BigInt})
    y = random(Exo1Binion{BigInt})
    l = quadrance(x * y)
    r = quadrance(x) * quadrance(y)
    l == r
end

@test_throws ErrorException begin
    inv(Exo1Binion(0, 0.0))
end

@test_throws ErrorException begin
    inv(Exo1Binion(0, 0, 1, 1))
end

@test_throws ErrorException begin
    inv(Exo1Binion(0, 0, 2, 1))
end

@test_throws ErrorException begin
    random(Exo1Binion{Int}) / 0
end

@test_throws ErrorException begin
    0 \ random(Exo1Binion{Int})
end

@test begin
    a = CayleyDickson.randomBigRational()
    z = random(Exo1Binion{Rational{BigInt}})
    l = z / a
    r = a \ z
    l == r
end

@test begin
    a = CayleyDickson.randomBigRational()
    z = random(Exo1Binion{Rational{BigInt}})
    l = a / z
    r = z \ a
    l == r
end

@test begin
    z = random(Exo1Binion{BigInt})
    z == z + zero(Exo1Binion{BigInt})
end

@test begin
    z = random(Exo1Binion{BigInt})
    z == z * one(Exo1Binion{BigInt})
end

@test begin
    z = random(Exo1Binion{BigInt})
    z == z + zero(z)
end

@test begin
    z = random(Exo1Binion{BigInt})
    z == z * one(z)
end

@test begin
    z = random(Exo1Binion{BigInt})
    z == cloak(cloak(z))
end

@test begin
    z = random(Exo1Binion{BigInt})
    z == dagger(dagger(z))
end

@test begin
    z = random(Exo1Binion{BigInt})
    z == star(star(z))
end

@test begin
    z = random(Exo1Binion{BigInt})
    selfstar(z) == selfstar(selfstar(z))
end

@test begin
    z = random(Exo1Binion{BigInt})
    anti_selfstar(z) == anti_selfstar(anti_selfstar(z))
end


text:
#local_dir = "/home/awise/Desktop/RvSpectML/RvLineList"
#local_dir = "/storage/work/afw5465/RvSpectML"

#using Pkg
# Pkg.activate(".")
using RvLineList, DataFrames, CSV, ArgParse

local_dir = pkgdir(RvLineList)
cd(local_dir)

#load param file
include(joinpath(local_dir,"inputs","param.jl"))

s = ArgParseSettings()

@add_arg_table s begin
   "--allowBlends"
      help = "number of blends allowed with each line, e.g. 0 for single lines only, 1 for doublets only, [0,1] for singlets and doublets"
      arg_type = Int
   "--overlap_cutoff"
      help = "distance between lines required for them to be categorized as a blend, expressed as a fraction of the speed of light"
      arg_type = Float64
   "--rejectTelluricSlope"
      help = "derivative of spectrum required for telluric line rejection, in units of normalized depth per fraction of speed of light - a value of 0 turns off telluric rejection, 2000-10000 is recommended range in values"
      arg_type = Float64
   "--badLineFilter"
      help = "which mask to use to filter out bad lines. Tested Options: none, ESPRESSOG2"
      arg_type = String
   "--quant"
      help = "quantile for stability of fit params for empirical masks - BROKEN in command line - works in param file" # BROKEN in command line - works in param file
      arg_type = String
   "--nbin"
      help = "number of mask subdivisions to make"
      arg_type = Int
   "--output_dir"
      help = "directory to save mask outputs in"
      arg_type = String
   "--VALD_output"
      help = "whether or not to carry VALD line data through to the final mask"
      arg_type = Bool
end

   parsed_args = parse_args(s)

if parsed_args["allowBlends"] !== nothing
   println("Found command-line arg allowBlends. Overwriting param file definition of this arg.")
   global allowBlends = parsed_args["allowBlends"]
end

if parsed_args["overlap_cutoff"] !== nothing
   println("Found command-line arg overlap_cutoff. Overwriting param file definition of this arg.")
   global overlap_cutoff = parsed_args["overlap_cutoff"]
end

if parsed_args["rejectTelluricSlope"] !== nothing
   println("Found command-line arg rejectTelluricSlope. Overwriting param file definition of this arg.")
   global rejectTelluricSlope = parsed_args["rejectTelluricSlope"]
end

if parsed_args["badLineFilter"] !== nothing
   println("Found command-line arg badLineFilter. Overwriting param file definition of this arg.")
   global badLineFilter = parsed_args["badLineFilter"]
end

if parsed_args["quant"] !== nothing
   println("Found command-line arg quant. Overwriting param file definition of this arg.")
   global quant = parsed_args["quant"]
end

if parsed_args["nbin"] !== nothing
   println("Found command-line arg nbin. Overwriting param file definition of this arg.")
   global nbin = parsed_args["nbin"]
end

if parsed_args["output_dir"] !== nothing
   println("Found command-line arg output_dir. Overwriting param file definition of this arg.")
   global output_dir = parsed_args["output_dir"]
end

if parsed_args["VALD_output"] !== nothing
   println("Found command-line arg VALD_output. Overwriting param file definition of this arg.")
   global VALD_output = parsed_args["VALD_output"]
end

#generate empirical NEID mask

#set up output directories
if !isdir(joinpath(output_dir,"clean_masks"))
   mkdir(joinpath(output_dir,"clean_masks"))
end
if !isdir(joinpath(output_dir,"VALD_masks"))
   mkdir(joinpath(output_dir,"VALD_masks"))
end
if !isdir(joinpath(output_dir,"mask_bins"))
   mkdir(joinpath(output_dir,"mask_bins"))
end
if !isdir(joinpath(output_dir,"linefinder"))
   mkdir(joinpath(output_dir,"linefinder"))
end

pipeline_plan = RvLineList.PipelinePlan()
RvLineList.RvSpectMLBase.Pipeline.save_data!(pipeline_plan, :fit_lines) #tell the pipeline plan to save the line fits

@time empirical_mask = generateEmpiricalMask(output_dir=output_dir, pipeline_plan=pipeline_plan) #TODO: figure out why I can't run this with eval(param.jl) statement commented out in empriical_line_lists.jl (note param file was loaded earlier into global scope) - this eval statement resets quant

using PyCall
try
   pyimport("pandas") #make sure pandas is installed
catch e
   pyimport_conda("pandas", "pandas") #if the module fails to load, install it to Conda.jl environment
   pyimport("pandas") #make sure pandas is installed
end
@pyinclude("src/make_VALD_line_list.py")
@time VALD_masks, VALD_masks_long = py"getVALDmasks"(overlap_cutoff=overlap_cutoff, depth_cutoff=depth_cutoff, iron1Only=iron1Only, badLineFilter=badLineFilter, allowBlends=allowBlends)
VALD_mask = VALD_masks[0]
VALD_mask_long = VALD_masks_long[0]

import Pandas.DataFrame as pd_df

empirical_mask_2col = select(empirical_mask,[:median_λc, :median_depth])
rename!(empirical_mask_2col, [:lambda, :depth])
#debug empirical_mask_2col = CSV.read(joinpath(output_dir,"RvLineList_species=all_depthcutoff=0.05_overlapcutoff=1.0e-5_allowBlends=0_badLineFilter=none_rejectTelluricSlope=0.0_nbin=1_DP=true_binParam=depth_n=0_VACUUM.csv"), DataFrame)
#debug empirical_mask_2col = Dict(pairs(eachcol(empirical_mask_2col)))
empirical_mask_pd = pd_df(empirical_mask_2col)

combined_mask = py"mask_intersection"(empirical_mask_pd, VALD_output ? VALD_mask_long : VALD_mask, threshold=500.0)

function pd_df_to_df(df_pd)
   df = DataFrame()
   for col in df_pd.columns
      df[!,col] = getproperty(df_pd,col).values
   end
   df
end

combined_mask_df = pd_df_to_df(combined_mask)

telluric_indices = py"getTelluricIndices"(combined_mask, true, overlap_cutoff, vel_slope_threshold=rejectTelluricSlope, RV_offset = 0.0, RV_range = 1e-4)

mask = combined_mask_df[map(!,telluric_indices),:]

mask.weight = mask.depth

#binned_masks = binMask(rename(mask,[:lambda,:weight]), nbin, binParam=:weight)
binned_masks = binMask(mask, nbin, binParam=binParam)
#rename!(binned_masks[1], [:lambda, :depth])

for bin_n in 1:nbin
   saveStr = "RvLineList" * "_allowBlends="*string(allowBlends) * "_overlapcutoff="*string(overlap_cutoff) * "_rejectTelluricSlope="*string(rejectTelluricSlope) * "_badLineFilter="*badLineFilter* "_quant="*quant * "_nbin="*string(nbin) * "_DP="*string(depthPercentile) * "_binParam="*string(binParam) * "_n="*string(bin_n) * "_VALD_output="*string(VALD_output) * "_VACUUM" * ".csv"
   CSV.write(joinpath(output_dir,"clean_masks",saveStr),binned_masks[bin_n])
end

#julia --project=RvSpectML/RvLineList RvSpectML/RvLineList/examples/NEID_test_script.jl --allowBlends=0 --overlap_cutoff=1e-5 --rejectTelluricSlope=2000 --badLineFilter="none", --nbin=1 --output_dir="/home/awise/Desktop/neid_masks"

#julia --project=RvSpectML/RvLineList RvSpectML/RvLineList/examples/NEID_test_script.jl --allowBlends=0 --overlap_cutoff=2e-5 --rejectTelluricSlope=2000 --badLineFilter="none", --nbin=1 --output_dir="/home/awise/Desktop/neid_masks"

#julia --project=RvSpectML/RvLineList RvSpectML/RvLineList/examples/NEID_test_script.jl --allowBlends=0 --overlap_cutoff=1e-5 --rejectTelluricSlope=2000 --badLineFilter="ESPRESSOG2", --nbin=1 --output_dir="/home/awise/Desktop/neid_masks"

#julia --project=RvSpectML/RvLineList RvSpectML/RvLineList/examples/NEID_test_script.jl --allowBlends=0 --overlap_cutoff=2e-5 --rejectTelluricSlope=2000 --badLineFilter="ESPRESSOG2", --nbin=1 --output_dir="/home/awise/Desktop/neid_masks"

max_stars_repo_name: alexander-wise/RvLineList

max_issues_repo_name: alexander-wise/RvLineList

max_forks_repo_name: alexander-wise/RvLineList


text:
"""
基本的点
"""

using Printf

struct Point2D
    x :: Float64
    y :: Float64
end

#function Base.show(io::IO, pt::Point2D)
#    @printf(io, "2D Point (%.6f, %.6f)\n", pt.x, pt.y)
#end

function shift_point(pt1::Point2D, pt2::Point2D)
    return Point2D(pt1.x + pt2.x, pt1.y + pt2.y)
end

Base.:+(pt1::Point2D, pt2::Point2D) = shift_point(pt1, pt2)

Base.:-(pt1::Point2D) = Point2D(-pt1.x, -pt1.y)

Base.:-(pt1::Point2D, pt2::Point2D) = shift_point(pt1, -pt2)

Base.:*(scal::N, pt1::Point2D) where N <: Real = Point2D(scal*pt1.x, scal*pt1.y)

"""
两个点的中点
"""
function middle_point(pt1::Point2D, pt2::Point2D; sc1=0.5, sc2=0.5) :: Point2D
    scs = sc1 + sc2
    xpt = pt1.x * sc1 + pt2.x * sc2
    xpt /= scs
    ypt = pt1.y * sc1 + pt2.y * sc2
    ypt /= scs
    return Point2D(xpt, ypt)
end

"""获取坐标系中点的角度，从x轴逆时针开始算"""
function absolute_angle(pt::Point2D)
    ang = atan(pt.y, pt.x)
    #负半轴加2pi
    if pt.y < 0
        ang = ang + 2pi
    end
    return ang
end