text:
function invariants_Q10_check(x)
prim=zeros(10,1);
pv=zeros(40,1);

v=zeros(54,1);
 v[1] = 1

 prim[1] = x[1] + x[2] + x[5] + x[3] + x[6] + x[8] +
x[4] + x[7] + x[9] + x[10]

 prim[2] = x[1]*x[2] + x[1]*x[5] + x[2]*x[5] +
x[1]*x[3] + x[2]*x[3] + x[1]*x[6] + x[5]*x[6] +
x[3]*x[6] + x[2]*x[8] + x[5]*x[8] + x[3]*x[8] +
x[6]*x[8] + x[1]*x[4] + x[2]*x[4] + x[3]*x[4] +
x[1]*x[7] + x[5]*x[7] + x[6]*x[7] + x[4]*x[7] +
x[2]*x[9] + x[5]*x[9] + x[8]*x[9] + x[4]*x[9] +
x[7]*x[9] + x[3]*x[10] + x[6]*x[10] + x[8]*x[10] +
x[4]*x[10] + x[7]*x[10] + x[9]*x[10]

 prim[3] = x[1]^2 + x[2]^2 + x[5]^2 + x[3]^2 + x[6]^2 +
x[8]^2 + x[4]^2 + x[7]^2 + x[9]^2 + x[10]^2

 prim[4] = x[1]*x[2]*x[3] + x[1]*x[5]*x[6] +
x[2]*x[5]*x[8] + x[3]*x[6]*x[8] +
x[1]*x[2]*x[4] + x[1]*x[3]*x[4] +
x[2]*x[3]*x[4] + x[1]*x[5]*x[7] +
x[1]*x[6]*x[7] + x[5]*x[6]*x[7] +
x[2]*x[5]*x[9] + x[2]*x[8]*x[9] +
x[5]*x[8]*x[9] + x[4]*x[7]*x[9] +
x[3]*x[6]*x[10] + x[3]*x[8]*x[10] +
x[6]*x[8]*x[10] + x[4]*x[7]*x[10] +
x[4]*x[9]*x[10] + x[7]*x[9]*x[10]

 prim[5] = x[1]^3 + x[2]^3 + x[5]^3 + x[3]^3 + x[6]^3 +
x[8]^3 + x[4]^3 + x[7]^3 + x[9]^3 + x[10]^3

 prim[6] = x[1]*x[2]*x[3]*x[4] +
x[1]*x[5]*x[6]*x[7] + x[2]*x[5]*x[8]*x[9] +
x[3]*x[6]*x[8]*x[10] + x[4]*x[7]*x[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x[4]^6 + x[7]^6 + x[9]^6 + x[10]^6

 pv[1] = x[1]^2*x[2] + x[1]*x[2]^2 + x[1]^2*x[5] +
x[2]^2*x[5] + x[1]*x[5]^2 + x[2]*x[5]^2 +
x[1]^2*x[3] + x[2]^2*x[3] + x[1]*x[3]^2 +
x[2]*x[3]^2 + x[1]^2*x[6] + x[5]^2*x[6] +
x[3]^2*x[6] + x[1]*x[6]^2 + x[5]*x[6]^2 +
x[3]*x[6]^2 + x[2]^2*x[8] + x[5]^2*x[8] +
x[3]^2*x[8] + x[6]^2*x[8] + x[2]*x[8]^2 +
x[5]*x[8]^2 + x[3]*x[8]^2 + x[6]*x[8]^2 +
x[1]^2*x[4] + x[2]^2*x[4] + x[3]^2*x[4] +
x[1]*x[4]^2 + x[2]*x[4]^2 + x[3]*x[4]^2 +
x[1]^2*x[7] + x[5]^2*x[7] + x[6]^2*x[7] +
x[4]^2*x[7] + x[1]*x[7]^2 + x[5]*x[7]^2 +
x[6]*x[7]^2 + x[4]*x[7]^2 + x[2]^2*x[9] +
x[5]^2*x[9] + x[8]^2*x[9] + x[4]^2*x[9] +
x[7]^2*x[9] + x[2]*x[9]^2 + x[5]*x[9]^2 +
x[8]*x[9]^2 + x[4]*x[9]^2 + x[7]*x[9]^2 +
x[3]^2*x[10] + x[6]^2*x[10] + x[8]^2*x[10] +
x[4]^2*x[10] + x[7]^2*x[10] + x[9]^2*x[10] +
x[3]*x[10]^2 + x[6]*x[10]^2 + x[8]*x[10]^2 +
x[4]*x[10]^2 + x[7]*x[10]^2 + x[9]*x[10]^2
 pv[2] = x[1]*x[2]*x[5] + x[1]*x[3]*x[6] +
x[2]*x[3]*x[8] + x[5]*x[6]*x[8] +
x[1]*x[4]*x[7] + x[2]*x[4]*x[9] +
x[5]*x[7]*x[9] + x[3]*x[4]*x[10] +
x[6]*x[7]*x[10] + x[8]*x[9]*x[10]
 v[2] = pv[1]
 v[3] = pv[2]
 pv[3] = x[1]^3*x[2] + x[1]*x[2]^3 + x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]^2*x[10] + x[2]*x[8]^2*x[9]*x[10] +
x[5]*x[8]^2*x[9]*x[10] + x[3]*x[8]^2*x[9]*x[10] +
x[6]*x[8]^2*x[9]*x[10] + x[2]*x[4]^2*x[9]*x[10] +
x[3]*x[4]^2*x[9]*x[10] + x[5]*x[7]^2*x[9]*x[10] +
x[6]*x[7]^2*x[9]*x[10] + x[2]*x[8]*x[9]^2*x[10] +
x[5]*x[8]*x[9]^2*x[10] + x[2]*x[4]*x[9]^2*x[10] +
x[8]*x[4]*x[9]^2*x[10] + x[5]*x[7]*x[9]^2*x[10] +
x[8]*x[7]*x[9]^2*x[10] + x[3]*x[6]*x[4]*x[10]^2 +
x[3]*x[8]*x[4]*x[10]^2 + x[3]*x[6]*x[7]*x[10]^2 +
x[6]*x[8]*x[7]*x[10]^2 + x[3]*x[4]*x[7]*x[10]^2 +
x[6]*x[4]*x[7]*x[10]^2 + x[3]*x[8]*x[9]*x[10]^2 +
x[6]*x[8]*x[9]*x[10]^2 + x[3]*x[4]*x[9]*x[10]^2 +
x[8]*x[4]*x[9]*x[10]^2 + x[6]*x[7]*x[9]*x[10]^2 +
x[8]*x[7]*x[9]*x[10]^2
 v[9] = pv[8]
 v[10] = pv[9]
 v[11] = pv[10]
 v[12] = pv[11]
 v[13] = pv[12]
 v[14] = pv[13]
 v[15] = pv[14]
 v[16] = pv[15]
 v[17] = pv[1]*pv[1]
 v[18] = pv[1]*pv[2]
 v[19] = pv[2]*pv[2]
 pv[16] = x[1]^5*x[2] + x[1]*x[2]^5 + x[1]^5*x[5] +
x[2]^5*x[5] + x[1]*x[5]^5 + x[2]*x[5]^5 +
x[1]^5*x[3] + x[2]^5*x[3] + x[1]*x[3]^5 +
x[2]*x[3]^5 + x[1]^5*x[6] + x[5]^5*x[6] +
x[3]^5*x[6] + x[1]*x[6]^5 + x[5]*x[6]^5 +
x[3]*x[6]^5 + x[2]^5*x[8] + x[5]^5*x[8] +
x[3]^5*x[8] + x[6]^5*x[8] + x[2]*x[8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x[9]^3 + x[8]^2*x[7]*x[9]^3 +
x[2]*x[7]^2*x[9]^3 + x[8]*x[7]^2*x[9]^3 +
x[1]^2*x[3]^3*x[10] + x[2]^2*x[3]^3*x[10] +
x[1]^2*x[6]^3*x[10] + x[5]^2*x[6]^3*x[10] +
x[2]^2*x[8]^3*x[10] + x[5]^2*x[8]^3*x[10] +
x[1]^2*x[4]^3*x[10] + x[2]^2*x[4]^3*x[10] +
x[1]^2*x[7]^3*x[10] + x[5]^2*x[7]^3*x[10] +
x[2]^2*x[9]^3*x[10] + x[5]^2*x[9]^3*x[10] +
x[1]*x[3]^3*x[10]^2 + x[2]*x[3]^3*x[10]^2 +
x[1]*x[6]^3*x[10]^2 + x[5]*x[6]^3*x[10]^2 +
x[2]*x[8]^3*x[10]^2 + x[5]*x[8]^3*x[10]^2 +
x[1]*x[4]^3*x[10]^2 + x[2]*x[4]^3*x[10]^2 +
x[1]*x[7]^3*x[10]^2 + x[5]*x[7]^3*x[10]^2 +
x[2]*x[9]^3*x[10]^2 + x[5]*x[9]^3*x[10]^2 +
x[6]^2*x[4]*x[10]^3 + x[8]^2*x[4]*x[10]^3 +
x[6]*x[4]^2*x[10]^3 + x[8]*x[4]^2*x[10]^3 +
x[3]^2*x[7]*x[10]^3 + x[8]^2*x[7]*x[10]^3 +
x[3]*x[7]^2*x[10]^3 + x[8]*x[7]^2*x[10]^3 +
x[3]^2*x[9]*x[10]^3 + x[6]^2*x[9]*x[10]^3 +
x[3]*x[9]^2*x[10]^3 + x[6]*x[9]^2*x[10]^3
 v[20] = pv[16]
 v[21] = pv[17]
 v[22] = pv[18]
 v[23] = pv[19]
 v[24] = pv[20]
 v[25] = pv[21]
 v[26] = pv[22]
 v[27] = pv[23]
 v[28] = pv[24]
 v[29] = pv[25]
 v[30] = pv[26]
 v[31] = pv[27]
 v[32] = pv[1]*pv[3]
 v[33] = pv[2]*pv[3]
 v[34] = pv[1]*pv[4]
 v[35] = pv[2]*pv[4]
 v[36] = pv[1]*pv[5]
 v[37] = pv[2]*pv[5]
 v[38] = pv[1]*pv[6]
 v[39] = pv[2]*pv[6]
 v[40] = pv[1]*pv[7]
 v[41] = pv[2]*pv[7]
 pv[28] = x[1]^7 + x[2]^7 + x[5]^7 + x[3]^7 + x[6]^7 +
x[8]^7 + x[4]^7 + x[7]^7 + x[9]^7 + x[10]^7
 pv[29] = x[1]^6*x[2] + x[1]*x[2]^6 + x[1]^6*x[5] +
x[2]^6*x[5] + x[1]*x[5]^6 + x[2]*x[5]^6 +
x[1]^6*x[3] + x[2]^6*x[3] + x[1]*x[3]^6 +
x[2]*x[3]^6 + x[1]^6*x[6] + x[5]^6*x[6] +
x[3]^6*x[6] + x[1]*x[6]^6 + x[5]*x[6]^6 +
x[3]*x[6]^6 + x[2]^6*x[8] + x[5]^6*x[8] +
x[3]^6*x[8] + x[6]^6*x[8] + x[2]*x[8]^6 +
x[5]*x[8]^6 + x[3]*x[8]^6 + x[6]*x[8]^6 +
x[1]^6*x[4] + x[2]^6*x[4] + x[3]^6*x[4] +
x[1]*x[4]^6 + x[2]*x[4]^6 + x[3]*x[4]^6 +
x[1]^6*x[7] + x[5]^6*x[7] + x[6]^6*x[7] +
x[4]^6*x[7] + x[1]*x[7]^6 + x[5]*x[7]^6 +
x[6]*x[7]^6 + x[4]*x[7]^6 + x[2]^6*x[9] +
x[5]^6*x[9] + x[8]^6*x[9] + x[4]^6*x[9] +
x[7]^6*x[9] + x[2]*x[9]^6 + x[5]*x[9]^6 +
x[8]*x[9]^6 + x[4]*x[9]^6 + x[7]*x[9]^6 +
x[3]^6*x[10] + x[6]^6*x[10] + x[8]^6*x[10] +
x[4]^6*x[10] + x[7]^6*x[10] + x[9]^6*x[10] +
x[3]*x[10]^6 + x[6]*x[10]^6 + x[8]*x[10]^6 +
x[4]*x[10]^6 + x[7]*x[10]^6 + x[9]*x[10]^6
 pv[30] = x[1]^5*x[2]^2 + x[1]^2*x[2]^5 + x[1]^5*x[5]^2  + x[2]^5*x[5]^2 + x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4*x[10] + x[2]*x[3]^4*x[8]*x[10] +
x[5]*x[6]^4*x[8]*x[10] + x[2]*x[3]*x[8]^4*x[10] +
x[5]*x[6]*x[8]^4*x[10] + x[1]*x[3]^4*x[4]*x[10] +
x[2]*x[3]^4*x[4]*x[10] + x[3]^4*x[6]*x[4]*x[10] +
x[3]^4*x[8]*x[4]*x[10] + x[1]*x[3]*x[4]^4*x[10] +
x[2]*x[3]*x[4]^4*x[10] + x[1]*x[6]^4*x[7]*x[10] +
x[5]*x[6]^4*x[7]*x[10] + x[3]*x[6]^4*x[7]*x[10] +
x[6]^4*x[8]*x[7]*x[10] + x[1]*x[4]^4*x[7]*x[10] +
x[3]*x[4]^4*x[7]*x[10] + x[1]*x[6]*x[7]^4*x[10] +
x[5]*x[6]*x[7]^4*x[10] + x[1]*x[4]*x[7]^4*x[10] +
x[6]*x[4]*x[7]^4*x[10] + x[2]*x[8]^4*x[9]*x[10] +
x[5]*x[8]^4*x[9]*x[10] + x[3]*x[8]^4*x[9]*x[10] +
x[6]*x[8]^4*x[9]*x[10] + x[2]*x[4]^4*x[9]*x[10] +
x[3]*x[4]^4*x[9]*x[10] + x[5]*x[7]^4*x[9]*x[10] +
x[6]*x[7]^4*x[9]*x[10] + x[2]*x[8]*x[9]^4*x[10] +
x[5]*x[8]*x[9]^4*x[10] + x[2]*x[4]*x[9]^4*x[10] +
x[8]*x[4]*x[9]^4*x[10] + x[5]*x[7]*x[9]^4*x[10] +
x[8]*x[7]*x[9]^4*x[10] + x[3]*x[6]*x[4]*x[10]^4 +
x[3]*x[8]*x[4]*x[10]^4 + x[3]*x[6]*x[7]*x[10]^4 +
x[6]*x[8]*x[7]*x[10]^4 + x[3]*x[4]*x[7]*x[10]^4 +
x[6]*x[4]*x[7]*x[10]^4 + x[3]*x[8]*x[9]*x[10]^4 +
x[6]*x[8]*x[9]*x[10]^4 + x[3]*x[4]*x[9]*x[10]^4 +
x[8]*x[4]*x[9]*x[10]^4 + x[6]*x[7]*x[9]*x[10]^4 +
x[8]*x[7]*x[9]*x[10]^4
 v[42] = pv[28]
 v[43] = pv[29]
 v[44] = pv[30]
 v[45] = pv[31]
 v[46] = pv[32]
 v[47] = pv[33]
 v[48] = pv[34]
 v[49] = pv[35]
 v[50] = pv[36]
 v[51] = pv[37]
 v[52] = pv[38]
 v[53] = pv[39]
 v[54] = pv[40]

return prim, v, pv

end

max_stars_repo_name: cortner/ManyBodyIPs

max_issues_repo_name: cortner/ManyBodyIPs

max_forks_repo_name: cortner/ManyBodyIPs


text:
export SCS_init, SCS_solve, SCS_finish, SCS_version

# SCS solves a problem of the form
# minimize        c' * x
# subject to      A * x + s = b
#                 s in K
# where K is a product cone of
# zero cones,
# linear cones { x | x >= 0 },
# second-order cones (SOC) { (t,x) | ||x||_2 <= t },
# semi-definite cones (SDC) { X | X psd }, and
# exponential cones {(x,y,z) | y e^(x/y) <= z, y>0 }.
#
#
# Description of input argments:
# A is the matrix with m rows and n cols
# b is of length m x 1
# c is of length n x 1
#
# f (num primal zero / dual free cones, i.e. primal equality constraints)
# l (num linear cones)
# q (array of SOCs sizes)
# s (array of SDCs sizes)
# ep (num primal exponential cones)
# ed (num dual exponential cones).
#
# Returns a Solution object.
function SCS_solve(T::Union{Type{Direct}, Type{Indirect}},
        m::Int, n::Int, A::SCSVecOrMatOrSparse, b::Array{Float64},
        c::Array{Float64}, f::Int, l::Int, q::Array{Int}, s::Array{Int},
        ep::Int, ed::Int, p::Array{Float64},
        primal_sol::Vector{Float64}=Float64[],
        dual_sol::Vector{Float64}=Float64[],
        slack::Vector{Float64}=Float64[];
        options...)

    n > 0 || throw(ArgumentError("The number of variables in SCSModel must be greater than 0"))
    m > 0 || throw(ArgumentError("The number of constraints in SCSModel must be greater than 0"))

    managed_matrix = ManagedSCSMatrix(m, n, A)
    matrix = Ref(SCSMatrix(managed_matrix))
    settings = Ref(SCSSettings(T; options...))
    data = Ref(SCSData(m, n, Base.unsafe_convert(Ptr{SCSMatrix}, matrix), pointer(b), pointer(c), Base.unsafe_convert(Ptr{SCSSettings},settings)))

    cone = Ref(SCSCone(f, l, q, s, ep, ed, p))
    info = Ref(SCSInfo())

    ws = (:warm_start=>true) in options

    if ws && length(primal_sol) == n && length(dual_sol) == m && length(slack) == m
        x = primal_sol
        y = dual_sol
        s = slack
    else
        x = zeros(n)
        y = zeros(m)
        s = zeros(m)
    end
    solution = SCSSolution(pointer(x), pointer(y), pointer(s))

    Base.GC.@preserve managed_matrix matrix settings b c q s p begin
        p_work = SCS_init(T, data, cone, info)
        status = SCS_solve(T, p_work, data, cone, solution, info)
        SCS_finish(T, p_work)
    end

    return Solution(x, y, s, info[], status)

end

# Wrappers for the direct C API.
# Do not call these wrapper methods directly unless you understand the
# use of @gc_preserve in the SCS_solve helper above.

# Take Ref{}s because SCS might modify the structs
for (T, lib) in zip([SCS.Direct, SCS.Indirect], [SCS.direct, SCS.indirect])
    @eval begin

        function SCS_set_default_settings(::Type{$T}, data::Ref{SCSData})
            ccall((:scs_set_default_settings, $lib), Nothing, (Ref{SCSData}, ), data)
        end

        function SCS_init(::Type{$T}, data::Ref{SCSData}, cone::Ref{SCSCone}, info::Ref{SCSInfo})

            p_work = ccall((:scs_init, $lib), Ptr{Nothing},
                (Ptr{SCSData}, Ptr{SCSCone}, Ptr{SCSInfo}),
                data, cone, info)

            return p_work
        end

        # solution struct is simple enough, we know it won't be modified by SCS so take by value
        function SCS_solve(::Type{$T}, p_work::Ptr{Nothing}, data::Ref{SCSData}, cone::Ref{SCSCone}, solution::SCSSolution, info::Ref{SCSInfo})

            status = ccall((:scs_solve, $lib), Int,
                (Ptr{Nothing}, Ptr{SCSData}, Ptr{SCSCone}, Ref{SCSSolution}, Ptr{SCSInfo}),
                p_work, data, cone, solution, info)

            return status
        end

        function SCS_finish(::Type{$T}, p_work::Ptr{Nothing})
            ccall((:scs_finish, $lib), Nothing,
                (Ptr{Nothing}, ),
                p_work)
        end
    end
end

# This one is safe to call
function SCS_version()
    return unsafe_string(ccall((:scs_version, SCS.direct), Cstring, ()))
end

ext: jl


text:
using Documenter:
    DocMeta,
    HTML,
    deploydocs,
    makedocs
using PlutoStaticHTML

"""
    write_homepage()

Write Pluto output to a HTML file.
This avoidings running via the Documenter.jl evaluation machine, which appears to just hang.
"""
function write_homepage()
    dir = joinpath(pkgdir(PlutoStaticHTML), "docs", "src")
    notebook_path = joinpath(dir, "notebook.jl")
    @info "Running notebook at $notebook_path"
    html = notebook2html(notebook_path)
    index_path = joinpath(dir, "index.md")
    md = """
        # PlutoStaticHTML

        ```@raw html
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fonsp/Pluto.jl@0.16.4/frontend/treeview.css" type="text/css" />

        <style>
        div.markdown {
            padding-top: 1rem;
            padding-bottom: 2rem;
        }
        </style>

        $html
        ```
        """
    write(index_path, md)
    return nothing
end

write_homepage()

sitename = "PlutoStaticHTML.jl"
pages = [
    "PlutoStaticHTML" => "index.md"
]
format = HTML(; prettyurls = get(ENV, "CI", nothing) == "true")
modules = [PlutoStaticHTML]
strict = true
checkdocs = :none
makedocs(; sitename, pages, format, modules, strict, checkdocs)

repo = "github.com/rikhuijzer/PlutoStaticHTML.jl.git"
push_preview = false
devbranch = "main"
deploydocs(; devbranch, repo, push_preview)


text:
type HODClient
    url                 ::ASCIIString
    root                ::ASCIIString
    version             ::VersionNumber
    api_default_version ::VersionNumber
    api_key             ::ASCIIString
    proxy               ::Dict
end

abstract HODResponse

for T in (:HODSyncResponse, :HODAsyncResponse)
    @eval type $T <: HODResponse
        response
        client
    end
end

type HODIndex
    documents::Vector{UTF8String}
    client::HODClient
    name::UTF8String

    function HODIndex(client::HODClient, name::UTF8String)
        new(Vector{UTF8String}[], client, name)
    end
end

type HODException <: Exception
    message::ASCIIString
    json_response
    code_code

    function HODException(rjson, code)

        new(message, json_response, error_code)
    end
end

type DocumentException <: Exception end


text:
using Klara

covariates, = dataset("swiss", "measurements")
ndata, npars = size(covariates)

covariates = (covariates.-mean(covariates, 1))./repmat(std(covariates, 1), ndata, 1)

outcome, = dataset("swiss", "status")
outcome = vec(outcome)

function ploglikelihood(p::Vector{Float64}, v::Vector)
  Xp = v[2]*p
  dot(Xp, v[3])-sum(log(1+exp(Xp)))
end

plogprior(p::Vector{Float64}, v::Vector) = -0.5*(dot(p, p)/v[1]+length(p)*log(2*pi*v[1]))

p = BasicContMuvParameter(:p, loglikelihood=ploglikelihood, logprior=plogprior, nkeys=4)

model = likelihood_model([Hyperparameter(:λ), Data(:X), Data(:y), p], isindexed=false)

sampler = RAM(ones(npars))

mcrange = BasicMCRange(nsteps=10000, burnin=1000)

v0 = Dict(:λ=>100, :X=>covariates, :y=>outcome, :p=>[5.1, -0.9, 8.2, -4.5])

job = BasicMCJob(model, sampler, mcrange, v0)

run(job)

chain = output(job)

mean(chain)

acceptance(chain, diagnostics=false)


text:
@doc read(normpath(dirname(@__DIR__), "README.md"), String)
module JET

const CC = Core.Compiler

@static isdefined(CC, :AbstractInterpreter) || throw(ErrorException("JET.jl only works with Julia versions 1.6 and higher"))

# imports
# =======

# `JETInterpreter`
import .CC:
    # abstractinterpreterinterface.jl
    InferenceParams,
    OptimizationParams,
    get_world_counter,
    lock_mi_inference,
    unlock_mi_inference,
    add_remark!,
    may_optimize,
    may_compress,
    may_discard_trees,
    # jetcache.jl
    code_cache,
    # haskey,
    # get,
    # getindex,
    # setindex!,
    get_inference_cache,
    cache_lookup,
    # push!,
    # tfuncs.jl
    builtin_tfunction,
    return_type_tfunc,
    # abstractinterpretation.jl
    abstract_call_gf_by_type,
    abstract_call_method_with_const_args,
    abstract_call_method,
    abstract_eval_special_value,
    abstract_eval_value,
    abstract_eval_statement,
    # typeinfer.jl
    typeinf,
    _typeinf,
    finish,
    # optimize.jl
    OptimizationState,
    optimize

# `ConcreteInterpreter`
import JuliaInterpreter:
    # virtualprocess.jl
    step_expr!,
    evaluate_call_recurse!,
    handle_err

# usings
# ======
# TODO: really use `using` instead

import Core:
    Intrinsics,
    Builtin,
    MethodMatch,
    LineInfoNode,
    NewvarNode,
    SimpleVector,
    svec

import .CC:
    AbstractInterpreter,
    NativeInterpreter,
    InferenceState,
    InferenceResult,
    CodeInfo,
    InternalCodeCache,
    CodeInstance,
    WorldRange,
    WorldView,
    MethodInstance,
    Bottom,
    NOT_FOUND,
    MethodMatchInfo,
    UnionSplitInfo,
    MethodLookupResult,
    Const,
    VarState,
    VarTable,
    SSAValue,
    SlotNumber,
    Slot,
    slot_id,
    GlobalRef,
    GotoIfNot,
    ReturnNode,
    widenconst,
    ⊑,
    CallMeta,
    is_throw_call,
    tmerge,
    argtypes_to_type,
    argtype_by_index,
    argtype_tail,
    _methods_by_ftype,
    specialize_method,
    add_backedge!,
    add_mt_backedge!,
    compute_basic_blocks,
    matching_cache_argtypes,
    is_argtype_match,
    tuple_tfunc

import Base:
    parse_input_line,
    unwrap_unionall,
    rewrap_unionall,
    Fix1,
    Fix2,
    IdSet

import Base.Meta:
    _parse_string,
    lower

using LoweredCodeUtils, JuliaInterpreter

import LoweredCodeUtils:
    istypedef,
    ismethod,
    callee_matches

import JuliaInterpreter:
    bypass_builtins,
    maybe_evaluate_builtin,
    collect_args,
    is_return,
    is_quotenode_egal,
    @lookup

import MacroTools: @capture

using InteractiveUtils

using Pkg.TOML

# common
# ======

const CONFIG_FILE_NAME = ".JET.toml"

# hooks
# -----

const INIT_HOOKS = Function[]
push_inithook!(f) = push!(INIT_HOOKS, f)
__init__() = foreach(@nospecialize(f)->f(), INIT_HOOKS)

# compat
# ------

const BACKEDGE_CALLBACK_ENABLED = :callbacks in fieldnames(Core.MethodInstance)

@static BACKEDGE_CALLBACK_ENABLED || push_inithook!() do
@warn """with your Julia version, JET.jl may not be able to update analysis result
correctly after refinement of a method in deeper call sites
"""
end

@static if isdefined(CC, :LimitedAccuracy)
    import .CC: ignorelimited
else
    ignorelimited(@nospecialize(x)) = x
end

# macros
# ------

# to circumvent https://github.com/JuliaLang/julia/issues/37342, we inline these `isa`
# condition checks at surface AST level
macro isexpr(ex, args...)
    ex   = esc(ex)
    args = map(esc, args)
    return :($(GlobalRef(Core, :isa))($(ex), $(GlobalRef(Core, :Expr))) && $(_isexpr_check)($(ex), $(args...)))
end

_isexpr_check(ex::Expr, head::Symbol)         = ex.head === head
_isexpr_check(ex::Expr, heads)                = in(ex.head, heads)
_isexpr_check(ex::Expr, head::Symbol, n::Int) = ex.head === head && length(ex.args) == n
_isexpr_check(ex::Expr, heads, n::Int)        = in(ex.head, heads) && length(ex.args) == n

"""
    @invoke f(arg::T, ...; kwargs...)

Provides a convenient way to call [`invoke`](https://docs.julialang.org/en/v1/base/base/#Core.invoke);
`@invoke f(arg1::T1, arg2::T2; kwargs...)` will be expanded into `invoke(f, Tuple{T1,T2}, arg1, arg2; kwargs...)`.
When an argument's type annotation is omitted, it's specified as `Any` argument, e.g.
`@invoke f(arg1::T, arg2)` will be expanded into `invoke(f, Tuple{T,Any}, arg1, arg2)`.

This could be used to call down to `NativeInterpreter`'s abstract interpretation method of
  `f` while passing `JETInterpreter` so that subsequent calls of abstract interpretation
  functions overloaded against `JETInterpreter` can be called from the native method of `f`;
e.g. calls down to `NativeInterpreter`'s `abstract_call_gf_by_type` method:
```julia
@invoke abstract_call_gf_by_type(interp::AbstractInterpreter, f, argtypes::Vector{Any}, atype, sv::InferenceState,
                                 max_methods::Int)
```
"""
macro invoke(ex)
    f, args, kwargs = destructure_callex(ex)
    arg2typs = map(args) do x
        if @isexpr(x, :macrocall) && first(x.args) === Symbol("@nospecialize")
            x = last(x.args)
        end
        @isexpr(x, :(::)) ? (x.args...,) : (x, GlobalRef(Core, :Any))
    end
    args, argtypes = first.(arg2typs), last.(arg2typs)
    return esc(:($(GlobalRef(Core, :invoke))($(f), Tuple{$(argtypes...)}, $(args...); $(kwargs...))))
end

"""
    @invokelatest f(args...; kwargs...)

Provides a convenient way to call [`Base.invokelatest`](https://docs.julialang.org/en/v1/base/base/#Base.invokelatest).
`@invokelatest f(args...; kwargs...)` will simply be expanded into
`Base.invokelatest(f, args...; kwargs...)`.
"""
macro invokelatest(ex)
    f, args, kwargs = destructure_callex(ex)
    return esc(:($(GlobalRef(Base, :invokelatest))($(f), $(args...); $(kwargs...))))
end

function destructure_callex(ex)
    @assert @isexpr(ex, :call) "call expression f(args...; kwargs...) should be given"

    f = first(ex.args)
    args = []
    kwargs = []
    for x in ex.args[2:end]
        if @isexpr(x, :parameters)
            append!(kwargs, x.args)
        elseif @isexpr(x, :kw)
            push!(kwargs, x)
        else
            push!(args, x)
        end
    end

    return f, args, kwargs
end

"""
    @withmixedhash (mutable) struct T
        fields ...
    end

Defines struct `T` while automatically defining its `Base.hash(::T, ::UInt)` method which
  mixes hashes of all of `T`'s fields (and also corresponding `Base.:(==)(::T, ::T)` method).

This macro is supposed to abstract the following kind of pattern:

> https://github.com/aviatesk/julia/blob/999973df2850d6b2e0bd4bcf03ef90a14217b63c/base/pkgid.jl#L3-L25
```julia
struct PkgId
    uuid::Union{UUID,Nothing}
    name::String
end

==(a::PkgId, b::PkgId) = a.uuid == b.uuid && a.name == b.name

function hash(pkg::PkgId, h::UInt)
    h += 0xc9f248583a0ca36c % UInt
    h = hash(pkg.uuid, h)
    h = hash(pkg.name, h)
    return h
end
```

> with `@withmixedhash`
```julia
@withmixedhash struct PkgId
    uuid::Union{UUID,Nothing}
    name::String
end
```

See also: [`EGAL_TYPES`](@ref)
"""
macro withmixedhash(typedef)
    @assert @isexpr(typedef, :struct) "struct definition should be given"
    name = typedef.args[2]
    flddef = typedef.args[3]
    fld2typs = map(filter(!islnn, typedef.args[3].args)) do x
        if @isexpr(x, :(::))
            fld, typex = x.args
            typ = Core.eval(__module__, typex)
            fld, typ
        else
            (x, Any)
        end
    end
    @assert !isempty(fld2typs) "no fields given, nothing to hash"

    h_init = UInt === UInt64 ? rand(UInt64) : rand(UInt32)
    hash_body = quote h = $(h_init) end
    for (fld, typ) in fld2typs
        push!(hash_body.args, :(h = $(Base.hash)(x.$fld, h)))
    end
    push!(hash_body.args, :(return h))
    hash_func = :(function Base.hash(x::$name, h::UInt); $(hash_body); end)
    eq_body = foldr(fld2typs; init = true) do (fld, typ), x
        eq_ex = if all(in(EGAL_TYPES), typenames(typ))
            :(x1.$fld === x2.$fld)
        else
            :(x1.$fld == x2.$fld)
        end
        Expr(:&&, eq_ex, x)
    end
    eq_func = :(function Base.:(==)(x1::$name, x2::$name); $(eq_body); end)

    return quote
        $(typedef)
        $(hash_func)
        $(eq_func)
    end
end

islnn(@nospecialize(_)) = false
islnn(::LineNumberNode) = true

"""
    const EGAL_TYPES = $(EGAL_TYPES)

Keeps names of types that should be compared by `===` rather than `==`.

See also: [`@withmixedhash`](@ref)
"""
const EGAL_TYPES = Set{Symbol}((:Type, :Symbol, :MethodInstance))

typenames(@nospecialize(t::DataType)) = [t.name.name]
typenames(u::Union)                   = collect(Base.Iterators.flatten(typenames.(CC.uniontypes(u))))
typenames(u::UnionAll)                = [u.body.name.name]

"""
    @jetconfigurable function config_func(args...; configurations...)
        ...
    end

This macro asserts that there's no configuration naming conflict across the `@jetconfigurable`
  functions so that a configuration for a `@jetconfigurable` function  doesn't affect the other
  `@jetconfigurable` functions.
This macro also adds a dummy splat keyword arguments (`jetconfigs...`) to the function definition
  so that any configuration of other `@jetconfigurable` functions can be passed on to it.
"""
macro jetconfigurable(funcdef)
    @assert @isexpr(funcdef, :(=)) || @isexpr(funcdef, :function) "function definition should be given"

    defsig = funcdef.args[1]
    args = defsig.args::Vector{Any}
    thisname = first(args)
    i = findfirst(a->@isexpr(a, :parameters), args)
    if isnothing(i)
        @warn "no JET configurations are defined for `$thisname`"
        insert!(args, 2, Expr(:parameters, :(jetconfigs...)))
    else
        kwargs = args[i]
        found = false
        for kwarg in kwargs.args
            if @isexpr(kwarg, :...)
                found = true
                continue
            end
            kwargex = first(kwarg.args)
            kwargname = (@isexpr(kwargex, :(::)) ? first(kwargex.args) : kwargex)::Symbol
            othername = get!(_JET_CONFIGURATIONS, kwargname, thisname)
            # allows same configurations for same generic function or function refinement
            @assert thisname === othername "`$thisname` uses `$kwargname` JET configuration name which is already used by `$othername`"
        end
        found || push!(kwargs.args, :(jetconfigs...))
    end

    return esc(funcdef)
end
const _JET_CONFIGURATIONS = Dict{Symbol,Symbol}()

# utils
# -----

function is_constant_propagated(frame::InferenceState)
    return !frame.cached && CC.any(frame.result.overridden_by_const)
end

prewalk_inf_frame(@nospecialize(f), ::Nothing) = return
function prewalk_inf_frame(@nospecialize(f), frame::InferenceState)
    ret = f(frame)
    prewalk_inf_frame(f, frame.parent)
    return ret
end

postwalk_inf_frame(@nospecialize(f), ::Nothing) = return
function postwalk_inf_frame(@nospecialize(f), frame::InferenceState)
    postwalk_inf_frame(f, frame.parent)
    return f(frame)
end

# NOTE: these methods are supposed to be called while abstract interpretaion
# and as such aren't valid after finishing it (i.e. optimization, etc.)
@inline get_currpc(frame::InferenceState)                          = min(frame.currpc, length(frame.src.code))
@inline get_stmt(frame::InferenceState, pc = get_currpc(frame))    = @inbounds frame.src.code[pc]
@inline get_states(frame::InferenceState, pc = get_currpc(frame))  = @inbounds frame.stmt_types[pc]::VarTable
@inline get_codeloc(frame::InferenceState, pc = get_currpc(frame)) = @inbounds frame.src.codelocs[pc]
@inline get_lin(frame::InferenceState, loc = get_codeloc(frame))   = @inbounds (frame.src.linetable::Vector)[loc]::LineInfoNode

@inline get_slotname(frame::InferenceState, slot::Int)             = @inbounds frame.src.slotnames[slot]
@inline get_slotname(frame::InferenceState, slot::Slot)            = get_slotname(frame, slot_id(slot))
@inline get_slottype(frame::InferenceState, slot::Int)             = @inbounds (get_states(frame)[slot]::VarState).typ
@inline get_slottype(frame::InferenceState, slot::Slot)            = get_slottype(frame, slot_id(slot))

@inline get_result(frame::InferenceState)                          = frame.bestguess

ignorenotfound(@nospecialize(t)) = t === NOT_FOUND ? Bottom : t

# includes
# ========

include("reports.jl")
include("abstractinterpreterinterface.jl")
include("jetcache.jl")
include("tfuncs.jl")
include("abstractinterpretation.jl")
include("typeinfer.jl")
include("optimize.jl")
include("virtualprocess.jl")
include("watch.jl")
include("print.jl")

# entry
# =====

"""
    res::ReportResult

- `res.included_files::Set{String}`: files analyzed by JET
- `res.any_reported::Bool`: indicates if there was any error point reported
"""
const ReportResult = @NamedTuple begin
    included_files::Set{String}
    any_reported::Bool
end

function report_result(io::IO, res::VirtualProcessResult; jetconfigs...)
    print_result = print_reports(io, res; jetconfigs...)
    return (; included_files = res.included_files,
              any_reported   = print_result)::ReportResult
end

"""
    report_file([io::IO = stdout],
                filename::AbstractString,
                mod::Module = Main;
                toplevel_logger::Union{Nothing,IO} = IOContext(io, $(repr(LOGGER_LEVEL_KEY)) => $INFO_LOGGER_LEVEL),
                jetconfigs...) -> res::ReportResult

Analyzes `filename`, prints the collected error reports to the `io` stream, and finally returns $(@doc ReportResult)

The following optional positional arguments can be specified:
- `mod::Module`: the module context in which the top-level execution will be simulated

This function will look for `$CONFIG_FILE_NAME` configuration file in the directory of `filename`,
  and search _up_ the file tree until any `$CONFIG_FILE_NAME` is (or isn't) found.
When found, the configurations specified in the file will overwrite the given `jetconfigs`.
See [Configuration File](@ref) for more details.

!!! tip
    When you want to analyze your package, but any file using it isn't available, the
      `analyze_from_definitions` option can be useful (see [`ToplevelConfig`](@ref)'s `analyze_from_definitions` option). \\
    For example, JET can analyze JET itself like below:
    ```julia
    # from the root directory of JET.jl
    julia> report_file("src/JET";
                       analyze_from_definitions = true)
    ```

!!! note
    This function will enable the toplevel logger by default with the default logging level
    (see [Logging Configurations](@ref) for more details).
"""
function report_file(io::IO,
                     filename::AbstractString,
                     mod::Module = Main;
                     # enable top-level info logger by default for entry from file
                     toplevel_logger::Union{Nothing,IO} = IOContext(io, LOGGER_LEVEL_KEY => INFO_LOGGER_LEVEL),
                     jetconfigs...)
    res = analyze_file(filename, mod; toplevel_logger, jetconfigs...)
    return report_result(io, res; jetconfigs...)
end
report_file(args...; jetconfigs...) = report_file(stdout::IO, args...; jetconfigs...)

function analyze_file(filename, args...; jetconfigs...)
    configfile = find_config_file(dirname(abspath(filename)))
    if !isnothing(configfile)
        config = parse_config(configfile)
        jetconfigs = overwrite_options(jetconfigs, config)
        with_logger(get(jetconfigs, :toplevel_logger, nothing), ≥(INFO_LOGGER_LEVEL), "toplevel") do io
            println(io, "applied JET configurations in $configfile")
        end
    end

    text = read(filename, String)
    return analyze_text(text, filename, args...; jetconfigs...)
end

function find_config_file(dir)
    next_dir = dirname(dir)
    if (next_dir == dir || # ensure to escape infinite recursion
        isempty(dir))      # reached to the system root
        return nothing
    end
    path = normpath(dir, CONFIG_FILE_NAME)
    return isfile(path) ? path : find_config_file(next_dir)
end

"""
JET.jl offers [`.prettierrc` style](https://prettier.io/docs/en/configuration.html)
  configuration file support.
This means you can use `$CONFIG_FILE_NAME` configuration file to specify any of configurations
  explained above and share that with others.

When [`$report_file`](@ref) or [`$report_and_watch_file`](@ref) is called, it will look for
  `$CONFIG_FILE_NAME` in the directory of the given file, and search _up_ the file tree until
  a JET configuration file is (or isn't) found.
When found, the configurations specified in the file will be applied.

A configuration file can specify any of JET configurations like:
```
aggressive_constant_propagation = false # turn off aggressive constant propagation
... # other configurations
```

Note that the following configurations should be string(s) of valid Julia code:
- `concretization_patterns`: vector of string of Julia code, which can be `parse`d into a
  Julia expression pattern expected by [`MacroTools.@capture` macro](https://fluxml.ai/MacroTools.jl/stable/pattern-matching/).
- `toplevel_logger`: string of Julia code, which can be `parse`d and `eval`uated into `Union{IO,Nothing}`
- `inference_logger`: string of Julia code, which can be `parse`d and `eval`uated into `Union{IO,Nothing}`

E.g. the configurations below are equivalent:
- configurations via keyword arguments
  ```julia
  report_file(somefile;
              concretization_patterns = [:(GLOBAL_CODE_STORE = x_)],
              toplevel_logger = IOContext(open("toplevel.txt", "w"), :JET_LOGGER_LEVEL => 1))
  ```
- configurations via a configuration file
  $(let
      text = read(normpath(@__DIR__, "..", "test", "fixtures", "..JET.toml"), String)
      lines = split(text, '\n')
      pushfirst!(lines, "```toml"); push!(lines, "```")
      join(lines, "\n  ")
  end)
"""
function parse_config(tomlfile)
    config_dict = TOML.parsefile(tomlfile)
    concretization_patterns = get(config_dict, "concretization_patterns", nothing)
    if !isnothing(concretization_patterns)
        @assert isa(concretization_patterns, Vector{String}) "`concretization_patterns` should be array of string of Julia expression"
        config_dict["concretization_patterns"] = Meta.parse.(concretization_patterns)
    end
    toplevel_logger = get(config_dict, "toplevel_logger", nothing)
    if !isnothing(toplevel_logger)
        @assert isa(toplevel_logger, String) "`toplevel_logger` should be string of Julia code"
        config_dict["toplevel_logger"] = Core.eval(@__MODULE__, Meta.parse(toplevel_logger))
    end
    inference_logger = get(config_dict, "inference_logger", nothing)
    if !isnothing(inference_logger)
        @assert isa(inference_logger, String) "`inference_logger` should be string of Julia code"
        config_dict["inference_logger"] = Core.eval(@__MODULE__, Meta.parse(inference_logger))
    end
    return kwargs(config_dict)
end

function kwargs(dict)
    ns = (Symbol.(keys(dict))...,)
    vs = (collect(values(dict))...,)
    return pairs(NamedTuple{ns}(vs))
end

overwrite_options(old, new) = kwargs(merge(old, new))

"""
    report_text([io::IO = stdout],
                text::AbstractString,
                filename::AbstractString = "top-level",
                mod::Module = Main;
                jetconfigs...) -> res::ReportResult

Analyzes `text`, prints the collected error reports to the `io` stream, and finally returns $(@doc ReportResult)

The following optional positional arguments can be specified:
- `filename`: the file containing `text` (if exists)
- `mod::Module`: the module context in which the top-level execution will be simulated
"""
function report_text(io::IO,
                     text::AbstractString,
                     filename::AbstractString = "top-level",
                     mod::Module = Main;
                     jetconfigs...)
    res = analyze_text(text, filename, mod; jetconfigs...)
    return report_result(io, res; jetconfigs...)
end
report_text(args...; jetconfigs...) = report_text(stdout::IO, args...; jetconfigs...)

function analyze_text(text::AbstractString,
                      filename::AbstractString = "top-level",
                      actualmod::Module = Main,
                      virtualmod::Module = gen_virtual_module(actualmod);
                      jetconfigs...)
    interp = JETInterpreter(; jetconfigs...)
    config = ToplevelConfig(; jetconfigs...)
    return virtual_process(text,
                           filename,
                           actualmod,
                           interp,
                           config,
                           virtualmod,
                           )
end

function analyze_toplevel!(interp::JETInterpreter, src::CodeInfo)
    # construct toplevel `MethodInstance`
    mi = ccall(:jl_new_method_instance_uninit, Ref{Core.MethodInstance}, ());
    mi.uninferred = src
    mi.specTypes = Tuple{}

    transform_abstract_global_symbols!(interp, src)
    mi.def = interp.toplevelmod

    result = InferenceResult(mi);
    # toplevel frame doesn't need to be cached (and so it won't be optimized)
    frame = InferenceState(result, src, #=cached=# false, interp)::InferenceState;

    return analyze_frame!(interp, frame)
end

# HACK this is an native hack to re-use `AbstractInterpreter`'s approximated slot types for
# assignments of abstract global variables, which are represented as toplevel symbols at this point;
# the idea is just to transform them into slots from symbols and use their approximated type
# on their assignment.
# NOTE that `transform_abstract_global_symbols!` will produce really invalid code for
# actual interpretation or execution, but all the statements won't be interpreted anymore
# by `ConcreteInterpreter` nor executed anyway since toplevel frames aren't cached
function transform_abstract_global_symbols!(interp::JETInterpreter, src::CodeInfo)
    nslots = length(src.slotnames)
    abstrct_global_variables = Dict{Symbol,Int}()
    concretized = interp.concretized

    # linear scan, and find assignments of abstract global variables
    for (i, stmt) in enumerate(src.code::Vector{Any})
        if !(concretized[i])
            if @isexpr(stmt, :(=))
                lhs = first(stmt.args)
                if isa(lhs, Symbol)
                    if !haskey(abstrct_global_variables, lhs)
                        nslots += 1
                        push!(abstrct_global_variables, lhs => nslots)
                    end
                end
            end
        end
    end

    function _transform_abstract_global_symbols!(x, scope)
        if isa(x, Symbol)
            slot = get(abstrct_global_variables, x, nothing)
            if !isnothing(slot)
                return SlotNumber(slot)
            end
        elseif isa(x, GotoIfNot)
            newcond = _transform_abstract_global_symbols!(x.cond, scope)
            return GotoIfNot(newcond, x.dest)
        end

        return x
    end
    prewalk_and_transform!(_transform_abstract_global_symbols!, src)

    resize!(src.slotnames, nslots)
    resize!(src.slotflags, nslots)
    for (slotname, idx) in abstrct_global_variables
        src.slotnames[idx] = slotname
    end

    interp.global_slots = Dict(idx => slotname for (slotname, idx) in abstrct_global_variables)
end

# TODO `analyze_call_builtin!` ?
function analyze_gf_by_type!(interp::JETInterpreter, @nospecialize(tt::Type{<:Tuple}))
    mm = get_single_method_match(tt, InferenceParams(interp).MAX_METHODS, get_world_counter(interp))
    return analyze_method_signature!(interp, mm.method, mm.spec_types, mm.sparams)
end

function get_single_method_match(@nospecialize(tt), lim, world)
    mms = _methods_by_ftype(tt, lim, world)
    @assert !isa(mms, Bool) "unable to find matching method for $(tt)"

    filter!(mm::MethodMatch->mm.spec_types===tt, mms)
    @assert length(mms) == 1 "unable to find single target method for $(tt)"

    return first(mms)::MethodMatch
end

analyze_method!(interp::JETInterpreter, m::Method) =
    analyze_method_signature!(interp, m, m.sig, method_sparams(m))

function method_sparams(m::Method)
    s = TypeVar[]
    sig = m.sig
    while isa(sig, UnionAll)
        push!(s, sig.var)
        sig = sig.body
    end
    return svec(s...)
end

function analyze_method_signature!(interp::JETInterpreter,
                                   m::Method,
                                   @nospecialize(atype),
                                   sparams::SimpleVector,
                                   )
    mi = specialize_method(m, atype, sparams)

    result = InferenceResult(mi)

    frame = InferenceState(result, #=cached=# true, interp)::InferenceState

    return analyze_frame!(interp, frame)
end

function analyze_frame!(interp::JETInterpreter, frame::InferenceState)
    typeinf(interp, frame)

    # report `throw` calls "appropriately";
    # if the final return type here is `Bottom`-annotated, it _may_ mean the control flow
    # didn't catch some of the `UncaughtExceptionReport`s stashed within `interp.uncaught_exceptions`,
    if get_result(frame) === Bottom
        if !isempty(interp.uncaught_exceptions)
            append!(interp.reports, interp.uncaught_exceptions)
        end
    end

    return interp, frame
end

# test, interactive
# =================

"""
    @analyze_call [jetconfigs...] f(args...)

Evaluates the arguments to the function call, determines its types, and then calls
  [`analyze_call`](@ref) on the resulting expression.
As with `@code_typed` and its family, any of [JET configurations](@ref) can be given as the optional
  arguments like this:
```julia
# analyzes `rand(::Type{Bool})` with `aggressive_constant_propagation` configuration turned off
julia> @analyze_call aggressive_constant_propagation=false rand(Bool)
```
"""
macro analyze_call(ex0...)
    return InteractiveUtils.gen_call_with_extracted_types_and_kwargs(__module__, :analyze_call, ex0)
end

"""
    analyze_call(f, types = Tuple{}; jetconfigs...) -> (interp::JETInterpreter, frame::InferenceFrame)

Analyzes the generic function call with the given type signature, and returns:
- `interp::JETInterpreter`, which contains analyzed error reports and such
- `frame::InferenceFrame`, which is the final state of the abstract interpretation
"""
function analyze_call(@nospecialize(f), @nospecialize(types = Tuple{}); jetconfigs...)
    ft = Core.Typeof(f)
    if isa(types, Type)
        u = unwrap_unionall(types)
        tt = rewrap_unionall(Tuple{ft, u.parameters...}, types)
    else
        tt = Tuple{ft, types...}
    end

    interp = JETInterpreter(; jetconfigs...)
    return analyze_gf_by_type!(interp, tt)
end

"""
    @report_call [jetconfigs...] f(args...)

Evaluates the arguments to the function call, determines its types, and then calls
  [`report_call`](@ref) on the resulting expression.
As with `@code_typed` and its family, any of [JET configurations](@ref) can be given as the optional
  arguments like this:
```julia
# reports `rand(::Type{Bool})` with `aggressive_constant_propagation` configuration turned off
julia> @report_call aggressive_constant_propagation=false rand(Bool)
```
"""
macro report_call(ex0...)
    return InteractiveUtils.gen_call_with_extracted_types_and_kwargs(__module__, :report_call, ex0)
end

"""
    report_call(f, types = Tuple{}; jetconfigs...) -> result_type::Any

Analyzes the generic function call with the given type signature, and then prints collected
  error points to `stdout`, and finally returns the result type of the call.
"""
function report_call(@nospecialize(f), @nospecialize(types = Tuple{}); jetconfigs...)
    interp, frame = analyze_call(f, types; jetconfigs...)
    print_reports(interp.reports; jetconfigs...)
    return get_result(frame)
end

# for inspection
macro lwr(ex) QuoteNode(lower(__module__, ex)) end
macro src(ex) QuoteNode(first(lower(__module__, ex).args)) end

# exports
# =======

export
    report_file,
    report_and_watch_file,
    report_text,
    @analyze_call,
    analyze_call,
    @report_call,
    report_call

end


text:
include("algorithms/matching.jl")

@enum State begin
    used = 1
    unused = 2
    removed = 3
    vital = 4
end

"""
    AllDifferent(x::Array{<:AbstractIntVar}, trailer)

AllDifferent constraint, enforcing ∀ i ≠ j ∈ ⟦1, length(x)⟧, x[i] ≠ x[j].

The implementation of this contraint is inspired by:
 https://www.researchgate.net/publication/200034395_A_Filtering_Algorithm_for_Constraints_of_Difference_in_CSPs
Many of the functions below relate to algorithms depicted in the paper, and their
documentation refer to parts of the overall algorithm.
"""
struct AllDifferent <: Constraint
    x::Array{<:AbstractIntVar}
    active::StateObject{Bool}
    initialized::StateObject{Bool}
    matching::Vector{StateObject{Pair{Int, Int}}}
    edgesState::Dict{Edge{Int}, StateObject{State}}
    nodesMin::Int
    numberOfVars::Int
    numberOfVals::Int

    function AllDifferent(x::Array{<:AbstractIntVar}, trailer)::AllDifferent
        max = Base.maximum(var -> maximum(var.domain), x)
        min = Base.minimum(var -> minimum(var.domain), x)
        range = max - min + 1
        active = StateObject{Bool}(true, trailer)
        initialized = StateObject{Bool}(false, trailer)
        numberOfVars = length(x)
        matching = Vector{StateObject{Pair{Int, Int}}}(undef, numberOfVars)
        for i = 1:numberOfVars
            matching[i] = StateObject{Pair{Int, Int}}(Pair(0, 0), trailer)
        end
        edgesState = Dict{Edge{Int}, StateObject{State}}()
        constraint = new(x,
            active,
            initialized,
            matching,
            edgesState,
            min,
            numberOfVars,
            range)
        for (idx, var) in enumerate(x)
            addOnDomainChange!(var, constraint)
            for val in var.domain
                dst = numberOfVars + val - min + 1
                constraint.edgesState[Edge(idx, dst)] = StateObject(unused, trailer)
            end
        end
        return constraint
    end
end

"""
    valToNode(constraint, value)::Int

Return the node index of a value.
"""
function valToNode(con::AllDifferent, val::Int)
    return con.numberOfVars + val - con.nodesMin + 1
end

"""
    nodeToVal(constraint, node)::Int

Return the underlying value of a node.
"""
function nodeToVal(con::AllDifferent, node::Int)
    return node - con.numberOfVars + con.nodesMin - 1
end

"""
    orderEdge(edge)::Edge

Return the ordered version of an edge, i.e. with e.src ≤ e.dst.
"""
function orderEdge(e::Edge{Int})::Edge{Int}
    src, dst = e.src < e.dst ? (e.src, e.dst) : (e.dst, e.src)
    return Edge(src, dst)
end

"""
    initializeGraphs!(constraint)

Return the graph and the empty direct graph of a variable-value problem.
"""
function initializeGraphs!(con::AllDifferent)::Pair{Graph{Int}, DiGraph{Int}}
    graph = Graph(con.numberOfVars + con.numberOfVals)
    digraph = DiGraph(nv(graph))
    for (e, status) in con.edgesState
        if status.value != removed
            add_edge!(graph, e.src, e.dst)
        end
    end
    return Pair(graph, digraph)
end

"""
    getAllEdges(digraph, parents)::Set{Edge}

Return all the edges visited by a BFS on `digraph` encoded in `parents`.
"""
function getAllEdges(digraph::DiGraph{Int}, parents::Vector{Int})::Set{Edge{Int}}
    edgeSet = Set{Edge{Int}}()
    for i = 1:nv(digraph)
        if parents[i] > 0 && parents[i] != i
            validneighbors = filter(v -> parents[v] > 0, inneighbors(digraph, i))
            validedges = map(v -> orderEdge(Edge(v, i)), validneighbors)
            union!(edgeSet, validedges)
        end
    end
    return edgeSet
end

"""
    getAllEdges(digraph, vars, vals)

Return all the edges in a strongly connected component vars ∪ vars.
"""
function getAllEdges(digraph::DiGraph{Int}, vars::Vector{Int}, vals::Vector{Int})::Set{Edge{Int}}
    edgeSet = Set{Edge{Int}}()
    for var in vars
        for val in intersect(union(inneighbors(digraph, var), outneighbors(digraph, var)), vals)
            push!(edgeSet, orderEdge(Edge(var, val)))
        end
    end
    return edgeSet
end

"""
    removeEdges!(constraint, prunedValue, graph, digraph)

Remove all the unnecessary edges in graph and digraph as in the original paper.

Update `constraint.edgesState` with the new status of each edge, remove some
edges from `graph` and `digraph` and push the removed values in `prunedValue`.
Following exactly the procedure in the function with the same name in the original
paper.
"""
function removeEdges!(constraint::AllDifferent, prunedValues::Vector{Vector{Int}}, graph::Graph{Int}, digraph::DiGraph{Int})
    for e in edges(graph)
        if constraint.edgesState[orderEdge(e)] != removed
            setValue!(constraint.edgesState[orderEdge(e)], unused)
        end
    end

    allValues = constraint.numberOfVars+1:nv(digraph)
    freeValues = filter(v -> indegree(digraph,v) == 0, allValues)

    seen = fill(false, constraint.numberOfVals)
    components = filter(comp -> length(comp)>1, strongly_connected_components(digraph))
    for component in components
        variables = filter(v -> v <= constraint.numberOfVars, component)
        values = filter(v -> v > constraint.numberOfVars, component)
        edgeSet = getAllEdges(digraph, variables, values)
        for e in edgeSet
            setValue!(constraint.edgesState[e], used)
        end
    end
    for node in freeValues
        if seen[node - constraint.numberOfVars]
            continue
        end
        parents = bfs_parents(digraph, node; dir=:out)
        edgeSet = getAllEdges(digraph, parents)
        for e in edgeSet
            setValue!(constraint.edgesState[e], used)
        end
        reached = filter(v -> parents[v] > 0, allValues)
        for val in reached
            seen[val - constraint.numberOfVars] = true
        end
    end

    for pair in constraint.matching
        var, val = pair.value
        e = Edge(var, val)
        if constraint.edgesState[e].value == unused
            setValue!(constraint.edgesState[e], vital)
        end
    end

    rest = findall(state -> state.value == unused, constraint.edgesState)
    for e in rest
        rem_edge!(graph, e)
        rem_edge!(digraph, Edge(e.dst, e.src))
        setValue!(constraint.edgesState[e], removed)
        var, val = e.src < e.dst ? (e.src, e.dst) : (e.dst, e.src)
        push!(prunedValues[var], nodeToVal(constraint, val))
    end
end

"""
    updateEdgesState!(constraint)::Set{Edge}

Return all the pruned values not already encoded in the constraint state.
"""
function updateEdgesState!(constraint::AllDifferent)
    modif = Set{Edge}()
    for (edge, state) in constraint.edgesState
        if state.value != removed && !(nodeToVal(constraint, edge.dst)  in constraint.x[edge.src].domain)
            push!(modif, edge)
        end
    end
    return modif
end

"""
    propagate!(constraint::AllDifferent, toPropagate::Set{Constraint}, prunedDomains::CPModification)

`AllDifferent` propagation function. Implement the full procedure of the paper.
"""
function propagate!(constraint::AllDifferent, toPropagate::Set{Constraint}, prunedDomains::CPModification)
    if !constraint.active.value
        return true
    end

    # Variables Initialization
    graph, digraph = initializeGraphs!(constraint)
    #    Run only once, when constraint is first propagated
    if !constraint.initialized.value
        matching = maximumMatching!(graph, digraph, constraint.numberOfVars)
        if matching.size < constraint.numberOfVars
            return false
        end
        for (idx, match) in enumerate(matching.matches)
            setValue!(constraint.matching[idx], match)
        end
        setValue!(constraint.initialized, true)
    #    Otherwise just read the stored values
    else
        matching = Matching{Int}(length(constraint.matching), map(pair -> pair.value, constraint.matching))
        buildDigraph!(digraph, graph, matching)
    end

    modifications = updateEdgesState!(constraint)
    prunedValues = Vector{Vector{Int}}(undef, constraint.numberOfVars)
    for i = 1:constraint.numberOfVars
        prunedValues[i] = Int[]
    end

    removeEdges!(constraint, prunedValues, graph, digraph)
    needrematching = false
    for e in modifications
        rev_e = Edge(e.dst, e.src)
        if e in edges(graph)
            if constraint.edgesState[e].value == vital
                return false
            elseif e in edges(digraph)
                needrematching = true
                rem_edge!(digraph, e)
            else
                rem_edge!(digraph, rev_e)
            end
            rem_edge!(graph, e)
            setValue!(constraint.edgesState[e], removed)
        end
    end

    if needrematching
        matching = maximizeMatching!(digraph, constraint.numberOfVars)
        if matching.size < constraint.numberOfVars
            return false
        end
        for (idx, match) in enumerate(matching.matches)
            setValue!(constraint.matching[idx], match)
        end
    end
    removeEdges!(constraint, prunedValues, graph, digraph)

    for (prunedVar, var) in zip(prunedValues, constraint.x)
        if !isempty(prunedVar)
            for val in prunedVar
                remove!(var.domain, val)
            end
            triggerDomainChange!(toPropagate, var)
            addToPrunedDomains!(prunedDomains, var, prunedVar)
        end
    end

    if constraint in toPropagate
        pop!(toPropagate, constraint)
    end

    if all(var -> length(var.domain) <= 1, constraint.x)
        setValue!(constraint.active, false)
    end

    for var in constraint.x
        if isempty(var.domain)
            return false
        end
    end
    return true
end

variablesArray(constraint::AllDifferent) = constraint.x

function Base.show(io::IO, ::MIME"text/plain", con::AllDifferent)
    print(io, string(typeof(con)), ": ", join([var.id for var in con.x], " != "), ", active = ", con.active)
    for var in con.x
        print(io, "\n   ", var)
    end
end

function Base.show(io::IO, con::AllDifferent)
    print(io, string(typeof(con)), ": ", join([var.id for var in con.x], " != "))
end


text:
module Killbox

using ..Ahorn, Maple

const placements = Ahorn.PlacementDict(
    "Killbox" => Ahorn.EntityPlacement(
        Maple.Killbox,
        "rectangle"
    ),
)

Ahorn.minimumSize(entity::Maple.Killbox) = 8, 0
Ahorn.resizable(entity::Maple.Killbox) = true, false

function Ahorn.selection(entity::Maple.Killbox)
    x, y = Ahorn.position(entity)

    width = Int(get(entity.data, "width", 8))
    height = 32

    return Ahorn.Rectangle(x, y, width, height)
end

function Ahorn.render(ctx::Ahorn.Cairo.CairoContext, entity::Maple.Killbox, room::Maple.Room)
    width = Int(get(entity.data, "width", 32))
    height = 32

    Ahorn.drawRectangle(ctx, 0, 0, width, height, (0.8, 0.4, 0.4, 0.8), (0.0, 0.0, 0.0, 0.0))
end

end


text:
function polyMap(Θ,z)
  g = 0.
  for i in 1:1:length(Θ)
    g += Θ[i]⋅z^(i-1)
  end
  return g
end

function cfy(yi, yp, yn, theta)
  return ( (yi - polyMap(theta, yp)) ^ 2 + (yn - polyMap(theta, yi)) ^ 2)
end

function noiseMix3(p1::Float64, lam1::Float64, lam2::Float64)
  if rand() < p1
    z = rand(Normal(0, sqrt(1 / lam1)))
  else
    z = rand(Normal(0, sqrt(1 / lam2)))
  end
  return z
end

function genData(npar, n, Θ, x₀, p1, lam1, lam2, seed)
  srand(seed)
  x = zeros(n)

  if npar .== 0
    x[1] = polyMap(Θ,x₀) + rand(Normal(0, sqrt(1 / lam1)))
    for i in 2:1:n
      x[i] = polyMap(Θ,x[i-1]) + rand(Normal(0, sqrt(1 / lam1)))
    end
  elseif npar .== 1
    x[1] = polyMap(Θ,x₀) + noiseMix1()
    for i in 2:1:n
      x[i] = polyMap(Θ,x[i-1]) + noiseMix1()
    end
  elseif npar .== 2
    x[1] = polyMap(Θ,x₀) + noiseMix2(4)
    for i in 2:1:n
      x[i] = polyMap(Θ,x[i-1]) + noiseMix2(4)
    end
  else
    x[1] = polyMap(Θ,x₀) + noiseMix3(p1, lam1, lam2)
    for i in 2:1:n
      x[i] = polyMap(Θ,x[i-1]) + noiseMix3(p1, lam1, lam2)
    end
  end

  return x
end

function unifmixrnd(x)
  local U::Float64
  n = length(x)
  nc = 0
  for i in 1:2:n
    nc += x[i + 1] - x[i]
  end

  U = 0
  u = rand()
  prob = 0
  for i in 1:2:n
    prob += (x[i + 1] - x[i]) / nc
    if u .< prob
      U = x[i] + (x[i + 1] - x[i]) * rand()
      break
    end
  end
  return(U)
end

function rangeIntersection(A::Array{Float64}, B::Array{Float64})
#=
Purpose: Range/interval intersection

 A and B two ranges of closed intervals written
 as vectors [lowerbound1 upperbound1 lowerbound2 upperbound2]
 or as matrix [lowerbound1, lowerbound2, lowerboundn;
               upperbound1, upperbound2, upperboundn]
 A and B have to be sorted in ascending order

 out is the mathematical intersection A n B

 EXAMPLE USAGE:
   >> out=rangeIntersection([1 3 5 9],[2 9])
   	out =  [2 3 5 9]
   >> out=rangeIntersection([40 44 55 58], [42 49 50 52])
   	out =  [42 44]
=#

# Allocate, as we don't know yet the size, we assume the largest case
  out1 = zeros(length(B)+(length(A)-2))
  k = 1

  while isempty(A) .== 0 && isempty(B) .== 0
  # make sure that first is ahead second
    if A[1] .> B[1]
      temp = copy(B)
      B = copy(A)
      A = copy(temp)
    end

    if A[2] .< B[1]
      A = copy(A[3:end])
      continue
    elseif A[2] .== B[1]
      out1[k] = B[1]
      out1[k + 1] = B[1]
      k = k + 2

      A = A[3:end]
      continue
    else
      if A[2] .== B[2]
        out1[k] = B[1]
        out1[k+1] = B[2]
        k = k + 2

        A = A[3:end]
        B = B[3:end]

      elseif A[2] .< B[2]
        out1[k] = B[1]
        out1[k+1] = A[2]
        k = k + 2

        A = A[3:end]
      else
        out1[k] = B[1]
        out1[k+1] = B[2]
        k = k + 2

        B = B[3:end]
      end
     end
    end

  # Remove the tails
  out = copy(out1[1:k-1])
  return(out)
end

function etgeornd(p::Float64, k::Vector{Int64})
local z::Vector{Int64}
  z = floor(log.(rand(length(k))) ./ log.(1 - p)) + k
  return(z)
end

max_stars_repo_name: KosKal/DNRR

max_issues_repo_name: KosKal/DNRR

max_forks_repo_name: KosKal/DNRR


text:
function always_assert(condition::Bool,
                               msg::String)
    if !condition
        throw(AlwaysAssertionError(msg))
    end
    return nothing
end