text:
export create_webhook,
    get_channel_webhooks,
    get_guild_webhooks,
    get_webhook,
    get_webhook_with_token,
    modify_webhook,
    modify_webhook_with_token,
    delete_webhook,
    delete_webhook_with_token,
    execute_webhook,
    execute_slack_compatible_webhook,
    execute_github_compatible_webhook

"""
    create_webhook(c::Client, channel::Integer; kwargs...) -> Webhook

Create a [`Webhook`](@ref) in a [`DiscordChannel`](@ref).
More details [here](https://discordapp.com/developers/docs/resources/webhook#create-webhook).
"""
create_webhook(c::Client, channel::Integer; kwargs...) = Response{Webhook}(c, :POST, "/channels/$channel/webhooks"; body = kwargs)

"""
    get_channel_webhooks(c::Client, channel::Integer) -> Vector{Webhook}

Get a list of [`Webhook`](@ref)s in a [`DiscordChannel`](@ref).
"""
get_channel_webhooks(c::Client, channel::Integer) = Response{Vector{Webhook}}(c, :GET, "/channels/$channel/webhooks")

"""
    get_guild_webhooks(c::Client, guild::Integer) -> Vector{Webhook}

Get a list of [`Webhook`](@ref)s in a [`Guild`](@ref).
"""
get_guild_webhooks(c::Client, guild::Integer) = Response{Vector{Webhook}}(c, :GET, "/guilds/$guild/webhooks")

"""
    get_webhook(c::Client, webhook::Integer) -> Webhook

Get a [`Webhook`](@ref).
"""
get_webhook(c::Client, webhook::Integer) = Response{Webhook}(c, :GET, "/webhooks/$webhook")

"""
    get_webhook_with_token(c::Client, webhook::Integer, token::AbstractString) -> Webhook

Get a [`Webhook`](@ref) with a token.
"""
get_webhook_with_token(c::Client, webhook::Integer, token::AbstractString) = Response{Webhook}(c, :GET, "/webhooks/$webhook/$token")

"""
    modify_webhook(c::Client, webhook::Integer; kwargs...) -> Webhook

Modify a [`Webhook`](@ref).
More details [here](https://discordapp.com/developers/docs/resources/webhook#modify-webhook).
"""
modify_webhook(c::Client, webhook::Integer; kwargs...) = Response{Webhook}(c, :PATCH, "/webhooks/$webhook"; body = kwargs)

"""
    modify_webhook_with_token(
        c::Client,
        webhook::Integer,
        token::AbstractString;
        kwargs...,
    ) -> Webhook

Modify a [`Webhook`](@ref) with a token.
More details [here](https://discordapp.com/developers/docs/resources/webhook#modify-webhook).
"""
modify_webhook_with_token(
    c::Client,
    webhook::Integer,
    token::AbstractString;
    kwargs...,
) = Response{Webhook}(c, :PATCH, "/webhooks/$webhook/$token"; body = kwargs)

"""
    delete_webhook(c::Client, webhook::Integer)

Delete a [`Webhook`](@ref).
"""
delete_webhook(c::Client, webhook::Integer) = Response(c, :DELETE, "/webhooks/$webhook")

"""
    delete_webhook_with_token(c::Client, webhook::Integer, token::AbstractString)

Delete a [`Webhook`](@ref) with a token.
"""
delete_webhook_with_token(c::Client, webhook::Integer, token::AbstractString) = Response(c, :DELETE, "/webhooks/$webhook/$token")

"""
    execute_webhook(
        c::Client,
        webhook::Integer,
        token::AbstractString;
        wait::Bool=false,
        kwargs...,
    ) -> Message

Execute a [`Webhook`](@ref). If `wait` is not set, no [`Message`](@ref) is returned.
More details [here](https://discordapp.com/developers/docs/resources/webhook#execute-webhook).
"""
execute_webhook(
    c::Client,
    webhook::Integer,
    token::AbstractString;
    wait::Bool=false,
    kwargs...,
) = Response{Message}(c, :POST, "/webhooks/$webhook/$token"; body = kwargs, wait = wait)

"""
    execute_slack_compatible_webhook(
        c::Client,
        webhook::Integer,
        token::AbstractString;
        wait::Bool=true,
        kwargs...,
    )

Execute a Slack [`Webhook`](@ref).
More details [here](https://discordapp.com/developers/docs/resources/webhook#execute-slackcompatible-webhook).
"""
execute_slack_compatible_webhook(
    c::Client,
    webhook::Integer,
    token::AbstractString;
    wait::Bool=true,
    kwargs...,
) = Response{Message}(
        c,
        :POST,
        "/webhooks/$webhook/$token/slack";
        body = kwargs,
        wait = wait,
    )

"""
    execute_github_compatible_webhook(
        c::Client,
        webhook::Integer,
        token::AbstractString;
        wait::Bool=true,
        kwargs...,
    )

Execute a Github [`Webhook`](@ref).
More details [here](https://discordapp.com/developers/docs/resources/webhook#execute-githubcompatible-webhook).
"""
execute_github_compatible_webhook(
    c::Client,
    webhook::Integer,
    token::AbstractString;
    wait::Bool=true,
    kwargs...,
) = Response{Message}(
        c,
        :POST,
        "/webhooks/$webhook/$token/github";
        body = kwargs,
        wait = wait,
    )


text:
# thanks @tduretz
module test_neighbors

# Test correct handling of second order points

using Triangulate

function test()
    triin=Triangulate.TriangulateIO()
    triin.pointlist=Cdouble[0.0 0.0 ; 1.0 0.0 ; 1.0  1.0; 0.0 1.0]'
    triin.segmentlist=Cint[1 2 ; 2 3 ; 3 4 ; 4 1 ]'
    triin.segmentmarkerlist=Cint[1, 2, 3, 4]

    (triout, vorout)=triangulate("pqQn", triin)
    test1 = triout.pointlist==[0.0  1.0  1.0  0.0;
                               0.0  0.0  1.0  1.0]

    test1 = test1 && triout.trianglelist==[4  2;
                                           1  3;
                                           2  4]

    test2=triout.neighborlist==[-1 -1;
                                 2  1;
                                -1 -1]
    test1&&test2
end

end

ext: jl


text:
@testset "Transforms" begin
  @testset "Select" begin
    a = rand(4000)
    b = rand(4000)
    c = rand(4000)
    d = rand(4000)
    e = rand(4000)
    f = rand(4000)
    t = Table(; a, b, c, d, e, f)

    T = Select(:f, :d)
    n, c = apply(T, t)
    @test Tables.columnnames(n) == (:f, :d)
    tₒ = revert(T, n, c)
    @test t == tₒ

    T = Select(:f, :d, :b)
    n, c = apply(T, t)
    @test Tables.columnnames(n) == (:f, :d, :b)
    tₒ = revert(T, n, c)
    @test t == tₒ

    T = Select(:d, :c, :b)
    n, c = apply(T, t)
    @test Tables.columnnames(n) == (:d, :c, :b)
    tₒ = revert(T, n, c)
    @test t == tₒ

    T = Select(:e, :c, :b, :a)
    n, c = apply(T, t)
    @test Tables.columnnames(n) == (:e, :c, :b, :a)
    tₒ = revert(T, n, c)
    @test t == tₒ

    # selection with tuples
    T = Select((:e, :c, :b, :a))
    n, c = apply(T, t)
    @test Tables.columnnames(n) == (:e, :c, :b, :a)
    tₒ = revert(T, n, c)
    @test t == tₒ

    # selection with vectors
    T = Select([:e, :c, :b, :a])
    n, c = apply(T, t)
    @test Tables.columnnames(n) == (:e, :c, :b, :a)
    tₒ = revert(T, n, c)
    @test t == tₒ

    # selection with strings
    T = Select("d", "c", "b")
    n, c = apply(T, t)
    @test Tables.columnnames(n) == (:d, :c, :b)
    tₒ = revert(T, n, c)
    @test t == tₒ

    # selection with single column
    @test (Select(:a) == Select("a") ==
           Select((:a,)) == Select(("a",)) ==
           Select([:a]) == Select(["a"]))

    # reapply test
    T = Select(:b, :c, :d)
    n1, c1 = apply(T, t)
    n2 = reapply(T, t, c1)
    @test n1 == n2
  end

  @testset "Reject" begin
    a = rand(4000)
    b = rand(4000)
    c = rand(4000)
    d = rand(4000)
    e = rand(4000)
    f = rand(4000)
    t = Table(; a, b, c, d, e, f)

    T = Reject(:f, :d)
    n, c = apply(T, t)
    @test Tables.columnnames(n) == (:a, :b, :c, :e)
    tₒ = revert(T, n, c)
    @test t == tₒ

    T = Reject(:f, :d, :b)
    n, c = apply(T, t)
    @test Tables.columnnames(n) == (:a, :c, :e)
    tₒ = revert(T, n, c)
    @test t == tₒ

    T = Reject(:d, :c, :b)
    n, c = apply(T, t)
    @test Tables.columnnames(n) == (:a, :e, :f)
    tₒ = revert(T, n, c)
    @test t == tₒ

    T = Reject(:e, :c, :b, :a)
    n, c = apply(T, t)
    @test Tables.columnnames(n) == (:d, :f)
    tₒ = revert(T, n, c)
    @test t == tₒ

    # rejection with tuples
    T = Reject((:e, :c, :b, :a))
    n, c = apply(T, t)
    @test Tables.columnnames(n) == (:d, :f)
    tₒ = revert(T, n, c)
    @test t == tₒ

    # rejection with vectors
    T = Reject([:e, :c, :b, :a])
    n, c = apply(T, t)
    @test Tables.columnnames(n) == (:d, :f)
    tₒ = revert(T, n, c)
    @test t == tₒ

    # rejection with strings
    T = Reject("d", "c", "b")
    n, c = apply(T, t)
    @test Tables.columnnames(n) == (:a, :e, :f)
    tₒ = revert(T, n, c)
    @test t == tₒ

    # rejection with single column
    @test (Reject(:a) == Reject("a") ==
           Reject((:a,)) == Reject(("a",)) ==
           Reject([:a]) == Reject(["a"]))

    # reapply test
    T = Reject(:b, :c, :d)
    n1, c1 = apply(T, t)
    n2 = reapply(T, t, c1)
    @test n1 == n2
  end

  @testset "Rename" begin
    a = rand(4000)
    b = rand(4000)
    c = rand(4000)
    d = rand(4000)
    t = Table(; a, b, c, d)

    T = Rename(Dict(:a => :x))
    n, c = apply(T, t)
    @test Tables.columnnames(n) == (:x, :b, :c, :d)
    tₒ = revert(T, n, c)
    @test t == tₒ

    T = Rename(Dict(:a => :x, :c => :y))
    n, c = apply(T, t)
    @test Tables.columnnames(n) == (:x, :b, :y, :d)
    tₒ = revert(T, n, c)
    @test t == tₒ

    # rename with string pairs
    T = Rename("a" => "x", "c" => "y")
    n, c = apply(T, t)
    @test Tables.columnnames(n) == (:x, :b, :y, :d)
    tₒ = revert(T, n, c)
    @test t == tₒ

    # rename with symbol pairs
    T = Rename(:a => :x, :c => :y)
    n, c = apply(T, t)
    @test Tables.columnnames(n) == (:x, :b, :y, :d)
    tₒ = revert(T, n, c)
    @test t == tₒ

    # rename with mixed pairs
    T = Rename("a" => :x)
    n, c = apply(T, t)
    @test Tables.columnnames(n) == (:x, :b, :c, :d)
    tₒ = revert(T, n, c)
    @test t == tₒ

    T = Rename("a" => :x, :c => "y")
    n, c = apply(T, t)
    @test Tables.columnnames(n) == (:x, :b, :y, :d)
    tₒ = revert(T, n, c)
    @test t == tₒ

    # reapply test
    T = Rename(:b => :x, :d => :y)
    n1, c1 = apply(T, t)
    n2 = reapply(T, t, c1)
    @test n1 == n2
  end

  @testset "Identity" begin
    x = rand(4000)
    y = rand(4000)
    t = Table(; x, y)
    T = Identity()
    n, c = apply(T, t)
    @test t == n
    tₒ = revert(T, n, c)
    @test t == tₒ
  end

  @testset "Center" begin
    Random.seed!(42) # to reproduce the results
    x = rand(Normal(2,1), 4000)
    y = rand(Normal(5,1), 4000)
    t = Table(; x, y)
    T = Center()
    n, c = apply(T, t)
    μ = mean(Tables.matrix(n), dims=1)
    @test isapprox(μ[1], 0; atol=1e-6)
    @test isapprox(μ[2], 0; atol=1e-6)
    tₒ = revert(T, n, c)
    @test Tables.matrix(t) ≈ Tables.matrix(tₒ)

    # visual tests
    if visualtests
      p₁ = scatter(t.x, t.y, label="Original")
      p₂ = scatter(n.x, n.y, label="Center")
      p = plot(p₁, p₂, layout=(1,2))

      @test_reference joinpath(datadir,  "center.png") p
    end
  end

  @testset "Scale" begin
    Random.seed!(42) # to reproduce the results
    x = rand(Normal(4,3), 4000)
    y = rand(Normal(7,5), 4000)
    t = Table(; x, y)
    T = Scale(low=0, high=1)
    n, c = apply(T, t)
    @test all(x -> x <= 1, n.x)
    @test all(x -> x >= 0, n.x)
    @test all(y -> y <= 1, n.y)
    @test all(y -> y >= 0, n.y)
    tₒ = revert(T, n, c)
    @test Tables.matrix(t) ≈ Tables.matrix(tₒ)

    # visual tests
    if visualtests
      p₁ = scatter(t.x, t.y, label="Original")
      p₂ = scatter(n.x, n.y, label="Scale")
      p = plot(p₁, p₂, layout=(1,2))

      @test_reference joinpath(datadir,"scale.png") p
    end
  end

  @testset "ZScore" begin
    Random.seed!(42) # to reproduce the results
    x = rand(Normal(7,10), 4000)
    y = rand(Normal(15,2), 4000)
    t = Table(; x, y)
    T = ZScore()
    n, c = apply(T, t)
    μ = mean(Tables.matrix(n), dims=1)
    σ = std(Tables.matrix(n), dims=1)
    @test isapprox(μ[1], 0; atol=1e-6)
    @test isapprox(σ[1], 1; atol=1e-6)
    @test isapprox(μ[2], 0; atol=1e-6)
    @test isapprox(σ[2], 1; atol=1e-6)
    tₒ = revert(T, n, c)
    @test Tables.matrix(t) ≈ Tables.matrix(tₒ)

    # visual tests
    if visualtests
      p₁ = scatter(t.x, t.y, label="Original")
      p₂ = scatter(n.x, n.y, label="ZScore")
      p = plot(p₁, p₂, layout=(1,2))

      @test_reference joinpath(datadir,"zscore.png") p
    end
  end

  @testset "Quantile" begin
    t = (z=rand(1000),)
    n, c = apply(Quantile(), t)
    r = revert(Quantile(), n, c)
    @test all(-4 .< extrema(n.z) .< 4)
    @test all(0 .≤ extrema(r.z) .≤ 1)
  end

  @testset "Functional" begin
    x = π*rand(1500)
    y = π*rand(1500)
    t = Table(; x, y)
    T = Functional(cos)
    n, c = apply(T, t)
    @test all(x -> -1 <= x <= 1, n.x)
    @test all(y -> -1 <= y <= 1, n.y)
    tₒ = revert(T, n, c)
    @test Tables.matrix(t) ≈ Tables.matrix(tₒ)

    x = 2*(rand(1500) .- 0.5)
    y = 2*(rand(1500) .- 0.5)
    t = Table(; x, y)
    T = Functional(acos)
    n, c = apply(T, t)
    @test all(x -> 0 <= x <= π, n.x)
    @test all(y -> 0 <= y <= π, n.y)
    tₒ = revert(T, n, c)
    @test Tables.matrix(t) ≈ Tables.matrix(tₒ)

    x = π*(rand(1500) .- 0.5)
    y = π*(rand(1500) .- 0.5)
    t = Table(; x, y)
    T = Functional(sin)
    n, c = apply(T, t)
    @test all(x -> -1 <= x <= 1, n.x)
    @test all(y -> -1 <= y <= 1, n.y)
    tₒ = revert(T, n, c)
    @test Tables.matrix(t) ≈ Tables.matrix(tₒ)

    x = 2*(rand(1500) .- 0.5)
    y = 2*(rand(1500) .- 0.5)
    t = Table(; x, y)
    T = Functional(asin)
    n, c = apply(T, t)
    @test all(x -> -π/2 <= x <= π/2, n.x)
    @test all(y -> -π/2 <= y <= π/2, n.y)
    tₒ = revert(T, n, c)
    @test Tables.matrix(t) ≈ Tables.matrix(tₒ)

    x = rand(Normal(0,25), 1500)
    y = x + rand(Normal(10,2), 1500)
    t = Table(; x, y)
    T = Functional(exp)
    n, c = apply(T, t)
    @test all(x -> x > 0, n.x)
    @test all(y -> y > 0, n.y)
    tₒ = revert(T, n, c)
    @test Tables.matrix(t) ≈ Tables.matrix(tₒ)

    x = rand(Normal(0,25), 1500)
    y = x + rand(Normal(10,2), 1500)
    t = Table(; x, y)
    T = Functional(x -> x)
    n, c = apply(T, t)
    @test t == n
    @test isrevertible(T) == false
  end

  @testset "EigenAnalysis" begin
    # PCA test
    x = rand(Normal(0,10), 1500)
    y = x + rand(Normal(0,2), 1500)
    t = Table(; x, y)
    T = EigenAnalysis(:V)
    n, c = apply(T, t)
    Σ = cov(Tables.matrix(n))
    @test Σ[1,1] > 1
    @test isapprox(Σ[1,2], 0; atol=1e-6)
    @test isapprox(Σ[2,1], 0; atol=1e-6)
    @test Σ[2,2] > 1
    tₒ = revert(T, n, c)
    @test Tables.matrix(t) ≈ Tables.matrix(tₒ)

    # DRS test
    x = rand(Normal(0,10), 1500)
    y = x + rand(Normal(0,2), 1500)
    t = Table(; x, y)
    T = EigenAnalysis(:VD)
    n, c = apply(T, t)
    Σ = cov(Tables.matrix(n))
    @test isapprox(Σ[1,2], 0; atol=1e-6)
    @test isapprox(Σ[2,1], 0; atol=1e-6)
    @test isapprox(Σ[1,1], 1; atol=1e-6)
    @test isapprox(Σ[2,2], 1; atol=1e-6)
    tₒ = revert(T, n, c)
    @test Tables.matrix(t) ≈ Tables.matrix(tₒ)

    # SDS test
    x = rand(Normal(0,10), 1500)
    y = x + rand(Normal(0,2), 1500)
    t = Table(; x, y)
    T = EigenAnalysis(:VDV)
    n, c = apply(T, t)
    Σ = cov(Tables.matrix(n))
    @test isapprox(Σ[1,2], 0; atol=1e-6)
    @test isapprox(Σ[2,1], 0; atol=1e-6)
    @test isapprox(Σ[1,1], 1; atol=1e-6)
    @test isapprox(Σ[2,2], 1; atol=1e-6)
    tₒ = revert(T, n, c)
    @test Tables.matrix(t) ≈ Tables.matrix(tₒ)

    Random.seed!(42) # to reproduce the results
    x = rand(Normal(0,10), 4000)
    y = x + rand(Normal(0,2), 4000)
    t₁ = Table(; x, y)
    t₂, c₂ = apply(EigenAnalysis(:V), t₁)
    t₃, c₃ = apply(EigenAnalysis(:VD), t₁)
    t₄, c₄ = apply(EigenAnalysis(:VDV), t₁)
    t₅, c₅ = apply(PCA(), t₁)
    t₆, c₆ = apply(DRS(), t₁)
    t₇, c₇ = apply(SDS(), t₁)

    # visual tests
    if visualtests
      p₁ = scatter(t₁.x, t₁.y, label="Original")
      p₂ = scatter(t₂.x, t₂.y, label="V")
      p₃ = scatter(t₃.x, t₃.y, label="VD")
      p₄ = scatter(t₄.x, t₄.y, label="VDV")
      p₅ = scatter(t₅.x, t₅.y, label="PCA")
      p₆ = scatter(t₆.x, t₆.y, label="DRS")
      p₇ = scatter(t₇.x, t₇.y, label="SDS")
      p = plot(p₁, p₂, p₃, p₄, layout=(2,2))
      q = plot(p₂, p₃, p₄, p₅, p₆, p₇, layout=(2,3))

      @test_reference joinpath(datadir,"eigenanalysis-1.png") p
      @test_reference joinpath(datadir,"eigenanalysis-2.png") q
    end
  end

  @testset "Sequential" begin
    x = rand(Normal(0,10), 1500)
    y = x + rand(Normal(0,2), 1500)
    z = y + rand(Normal(0,5), 1500)
    t = Table(; x, y, z)
    T = Scale(low=0.2, high=0.8) → EigenAnalysis(:VDV)
    n, c = apply(T, t)
    tₒ = revert(T, n, c)
    @test Tables.matrix(t) ≈ Tables.matrix(tₒ)

    x = rand(Normal(0,10), 1500)
    y = x + rand(Normal(0,2), 1500)
    z = y + rand(Normal(0,5), 1500)
    t = Table(; x, y, z)
    T = Select(:x, :z) → ZScore() → EigenAnalysis(:V) → Scale(low=0, high=1)
    n, c = apply(T, t)
    tₒ = revert(T, n, c)
    @test Tables.matrix(t) ≈ Tables.matrix(tₒ)

    # reapply with Sequential transform
    t = Table(x=rand(1000))
    T = ZScore() → Quantile()
    n1, c1 = apply(T, t)
    n2 = reapply(T, t, c1)
    @test n1 == n2
  end

  @testset "Parallel" begin
    x = rand(Normal(0,10), 1500)
    y = x + rand(Normal(0,2), 1500)
    z = y + rand(Normal(0,5), 1500)
    t = Table(; x, y, z)
    T = Scale(low=0.3, high=0.6) ⊔ EigenAnalysis(:VDV)
    n, c = apply(T, t)
    tₒ = revert(T, n, c)
    @test Tables.matrix(t) ≈ Tables.matrix(tₒ)

    # check cardinality of Parallel
    x = rand(Normal(0,10), 1500)
    y = x + rand(Normal(0,2), 1500)
    z = y + rand(Normal(0,5), 1500)
    t = Table(; x, y, z)
    T = ZScore() ⊔ EigenAnalysis(:V)
    n = T(t)
    @test length(Tables.columnnames(n)) == 6

    # distributivity with respect to Sequential
    x = rand(Normal(0,10), 1500)
    y = x + rand(Normal(0,2), 1500)
    z = y + rand(Normal(0,5), 1500)
    t = Table(; x, y, z)
    T₁ = Center()
    T₂ = Scale(low=0.2, high=0.8)
    T₃ = EigenAnalysis(:VD)
    P₁ = T₁ → (T₂ ⊔ T₃)
    P₂ = (T₁ → T₂) ⊔ (T₁ →T₃)
    n₁ = P₁(t)
    n₂ = P₂(t)
    @test Tables.matrix(n₁) ≈ Tables.matrix(n₂)

    # reapply with Parallel transform
    t = Table(x=rand(1000))
    T = ZScore() ⊔ Quantile()
    n1, c1 = apply(T, t)
    n2 = reapply(T, t, c1)
    @test n1 == n2
  end

  @testset "Miscellaneous" begin
    # make sure transforms work with
    # single-column tables
    t = Table(x=rand(10000))
    n, c = apply(ZScore(), t)
    r = revert(ZScore(), n, c)
    @test isapprox(mean(n.x), 0.0, atol=1e-8)
    @test isapprox(std(n.x), 1.0, atol=1e-8)
    @test isapprox(mean(r.x), mean(t.x), atol=1e-8)
    @test isapprox(std(r.x), std(t.x), atol=1e-8)
  end
end


text:
using Base.Test

#-------------------------------------------------------------------------------------------------#
include("../src/pccf.jl")
@test Pccf.pccfWithConfirmation([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],2,[3,7,10]) == [1,2, 1,2,3,4,5,6,7, 1,2,3,4,5,6] # confirmed=[3,10]

#-------------------------------------------------------------------------------------------------#
include("../src/probs.jl")
@test Probs.ifDetected(5, [3, 6, 11], 3) == true
@test Probs.ifDetected(8, [3, 6, 11], 2) == true
@test Probs.ifDetected(9, [3, 6, 12], 2) == false

@test Probs.extractFps([1, 6, 19, 25], [5, 10, 15, 20], 3) == [1, 25]
@test Probs.extractTps([1, 6, 19, 25], [5, 10, 15, 20], 3) == [6, 19]

@test Probs.ifPredictedTp(2, [0.1, 0.9, 0.4], 0.41) == true
@test Probs.ifPredictedTp(3, [0.1, 0.9, 0.4], 0.41) == false

@test Probs.belowH(0.7, [0.1, 0.8, 0.4, 10.0, 11.0, 0.7], 4) == [1, 3]
@test Probs.aboveH(0.7, [0.1, 0.2, 0.71, 0.8, 0.5], 6      ) == [3, 4]

# @test Probs.whichBin(7 , [1,2,7,9]) == 3
# @test Probs.whichBin(-7, [1,2,7,9]) == 1
# @test Probs.whichBin(10, [1,2,7,9]) == 5
# @test Probs.whichBin(9 , [1,2,7,9]) == 4

#-------------------------------------------------------------------------------------------------#
include("../src/sim2.jl")

# fracOfRemovedFa(h, probs, delayConfirm, allErrors)
@test Sim2.fracOfRemovedFa(0.1, [0.01, 0.12, 0.03, 0.04, 0.11], 5, [1, 3, 4]) == 1.0

@test Sim2.fracOfRemovedFa(0.1, [0.01, 0.12, 0.03, 0.04, 0.11], 5, [1, 3, 5]) == 2/3
@test Sim2.fracOfRemovedFa(0.1, [0.01, 0.12, 0.03, 0.04, 0.11], 3, [1, 3, 5]) == 1.0

@test Sim2.fracOfRemovedFa(0.1, [0.01, 0.12, 0.03, 0.04, 0.11], 5, [2]      ) == 0.0

@test Sim2.fracOfRemovedFa(0.1, [0.01, 0.12, 0.03, 0.04, 0.11], 3, [1, 3]   ) == 1.0
@test Sim2.fracOfRemovedFa(0.1, [0.01, 0.12, 0.03, 0.04, 0.11], 3, [1, 2, 5]) == 0.5

# function fracOfPredictedTp (h, probs, delayConfirm, allChanges)
@test Sim2.fracOfPredictedTp(0.1, [0.11, 0.01, 0.11, 0.01, 0.11, 0.01], 6, [1, 3, 5]) == 1.0
@test Sim2.fracOfPredictedTp(0.1, [0.11, 0.01, 0.01, 0.01, 0.11, 0.01], 6, [1, 3, 5]) == 2/3
@test Sim2.fracOfPredictedTp(0.1, [0.11, 0.01, 0.01, 0.01, 0.11, 0.01], 3, [1, 3, 5]) == 0.5
@test Sim2.fracOfPredictedTp(0.1, [0.11, 0.01, 0.01, 0.01, 0.11, 0.01], 2, [1, 3, 5]) == 1.0

#-------------------------------------------------------------------------------------------------#
include("../src/sim3.jl")
@test Sim3.updVec([10,20,30], [2], [0]) == [10,0,30]

#-------------------------------------------------------------------------------------------------#
include("../src/detector.jl")
@test Detector.partSig(3, [1:5;]) == collect(([1,2,3],[2,3,4],[3,4,5]))
@test Detector.naiveDetector([1,2,5,2,10],4) == [3,5]

@test Detector.naiveDetectorDynamic([1.0, 2.0, 3.0, 3.5, 0.4],
                                    [0.5, 2.1, 2.9, 3.4, 0.4]) == [1,3,4]

#-------------------------------------------------------------------------------------------------#
include("../src/roc.jl")
@test Roc.tpNum([1,11]      , [10,20,30,40], 3) == 1
@test Roc.tpNum([1,11,13]   , [10,20,30,40], 3) == 2
@test Roc.tpNum([1,11,14]   , [10,20,30,40], 3) == 1
@test Roc.tpNum([1,11,14,30], [10,20,30,40], 3) == 2

@test Roc.tpRate([1,31   ], [10,20,30,40], 3) == 1/4
@test Roc.tpRate([1,31,44], [10,20,30,40], 3) == 1/4
@test Roc.tpRate([1,31,43], [10,20,30,40], 3) == 2/4

@test Roc.faRate([1,31   ], [10,20,30,40], 3, 100) == 1/(1+(100-4*3))

max_stars_repo_name: av-maslov/Recurrency

max_issues_repo_name: av-maslov/Recurrency

max_forks_repo_name: av-maslov/Recurrency


text:
# this file test the self-consistency of my code

# test special condition for CG coefficients
function test_special_CG(test_range::AbstractArray)
    for j = test_range
        for m = -j:1:j
            cg = CG(j, j, 0, m, -m, 0)
            mycg = iphase(Int(j - m)) / SqrtRational(2j + 1)
            @test cg == mycg
        end
    end
end

# test special condition for 3j symbols
function test_special_3j(test_range::AbstractArray)
    for j = test_range
        for m = -j:1:j
            tj = threeJ(j, 1, j, -m, 0, m)
            mytj = iphase(Int(j - m)) * m / SqrtRational(j * (2j + 1) * (j + 1))
            @test tj == mytj
        end
    end
end

# test special condition for 6j symbols
function test_special_6j(test_range::AbstractArray)
    for j1 in test_range, j2 in test_range, j3 in test_range
        if check_couple(Int(2j1), Int(2j2), Int(2j3))
            sj = sixJ(j1, j2, j3, j2, j1, 0)
            mysj = iphase(Int(j1 + j2 + j3)) / SqrtRational((2j1 + 1) * (2j2 + 1))
            @test sj == mysj
        end
    end
end

function check_6j(j1::HalfInt, j2::HalfInt, j3::HalfInt,
                  j4::HalfInt, j5::HalfInt, j6::HalfInt)
    dj1, dj2, dj3, dj4, dj5, dj6 = Int64.((2j1, 2j2, 2j3, 2j4, 2j5, 2j6))
    check_couple(dj1, dj2, dj3) & check_couple(dj1, dj5, dj6) &
    check_couple(dj4, dj2, dj6) & check_couple(dj4, dj5, dj3)
end

# test special condition for 9j symbols
function test_special_9j(test_range::AbstractArray)
    for j1 in test_range, j2 in test_range, j3 in test_range,
        j4 in test_range, j5 in test_range, j7 in test_range
        if check_6j(j1, j2, j3, j5, j4, j7)
            nj = nineJ(j1, j2, j3, j4, j5, j3, j7, j7, 0)
            snj = iphase(Int(j2 + j3 + j4 + j7)) / SqrtRational((2j3 + 1) * (2j7 + 1))
            snj *= sixJ(j1, j2, j3, j5, j4, j7)
            @test nj == snj
        end
    end
end


text:
using Distributions
using  Test

d = Semicircle(2.0)

@test params(d) == (2.0,)

@test minimum(d) == -2.0
@test maximum(d) == +2.0
@test extrema(d) == (-2.0, 2.0)

@test mean(d)     ==  .0
@test var(d)      == 1.0
@test skewness(d) ==  .0
@test median(d)   ==  .0
@test mode(d)     ==  .0
@test entropy(d)  == 1.33787706640934544458

@test pdf(d, -5) == .0
@test pdf(d, -2) == .0
@test pdf(d,  0) == .31830988618379067154
@test pdf(d, +2) == .0
@test pdf(d, +5) == .0

@test logpdf(d, -5) == -Inf
@test logpdf(d, -2) == -Inf
@test logpdf(d,  0) ≈  log(.31830988618379067154)
@test logpdf(d, +2) == -Inf
@test logpdf(d, +5) == -Inf

@test cdf(d, -5) ==  .0
@test cdf(d, -2) ==  .0
@test cdf(d,  0) ==  .5
@test cdf(d, +2) == 1.0
@test cdf(d, +5) == 1.0

@test quantile(d,  .0) == -2.0
@test quantile(d,  .5) ==   .0
@test quantile(d, 1.0) == +2.0


text:
using Pkg, Nemo, Libdl

oldwdir = pwd()

nemo_pkgdir = joinpath(dirname(pathof(Nemo)), "..")
#nemo_pkgdir = Pkg.dir("Nemo")
nemo_wdir = joinpath(nemo_pkgdir, "deps")
nemo_vdir = joinpath(nemo_pkgdir, "local")

hecke_pkgdir = joinpath(@__DIR__, "..")
wdir = joinpath(hecke_pkgdir, "deps")
vdir = joinpath(hecke_pkgdir, "local")

if !ispath(joinpath(hecke_pkgdir, "local"))
    mkdir(joinpath(hecke_pkgdir, "local"))
end
if !ispath(joinpath(hecke_pkgdir, "local", "lib"))
    mkdir(joinpath(hecke_pkgdir, "local", "lib"))
end

function download_dll(url_string, location_string)
   try
      run(`curl -o $(location_string) -L $(url_string)`)
   catch
      download(url_string, location_string)
   end
end

LDFLAGS = "-Wl,-rpath,$nemo_vdir/lib -Wl,-rpath,\$\$ORIGIN/../share/julia/site/v$(VERSION.major).$(VERSION.minor)/Nemo/local/lib -Wl,-rpath,$vdir/lib -Wl,-rpath,\$\$ORIGIN/../share/julia/site/v$(VERSION.major).$(VERSION.minor)/Hecke/local/lib"
DLCFLAGS = "-fPIC -fno-common"

cd(wdir)

if Sys.iswindows()
   if Int == Int64
      download_dll("http://www.mathematik.uni-kl.de/~thofmann/hecke/bin/libhecke.dll", joinpath(vdir, "lib", "libhecke.dll"))
   else
      println("There is no libhecke for 32 bit Windows")
   end
else
   cd("$wdir/hecke")
   withenv("LD_LIBRARY_PATH"=>"$vdir/lib:$nemo_vdir/lib", "LDFLAGS"=>LDFLAGS) do
      run(`./configure --prefix=$vdir --disable-static --enable-shared --with-mpir=$nemo_vdir --with-mpfr=$nemo_vdir --with-flint=$nemo_vdir`)
      run(`make -j4`)
      run(`make install`)
   end
end

push!(Libdl.DL_LOAD_PATH, joinpath(hecke_pkgdir, "local", "lib"))

cd(oldwdir)


text:
# Model of "Asap3" for VPR. Only big difference is that memories occupy the
# whole bottom row, instead of an isthmus of processors.

function asap3_vpr(style = Rectangular(2,1))
    arch = TopLevel{2}("asap3_vpr")

    ####################
    # Normal Processor #
    ####################

    # Get a processor tile and instantiate it.
    processor = build_processor_tile(style)
    for r in 0:29, c in 0:31
        add_child(arch, processor, CartesianIndex(r,c))
    end

	####################
	# Memory Processor #
	####################
	memory_processor = build_processor_tile(style, include_memory = true)
	for r = 30, c = 0:31
        add_child(arch, memory_processor, CartesianIndex(r,c))
	end

	#################
	# 2 Port Memory #
	#################
    memory_2port = build_memory(2)
	for r = 31, c in (0:2:30)
        add_child(arch, memory_2port, CartesianIndex(r,c))
	end

	#################
	# Input Handler #
	#################
	input_handler = build_input_handler(style)
    add_child(arch, input_handler, CartesianIndex(0,-1))

	##################
	# Output Handler #
	##################
	output_handler = build_output_handler(style)
    add_child(arch, output_handler, CartesianIndex(0,32))

	connect_processors(arch, style)
    connect_io(arch, style)
	connect_memories(arch, style)
	return arch
end


text:
using DelimitedFiles

sst_init() = register(DataDep(
    "GLUE-SST",
    """
    The Stanford Sentiment Treebank (SST) task (GLUE version)
    """,
    "https://firebasestorage.googleapis.com/v0/b/mtl-sentence-representations.appspot.com/o/data%2FSST-2.zip?alt=media&token=aabc5f6b-e466-44a2-b9b4-cf6337f84ac8",
    "d67e16fb55739c1b32cdce9877596db1c127dc322d93c082281f64057c16deaa";
    post_fetch_method = fn -> begin
      mv(fn, "SST-2.zip")
      DataDeps.unpack("SST-2.zip")
      innerdir = "SST-2"
      innerfiles = readdir(innerdir)
      mv.(joinpath.(innerdir, innerfiles), innerfiles)
      rm(innerdir)
    end
))

struct SST <: Dataset end

function trainfile(::SST)
    sets, headers = readdlm(datadep"GLUE-SST/train.tsv", '\t', String; header=true)
    [selectdim(sets, 2, i) for i = 1:2]
end

function devfile(::SST)
    sets, headers = readdlm(datadep"GLUE-SST/dev.tsv", '\t', String; header=true)
    [selectdim(sets, 2, i) for i = 1:2]
end

function testfile(::SST)
    sets, headers = readdlm(datadep"GLUE-SST/test.tsv", '\t', String; header=true)
    [selectdim(sets, 2, 2)]
end

get_labels(::SST) = ("0", "1")


text:
include("./shared.jl")
include("../scripts-part2/2D_SWE/shallow_water_2D_LF_xpu_mpi.jl")
include("../scripts-part2/2D_SWE/shallow_water_2D.jl")

# run the model for dam break in x-direction
H, xc = shallow_water_2D_xpu_mpi(; nx = n, ny = n)
indsx = Int.(ceil.(LinRange(1, length(xc), 12)))
indsy = Int.(ceil.(LinRange(1, length(xc), 12)))
d = Dict(:X => xc[indsx], :H => H[indsx, indsy])

@testset "Ref-test shallow water 2D with dam break in x-direction" begin
      @test_reference "reftest-files/shallow_water_2D_x.bson" d by = comp
end

@reset_parallel_stencil()


text:
@testset "Meshes" begin
  @testset "CartesianGrid" begin
    grid = CartesianGrid{T}(200,100)
    @test embeddim(grid) == 2
    @test coordtype(grid) == T
    @test size(grid) == (200, 100)
    @test minimum(grid) == P2(0, 0)
    @test maximum(grid) == P2(200, 100)
    @test spacing(grid) == T[1, 1]

    grid = CartesianGrid((200,100,50), T.((0,0,0)), T.((1,1,1)))
    @test embeddim(grid) == 3
    @test coordtype(grid) == T
    @test size(grid) == (200, 100, 50)
    @test minimum(grid) == P3(0, 0, 0)
    @test maximum(grid) == P3(200, 100, 50)
    @test spacing(grid) == T[1, 1, 1]

    grid = CartesianGrid(T.((-1.,-1.)), T.((1.,1.)), dims=(200,100))
    @test embeddim(grid) == 2
    @test coordtype(grid) == T
    @test size(grid) == (200, 100)
    @test minimum(grid) == P2(-1., -1.)
    @test maximum(grid) == P2(1., 1.)
    @test spacing(grid) == T[2/200, 2/100]
  end

  @testset "UnstructuredMesh" begin
    points = P2[(0,0), (1,0), (0,1), (1,1), (0.5,0.5)]
    connec = connect.([(1,2,5),(2,4,5),(4,3,5),(3,1,5)], Triangle)
    mesh = UnstructuredMesh(points, connec)
    triangles = Triangle.([
      P2[(0.0,0.0), (1.0,0.0), (0.5,0.5)],
      P2[(1.0,0.0), (1.0,1.0), (0.5,0.5)],
      P2[(1.0,1.0), (0.0,1.0), (0.5,0.5)],
      P2[(0.0,1.0), (0.0,0.0), (0.5,0.5)]
    ])
    @test vertices(mesh) == points
    @test collect(faces(mesh, 2)) == triangles
    @test collect(elements(mesh)) == triangles

    points = P2[(0,0), (1,0), (0,1), (1,1), (0.25,0.5), (0.75,0.5)]
    Δs = connect.([(3,1,5),(4,6,2)], Triangle)
    □s = connect.([(1,2,5,6),(5,6,3,4)], Quadrangle)
    mesh = UnstructuredMesh(points, [Δs; □s])
    elms = [
      Triangle(P2[(0.0,1.0), (0.0,0.0), (0.25,0.5)]),
      Triangle(P2[(1.0,1.0), (0.75,0.5), (1.0,0.0)]),
      Quadrangle(P2[(0.0,0.0), (1.0,0.0), (0.25,0.5), (0.75,0.5)]),
      Quadrangle(P2[(0.25,0.5), (0.75,0.5), (0.0,1.0), (1.0,1.0)])
    ]
    @test collect(elements(mesh)) == elms

    # make sure there is no memory allocation
    points = P2[(0,0), (1,0), (0,1), (1,1), (0.5,0.5)]
    connec = connect.([(1,2,5),(2,4,5),(4,3,5),(3,1,5)], Triangle)
    mesh = UnstructuredMesh(points, connec)
    bytes = @allocated faces(mesh, 2)
    @test bytes < 100
    cells = faces(mesh, 2)
    bytes = @allocated collect(cells)
    @test bytes < 800
  end
end


text:
using SparseArrays
using SuiteSparse.CHOLMOD
using LinearAlgebra

function find_replacement(v)
    [x for (x,y) in filter((y->(y[2] != 0)), Tuple(enumerate(v)))]
end

function chm_analyze_ordering(A::CHOLMOD.Sparse{Tv}, ordering::Cint, Perm::Vector{Int}) where {Tv<:CHOLMOD.VTypes}
    s = A.p
    Parent   = Array{Int,1}(undef,size(s)[1])

    ccall((@CHOLMOD.cholmod_name(("analyze_ordering",Int)),:libcholmod), Cint,
          (Ptr{CHOLMOD.C_Sparse{Tv}}, Cint, Ptr{Int}, Ptr{Int}, Csize_t,
           Ptr{Int}, Ptr{Int}, Ptr{Int},
           Ptr{Int}, Ptr{Int}, Ptr{UInt8}),
           A.p, ordering, Perm, C_NULL, zero(Csize_t), Parent, Post, ColCount, First, Level, CHOLMOD.common())
    Parent, Post, ColCount
end

function pothen_sun(par::Vector{T}, post::Vector{T}, colcount::Vector{T}) where {T<:Integer}
    n = length(par)
    flag = -ones(T,n)
    ns = n
    for j=post
        mdeg = colcount[j] - 1
        if par[j] != 0 && mdeg == colcount[par[j]] && flag[par[j]] == -1
            # par[j] not assigned to supernode
            ns -= 1
            if flag[j] < 0    # j is a repr. vertex
                flag[par[j]] = j
                flag[j] -= 1
            else              # j is not a repr. vertex
                flag[par[j]] = flag[j]
                flag[flag[j]] -= 1
            end
        end
    end
    ns, flag
end

function round_array(T, A::SparseMatrixCSC{Tv,Ti}) where {Tv<:Number,Ti<:Int}
    if T <: Integer
        convert(SparseMatrixCSC{T,Ti},map(x->Base.round(T,x),A))
    else
        convert(SparseMatrixCSC{T,Ti},map(x->Base.round(x),A))
    end
end

function chordal_embedding(A::SparseMatrixCSC{Tv,Ti}, Perm::Vector{Ti}) where {Tv<:Number,Ti<:Int}
    m, n = size(A)
    S = CHOLMOD.Sparse(round_array(Float64,A))

    F = cholesky(round_array(Float64,A), shift=n, perm=Perm)
    s = F.p
    p = [ round(Int64,s[i]) for i=1:length(s)]

    par, post, colcount = chm_analyze_ordering(S, s.ordering, p)
    ns, flag = pothen_sun(par+1, post+1, colcount)

    # extract cliques
    L = sparse(CHOLMOD.Sparse(F))
    Array{Int,1}[ sort(1+p[L.rowval[L.colptr[i]:L.colptr[i+1]-1]]) for i = find_replacement(flag .< 0) ]
end

# If no permutation is specified, use the CHOLMOD ordering
chordal_embedding(A::SparseMatrixCSC{Tv,Ti}) where {Tv<:Number,Ti<:Int} = chordal_embedding(A, Array{Int,1}(undef,0))

function clique_index(I::Array{Array{Int,1},1}, S::Array{Int,1}, n::Int)

    J = Int[]
    mask = zeros(Int, n)
    s = sparsevec(S, 1, n)
    for k=1:length(I)
        if length(S) <= length(I[k])
            mask[I[k]] .= 1
            if dot(mask, s) == length(S)
                push!(J, k)
            end
            mask[I[k]] .= 0
        end
    end
    J
end


text:
import ..UncertainValues: AbstractUncertainValue
import ..UncertainDatasets: AbstractUncertainIndexValueDataset
import ..UncertainStatistics: quantile, median

@recipe function f(uvals::AbstractUncertainIndexValueDataset,
    quants_index::Vector{Float64} = [0.33, 0.67],
    quants_values::Vector{Float64} = [0.33, 0.67])

    n_vals = length(uvals)

    for i = 1:n_vals
        idx, val = uvals[i]

        med_idx = median(idx, 10000)
        lower_idx = quantile(idx, minimum(quants_index), 10000)
        upper_idx = quantile(idx, maximum(quants_index), 10000)

        med_val = median(val, 10000)
        lower_val = quantile(val, minimum(quants_values), 10000)
        upper_val = quantile(val, maximum(quants_values), 10000)

        @series begin
            #seriescolor --> :black
            label --> ""
            xerror --> ([med_idx - lower_idx], [upper_idx - med_idx])
            yerror --> ([med_val - lower_val], [upper_val - med_val])
            [med_idx], [med_val]
        end
    end
end


text:
using JuMP, EAGO

                     m = Model()

                     EAGO.register_eago_operators!(m)

                     @variable(m, -1 <= x[i=1:4] <= 1)

                     @variable(m, -41.21023060076703 <= q <= 39.01192102445897)

                     add_NL_constraint(m, :(gelu(-0.296746779395487 + 0.5509866377924739*gelu(-0.36537726371933 + -0.13236748618316563*gelu(0.24726246482452874 + -0.2513871312104543*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.4677853214537917*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + -0.10088601735084568*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.6507022966434817*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + 0.8938439926067105*gelu(0.30866893537934104 + -0.11067617174498023*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.7749548972944802*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.44318801341623093*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.23547099627350976*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + -0.2026514795524368*gelu(-0.39572563026399044 + -0.2902839675147266*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.2975675315855191*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.808554335286296*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.2217074058396178*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + 0.4969096390589627*gelu(0.8092602903578396 + -0.8861475410157751*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + -0.38211269748902854*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.47211467596801615*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.8428121402295612*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4])))) + -0.850208463612319*gelu(-0.13805861779585626 + 0.8324190447258686*gelu(0.24726246482452874 + -0.2513871312104543*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.4677853214537917*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + -0.10088601735084568*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.6507022966434817*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + 0.45691763611374503*gelu(0.30866893537934104 + -0.11067617174498023*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.7749548972944802*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.44318801341623093*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.23547099627350976*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + -0.0018061937798208305*gelu(-0.39572563026399044 + -0.2902839675147266*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.2975675315855191*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.808554335286296*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.2217074058396178*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + -0.06838129719944464*gelu(0.8092602903578396 + -0.8861475410157751*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + -0.38211269748902854*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.47211467596801615*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.8428121402295612*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4])))) + 0.14361846152386626*gelu(0.892089992500452 + -0.9262441239021939*gelu(0.24726246482452874 + -0.2513871312104543*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.4677853214537917*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + -0.10088601735084568*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.6507022966434817*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + -0.1220711338530176*gelu(0.30866893537934104 + -0.11067617174498023*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.7749548972944802*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.44318801341623093*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.23547099627350976*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + 0.013243228467184842*gelu(-0.39572563026399044 + -0.2902839675147266*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.2975675315855191*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.808554335286296*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.2217074058396178*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + 0.22830737094249542*gelu(0.8092602903578396 + -0.8861475410157751*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + -0.38211269748902854*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.47211467596801615*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.8428121402295612*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4])))) + 0.12455164844812394*gelu(-0.09971606472325156 + 0.22050596868305217*gelu(0.24726246482452874 + -0.2513871312104543*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.4677853214537917*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + -0.10088601735084568*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.6507022966434817*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + -0.9537528744420904*gelu(0.30866893537934104 + -0.11067617174498023*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.7749548972944802*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.44318801341623093*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.23547099627350976*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + -0.13795746696872868*gelu(-0.39572563026399044 + -0.2902839675147266*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.2975675315855191*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.808554335286296*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.2217074058396178*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + 0.0643190431003462*gelu(0.8092602903578396 + -0.8861475410157751*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + -0.38211269748902854*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.47211467596801615*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.8428121402295612*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))))) + gelu(-0.7906046812278151 + -0.2168623555923963*gelu(-0.36537726371933 + -0.13236748618316563*gelu(0.24726246482452874 + -0.2513871312104543*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.4677853214537917*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + -0.10088601735084568*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.6507022966434817*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + 0.8938439926067105*gelu(0.30866893537934104 + -0.11067617174498023*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.7749548972944802*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.44318801341623093*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.23547099627350976*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + -0.2026514795524368*gelu(-0.39572563026399044 + -0.2902839675147266*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.2975675315855191*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.808554335286296*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.2217074058396178*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + 0.4969096390589627*gelu(0.8092602903578396 + -0.8861475410157751*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + -0.38211269748902854*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.47211467596801615*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.8428121402295612*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4])))) + 0.3937942437507238*gelu(-0.13805861779585626 + 0.8324190447258686*gelu(0.24726246482452874 + -0.2513871312104543*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.4677853214537917*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + -0.10088601735084568*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.6507022966434817*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + 0.45691763611374503*gelu(0.30866893537934104 + -0.11067617174498023*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.7749548972944802*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.44318801341623093*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.23547099627350976*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + -0.0018061937798208305*gelu(-0.39572563026399044 + -0.2902839675147266*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.2975675315855191*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.808554335286296*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.2217074058396178*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + -0.06838129719944464*gelu(0.8092602903578396 + -0.8861475410157751*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + -0.38211269748902854*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.47211467596801615*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.8428121402295612*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4])))) + 0.013414887338259796*gelu(0.892089992500452 + -0.9262441239021939*gelu(0.24726246482452874 + -0.2513871312104543*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.4677853214537917*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + -0.10088601735084568*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.6507022966434817*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + -0.1220711338530176*gelu(0.30866893537934104 + -0.11067617174498023*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.7749548972944802*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.44318801341623093*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.23547099627350976*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + 0.013243228467184842*gelu(-0.39572563026399044 + -0.2902839675147266*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.2975675315855191*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.808554335286296*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.2217074058396178*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + 0.22830737094249542*gelu(0.8092602903578396 + -0.8861475410157751*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + -0.38211269748902854*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.47211467596801615*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.8428121402295612*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4])))) + -0.20160941359718088*gelu(-0.09971606472325156 + 0.22050596868305217*gelu(0.24726246482452874 + -0.2513871312104543*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.4677853214537917*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + -0.10088601735084568*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.6507022966434817*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + -0.9537528744420904*gelu(0.30866893537934104 + -0.11067617174498023*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.7749548972944802*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.44318801341623093*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.23547099627350976*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + -0.13795746696872868*gelu(-0.39572563026399044 + -0.2902839675147266*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.2975675315855191*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.808554335286296*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.2217074058396178*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + 0.0643190431003462*gelu(0.8092602903578396 + -0.8861475410157751*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + -0.38211269748902854*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.47211467596801615*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.8428121402295612*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))))) + gelu(0.21825887860627402 + 0.23342217391611308*gelu(-0.36537726371933 + -0.13236748618316563*gelu(0.24726246482452874 + -0.2513871312104543*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.4677853214537917*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + -0.10088601735084568*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.6507022966434817*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + 0.8938439926067105*gelu(0.30866893537934104 + -0.11067617174498023*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.7749548972944802*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.44318801341623093*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.23547099627350976*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + -0.2026514795524368*gelu(-0.39572563026399044 + -0.2902839675147266*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.2975675315855191*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.808554335286296*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.2217074058396178*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + 0.4969096390589627*gelu(0.8092602903578396 + -0.8861475410157751*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + -0.38211269748902854*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.47211467596801615*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.8428121402295612*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4])))) + 0.7638006108327029*gelu(-0.13805861779585626 + 0.8324190447258686*gelu(0.24726246482452874 + -0.2513871312104543*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.4677853214537917*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + -0.10088601735084568*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.6507022966434817*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + 0.45691763611374503*gelu(0.30866893537934104 + -0.11067617174498023*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.7749548972944802*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.44318801341623093*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.23547099627350976*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + -0.0018061937798208305*gelu(-0.39572563026399044 + -0.2902839675147266*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.2975675315855191*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.808554335286296*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.2217074058396178*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + -0.06838129719944464*gelu(0.8092602903578396 + -0.8861475410157751*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + -0.38211269748902854*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.47211467596801615*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.8428121402295612*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4])))) + 0.4051674738413942*gelu(0.892089992500452 + -0.9262441239021939*gelu(0.24726246482452874 + -0.2513871312104543*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.4677853214537917*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + -0.10088601735084568*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.6507022966434817*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + -0.1220711338530176*gelu(0.30866893537934104 + -0.11067617174498023*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.7749548972944802*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.44318801341623093*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.23547099627350976*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + 0.013243228467184842*gelu(-0.39572563026399044 + -0.2902839675147266*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.2975675315855191*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.808554335286296*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.2217074058396178*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + 0.22830737094249542*gelu(0.8092602903578396 + -0.8861475410157751*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + -0.38211269748902854*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.47211467596801615*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.8428121402295612*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4])))) + 0.17219310126869347*gelu(-0.09971606472325156 + 0.22050596868305217*gelu(0.24726246482452874 + -0.2513871312104543*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.4677853214537917*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + -0.10088601735084568*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.6507022966434817*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + -0.9537528744420904*gelu(0.30866893537934104 + -0.11067617174498023*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.7749548972944802*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.44318801341623093*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.23547099627350976*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + -0.13795746696872868*gelu(-0.39572563026399044 + -0.2902839675147266*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.2975675315855191*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.808554335286296*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.2217074058396178*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + 0.0643190431003462*gelu(0.8092602903578396 + -0.8861475410157751*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + -0.38211269748902854*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.47211467596801615*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.8428121402295612*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))))) + gelu(0.8210746038366681 + -0.06951431198870361*gelu(-0.36537726371933 + -0.13236748618316563*gelu(0.24726246482452874 + -0.2513871312104543*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.4677853214537917*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + -0.10088601735084568*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.6507022966434817*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + 0.8938439926067105*gelu(0.30866893537934104 + -0.11067617174498023*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.7749548972944802*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.44318801341623093*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.23547099627350976*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + -0.2026514795524368*gelu(-0.39572563026399044 + -0.2902839675147266*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.2975675315855191*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.808554335286296*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.2217074058396178*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + 0.4969096390589627*gelu(0.8092602903578396 + -0.8861475410157751*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + -0.38211269748902854*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.47211467596801615*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.8428121402295612*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4])))) + 0.9856384884704164*gelu(-0.13805861779585626 + 0.8324190447258686*gelu(0.24726246482452874 + -0.2513871312104543*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.4677853214537917*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + -0.10088601735084568*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.6507022966434817*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + 0.45691763611374503*gelu(0.30866893537934104 + -0.11067617174498023*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.7749548972944802*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.44318801341623093*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.23547099627350976*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + -0.0018061937798208305*gelu(-0.39572563026399044 + -0.2902839675147266*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.2975675315855191*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.808554335286296*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.2217074058396178*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + -0.06838129719944464*gelu(0.8092602903578396 + -0.8861475410157751*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + -0.38211269748902854*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.47211467596801615*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.8428121402295612*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4])))) + -0.2856111885860577*gelu(0.892089992500452 + -0.9262441239021939*gelu(0.24726246482452874 + -0.2513871312104543*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.4677853214537917*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + -0.10088601735084568*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.6507022966434817*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + -0.1220711338530176*gelu(0.30866893537934104 + -0.11067617174498023*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.7749548972944802*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.44318801341623093*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.23547099627350976*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + 0.013243228467184842*gelu(-0.39572563026399044 + -0.2902839675147266*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.2975675315855191*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.808554335286296*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.2217074058396178*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + 0.22830737094249542*gelu(0.8092602903578396 + -0.8861475410157751*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + -0.38211269748902854*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.47211467596801615*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.8428121402295612*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4])))) + 0.04937870878523665*gelu(-0.09971606472325156 + 0.22050596868305217*gelu(0.24726246482452874 + -0.2513871312104543*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.4677853214537917*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + -0.10088601735084568*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.6507022966434817*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + -0.9537528744420904*gelu(0.30866893537934104 + -0.11067617174498023*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.7749548972944802*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.44318801341623093*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + 0.23547099627350976*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + -0.13795746696872868*gelu(-0.39572563026399044 + -0.2902839675147266*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + 0.2975675315855191*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.808554335286296*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.2217074058396178*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))) + 0.0643190431003462*gelu(0.8092602903578396 + -0.8861475410157751*gelu(-0.7954573007956682 + 0.11924049292543248*$(x[1]) + 0.1731334424011517*$(x[2]) + -0.6758597754938092*$(x[3]) + 0.13301420625435734*$(x[4])) + -0.38211269748902854*gelu(-0.7274702539948783 + 0.17282628886946716*$(x[1]) + 0.018302754525115095*$(x[2]) + 0.800298561254523*$(x[3]) + -0.4821070372998202*$(x[4])) + 0.47211467596801615*gelu(-0.4299065646425082 + -0.1572016654178685*$(x[1]) + 0.08953552697871814*$(x[2]) + 0.5995804212147959*$(x[3]) + -0.3420773339437706*$(x[4])) + -0.8428121402295612*gelu(0.440020919910439 + 0.27581141739825465*$(x[1]) + 0.9904718804451909*$(x[2]) + -0.9775405312317109*$(x[3]) + 0.5010243235294203*$(x[4]))))) - $q <= 0.0))

                     @objective(m, Min, q)

                     return m

max_stars_repo_name: PSORLab/RSActivationFunctions

max_issues_repo_name: PSORLab/RSActivationFunctions

max_forks_repo_name: PSORLab/RSActivationFunctions


text:
using StreamingPCA
using Base.Test
using MNIST
using MultivariateStats

# Invalid Problem Dimensions
caught = false
try
    streaming_pca(randn(100,5),17)
catch
    caught = true
    println("[dim.1] Caught dimension error. [OK]")
end
if !caught
    error("[dim.1] Did not catch dimension error. [BAD]")
end

caught = false
try
    streaming_pca(randn(1,100),17)
catch
    caught = true
    println("[dim.2] Caught dimension error. [OK]")
end
if !caught
    error("[dim.1] Did not catch dimension error. [BAD]")
end

caught = false
try
    streaming_pca(randn(100,1),17)
catch
    caught = true
    println("[dim.3] Caught dimension error. [OK]")
end
if !caught
    error("[dim.1] Did not catch dimension error. [BAD]")
end

# Block ranges
r = StreamingPCA.block_range(100,10,1)
if r != 1:10
    println("[ran.1] Invalid block range. [OK]")
end

# Valid problem
try
    streaming_pca(randn(100,5),10)
catch
    error("[gen.1] Valid call threw error. [BAD]")
end
println("[gen.1] Valid call is valid. [OK]")

# Make a test on MNIST
println("[mnist.1] Loading 60,000 data samples.")
X,lab = traindata()
X /= 255
rank = 10
batchSize = 100
println("[mnist.1] Running offline PCA.")
M = fit(PCA,X;maxoutdim=rank)
XrecOff = reconstruct(M,transform(M,X))
println("[mnist.1] Running `streaming_pca` for batch size $(batchSize).")
Q,XQ,pc_score = streaming_pca(X',batchSize;rank=rank)
println("[mnist.1] Principal Component size: $(size(Q))")
println("[mnist.1] Projected dataset size: $(size(XQ))")
println("[mnist.1] Prinicipal component scores: ")
println(pc_score'/maximum(pc_score))
Xrec = XQ*Q';
println("[mnist.1] Reconstructed MNIST dimensions : $(size(Xrec))")
fullmse = mean((X'-Xrec).^2)
fullmseOff  = mean((X-XrecOff).^2)
@printf("[mnist.1] Reconstructed MNIST MSE (offline): %e\n",fullmseOff)
@printf("[mnist.1] Reconstructed MNIST MSE (streaming): %e\n",fullmse)


text:
#
# Restricted Two-body problem propagation
#

"""
Create's an ODEProblem for a `R2BP` orbit.
"""
function SciMLBase.ODEProblem(orbit::R2BPOrbit, Δt::Number)
    u  = state(orbit)
    Δt = eltype(state(orbit))(Δt)
    ts = Δt isa Unitful.Time ? (zero(ustrip(timeunit(orbit), Δt)), ustrip(timeunit(orbit), Δt)) : (zero(Δt), Δt)
    p  = system(orbit)
    return ODEProblem(R2BPFunction(), u, ts, p)
end

"""
Create's an ODEProblem for a `R2BP` orbit.
"""
function SciMLBase.ODEProblem(orbit::CR3BPOrbit, Δt::Real)
    u  = state(orbit)
    Δt = eltype(state(orbit))(Δt)
    ts = (zero(Δt), Δt)
    p  = system(orbit)
    f  = u isa CartesianStateWithSTM ? CR3BPFunction(; stm=true) : CR3BPFunction()
    return ODEProblem(f, u, ts, p)
end

"""
Propagates an orbit forward or backward in time.
Use `algorithm` to set the desired numerical integration
algorithm, e.g. `algorithm = Tsit5()`. All other `kwargs`
are passed directly to `DifferentialEquations.solve`.
"""
function propagate(orbit::Orbit, Δt::Number; algorithm=nothing, kwargs...)
    defaults = (; reltol=1e-14, abstol=1e-14)
    options  = merge(defaults, kwargs)
    problem  = ODEProblem(orbit, Δt)

    if isnothing(algorithm)
        solution = solve(problem; options...)
    else
        solution =  solve(problem, algorithm; options...)
    end

    return Trajectory{frame(orbit), typeof(solution.prob.u0), typeof(solution.prob.p), typeof(epoch(orbit)), typeof(solution)}(epoch(orbit), solution)
end


text:
"""
repositories at "https://github.com/sesameman/ChebyshevFun.jl"
"""
module ChebyshevFun
include("chebyshev.jl")
export chebyshevT
export chebyshevU
end


text:
function derivation(f::N,x::Symbol)where N<:Number # 常数
    return zero(N)
end
function derivation(f::Symbol,x::Symbol)
    return (f==x) ? 1 : 0
end
function derivation(f::Expr,x::Symbol)
    if length(f.args)==1
        return f.args[1]==x ? 1 : 0
    elseif length(f.args)==2
        if f.args[1]==:ln # (ln(x))'=1/x
            return Expr(:call,:/,1,derivation(f.args[2],x))
        end
    elseif length(f.args)==3
        if f.args[1]==:+||f.args[1]==.-
            return Expr(:call,f.args[1],derivation(f.args[2],x),derivation(f.args[3],x))
        elseif f.args[1]==:* # (ab)'=a'b+ab'
            return Expr(:call,:+,
                Expr(:call,:*,derivation(f.args[2],x),f.args[3]),
                Expr(:call,:*,f.args[2],derivation(f.args[3],x))
            )
        elseif f.args[1]==:/ # (a/b)'=(a'b-ab')/b²
            return Expr(:call,:/,
                Expr(:call,:-,
                    Expr(:call,:*,derivation(f.args[2],x),f.args[3]),
                    Expr(:call,:*,f.args[2],derivationf(f.args[3],x))
                ),
                Expr(:call,:^,2,f.args[3])
            )
        end
    end
    return :0
end

println(derivation(:(x*x+x),:x))

max_stars_repo_name: Rratic/JuliaGuide

max_issues_repo_name: Rratic/JuliaGuide

max_forks_repo_name: Rratic/JuliaGuide


text:
function totalGeneCDSLength(cosmicpath)
    kv = Dict{ASCIIString,Int64}()
    open(cosmicpath) do file
        header = readline(file)
        while !eof(file)
            line = readDiscreteLine(file)
            gene_name = line[1]
            gene_cds_length = line[3]
            if !in(gene_name, keys(kv))
                kv[gene_name] = parse(Int64, gene_cds_length)
            end
        end
    end
    sum(keys(kv)),sum(values(kv))
end


text:
isrenderable(::Type{String}) = true

function render!(rm::RenderModel, t::String)
    font_size = 12
    x = 10
    y = 1.5*font_size
    y_jump = 1.5 * font_size
    for line in split(t, '\n')
        add_instruction!(rm, render_text, (line, x, y, font_size, colorant"white"), incameraframe=false)
        y += y_jump
    end
    return rm
end


text:
"""
    BFGS

Quasi-Newton descent method.
"""
mutable struct BFGS{T<:AbstractFloat,
                    V<:AbstractVector{T},
                    M<:AbstractMatrix{T}} <: OptBuffer
    invH::M
    x::V
    g::V
    xpre::V
    gpre::V
    d::V
    xdiff::V
    gdiff::V
    y::T
    ypre::T
end

function BFGS(x::AbstractVector{T}) where {T}
    F = float(T)
    bfgs = BFGS(
        sqmatr(x, F),
        similar(x, F),
        similar(x, F),
        similar(x, F),
        similar(x, F),
        similar(x, F),
        similar(x, F),
        similar(x, F),
        F(NaN),
        F(NaN),
    )
    reset!(bfgs)
    return bfgs
end

function init!(
    optfn!, M::BFGS{T}, x0;
    reset, constrain_step = infstep
) where {T}
    optfn!(x0, zero(T), x0)
    if reset
        M.xpre, M.x = M.x, M.xpre
        M.gpre, M.g = M.g, M.gpre
        M.ypre = M.y
        map!(-, M.d, M.gpre)
        αmax = constrain_step(M.xpre, M.d)
        α = strong_backtracking!(
            optfn!, M.xpre, M.d, M.ypre, M.gpre;
            αmax=αmax, β=one(T)/100, σ=one(T)/10
        )
        map!(-, M.xdiff, M.x, M.xpre)
        map!(-, M.gdiff, M.g, M.gpre)

        invH = M.invH
        nr, nc = size(invH)
        scale = dot(M.xdiff, M.gdiff) / dot(M.gdiff, M.gdiff)
        fill!(invH, 0)
        for i in 1:nc
            elt = M.xdiff[i] / M.gdiff[i]
            invH[i, i] = 1e-5 < elt / scale < 1e5 ? elt : scale
        end
    end
    return M
end

@inline function reset!(M::BFGS)
    invH = M.invH
    nr, nc = size(invH)
    for j in 1:nc, i in 1:nr
        invH[i, j] = i == j
    end
    return M
end

function reset!(M::BFGS, x0, scale::Real=1)
    copy!(M.x, x0)
    invH = M.invH
    nr, nc = size(invH)
    for j in 1:nc, i in 1:nr
        invH[i, j] = (i == j) * scale
    end
    return M
end

@inline function callfn!(fdf, M::BFGS, x, α, d)
    __update_arg!(M, x, α, d)
    y, g = fdf(M.x, M.g)
    __update_grad!(M, g)
    M.y = y
    return y, g
end

function __descent_dir!(M::BFGS)
    mul!(M.d, M.invH, M.gpre, -1, 0)
    return M.d
end

function step!(optfn!::F, M::BFGS; constrain_step::S=infstep) where {F,S}
    #=
    argument and gradient from the end of the last
    iteration are stored into `xpre` and `gpre`
    =#
    M.gpre, M.g = M.g, M.gpre
    M.xpre, M.x = M.x, M.xpre
    M.ypre = M.y

    x, xpre, g, gpre, invH = M.x, M.xpre, M.g, M.gpre, M.invH
    d = __descent_dir!(M)
    maxstep = constrain_step(xpre, d)
    α = strong_backtracking!(optfn!, xpre, d, M.ypre, gpre, αmax = maxstep, β = 0.01, σ = 0.9)
    if α > 0
        #=
        BFGS update:
                δγ'B + Bγδ'   ⌈    γ'Bγ ⌉ δδ'
        B <- B - ---------- + |1 + -----| ---
                    δ'γ       ⌊     δ'γ ⌋ δ'γ
        =#
        δ, γ = M.xdiff, M.gdiff
        map!(-, γ, g, gpre)
        map!(-, δ, x, xpre)
        denom = dot(δ, γ)
        δscale = 1 + dot(γ, invH, γ) / denom
        # d <- B * γ
        mul!(d, invH, γ, 1, 0)
        invH .= invH .- (δ .* d' .+ d .* δ') ./ denom .+ δscale .* δ .* δ' ./ denom
    else
        fill!(M.xdiff, 0)
    end
    return α
end

@inline function __update_arg!(M::BFGS, x, α, d)
    map!(M.x, d, x) do a, b
        muladd(α, a, b)
    end
    return M.x
end

@inline function __update_arg!(M::BFGS, x)
    if x !== M.x
        copy!(M.x, x)
    end
    return M.x
end

@inline function __update_grad!(M::BFGS, g)
    if M.g !== g
        copy!(M.g, g)
    end
    return M.g
end


text:
function secret_handshake(code)
    mask = 1
    ans = String[]
    for (index, value) in enumerate(("wink", "double blink", "close your eyes", "jump"))
        if (code & mask << (index - 1)) != 0
            push!(ans, value)
        end
    end
    if (code & mask << 4) != 0
        reverse!(ans)
    end
    ans
end

function secret_handshake3(code::Integer)
    handshake = String[]
    (code >> 0) & 1 == 1 && push!(handshake, "wink")
    (code >> 1) & 1 == 1 && push!(handshake, "double blink")
    (code >> 2) & 1 == 1 && push!(handshake, "close your eyes")
    (code >> 3) & 1 == 1 && push!(handshake, "jump")
    (code >> 4) & 1 == 1 && reverse!(handshake)
    return handshake
end

max_stars_repo_name: vladflore/exercism

max_issues_repo_name: vladflore/exercism

max_forks_repo_name: vladflore/exercism


text:
using StagedFilters
using Test

using PyCall, BenchmarkTools;
data = convert.(Float64,collect(range(1,1000,length=1000)));
smoothed = zeros(eltype(data),length(data)); # <--- wholesome, type stable code.
savgol = pyimport("scipy.signal")."savgol_filter";
x = PyObject(data);
benchjl64 = @btime smooth!(SavitzkyGolayFilter{2,2}, data, smoothed);
benchpy64 = @btime $savgol($x,5,2,mode="wrap");

data = convert.(Float32,collect(range(1,1000,length=1000)));
smoothed = zeros(eltype(data),length(data)); # <--- wholesome, type stable$
savgol = pyimport("scipy.signal")."savgol_filter";
x = PyObject(data);
benchjl32 = @btime smooth!(SavitzkyGolayFilter{2,2}, data, smoothed);
benchpy32 = @btime $savgol($x,5,2,mode="wrap");
@testset "Correctness" begin
    @test benchpy64 ≈ benchjl64
    @test benchpy32 ≈ benchjl32
end


text:
function drag_clock(cur_player::AbstractPlayer)

  cur_uuid = UUIDs.uuid4()

  cur_player.clock.drag = cur_uuid

  @async while check_clock(cur_player)

    sleep(4)

    isnull( cur_player.clock.drag ) && break

    ( cur_player.clock.drag == cur_uuid ) || break

    glue_piece!(cur_player)
    break

  end

end


text:
# load the data from file with a schema
sloadjdf_v1(indir; verbose = false) = begin
	metadatas = deserialize(joinpath(indir,"metadata.jls"))

    df = DataFrame()

	# get the maximum number of bytes needs to read
	bytes_needed = maximum(get_bytes.(metadatas.metadatas))

	# rate limit channel
	results = Vector{Any}(undef, length(metadatas.names))

	i = 1
    for (name, metadata) in zip(metadatas.names, metadatas.metadatas)
		results[i] = begin
			io = BufferedInputStream(open(joinpath(indir,string(name)), "r"))
			new_result = column_loader(metadata.type, io, metadata)
			close(io)
			(name = name, task = new_result)
		end
		i+=1
    end

	# run this serially
	for result in results
		if verbose
			println("Extracting $(result.name)")
		end

		new_result = result.task
		colname = result.name
		if new_result == nothing
			df[!, colname] = Vector{Missing}(missing, metadatas.rows)
		else
			df[!, colname] = new_result
		end
	end
 	df
end

loadjdf_v1(indir; verbose = false) = begin
	if VERSION < v"1.3.0-rc1.0"
		return sloadjdf(indir, verbose = verbose)
	end

	if verbose
		println("loading $indir in parallel")
	end

	metadatas = deserialize(joinpath(indir,"metadata.jls"))

    df = DataFrame()

	# get the maximum number of bytes needs to read
	bytes_needed = maximum(get_bytes.(metadatas.metadatas))

	# rate limit channel
	c1 = Channel{Bool}(Threads.nthreads())
	atexit(()->close(c1))

	results = Vector{Any}(undef, length(metadatas.names))

	i = 1
    for (name, metadata) in zip(metadatas.names, metadatas.metadatas)
		put!(c1, true)
		results[i] = @spawn begin
			io = BufferedInputStream(open(joinpath(indir,string(name)), "r"))
			new_result = column_loader(metadata.type, io, metadata)
			close(io)
			(name = name, task = new_result)
		end
		take!(c1)
		i+=1
    end

	# run this serially
	for result in results
		if verbose
			println("Extracting $(result.name)")
		end

		new_result = fetch(result).task
		colname = fetch(result).name
		if new_result == nothing
			df[!, colname] = Vector{Missing}(missing, metadatas.rows)
		else
			df[!, colname] = new_result
		end
	end
 	df
end