text:
include("SortSparse.jl")
using Distributed
using DistributedArrays
using LinearAlgebra
using IntelVectorMath

#Assumes that the values of y are already written into the buffer.
#They will be overwritten during the execution of the function
function predictSkeleton!( μ, σ, L, B, y, α, β, γ, δ, ℓ, skel, Kij!, ITest )
    NTest = length(ITest)
    NTrain = length(skel.children)
    # We are using reverse ordering during this function
    reverse!(skel.parents)
    reverse!(skel.children)
    reverse!(y)

    Kij!(L, skel.children, skel.children)

    # Compute the cholesky factor of the sub-covariance matrix
    L = cholesky!(Hermitian(L)).L

    # Compute B
    Kij!(B, skel.children, ITest)

    # Compute the intermediate quantities that use inner products for the
    # First value of k.
    # They will be updated by substracting the corresponding columns for the different
    # k
    ldiv!(L, B)
    ldiv!(L, y)
    # Should not be necessary but presently mapreduce seems to allocate excessive amounts of memory
    for j = 1 : NTest
        for i = 1 : NTrain
            α[j] += y[i] * B[i,j]
            β[j] += B[i,j]^2
        end
    end

    old_k = length(skel.children)
    for k_par = length(skel.parents) : -1 : 1
        k = findlast(x -> x == skel.parents[k_par],
            skel.children)

        for l = (k + 1) : (old_k)
            for j = 1 : NTest
                α[j] -= y[l] * B[l,j]
                β[j] -= B[l,j]^2
            end
        end
        for j = 1 : NTest
            γ[j] = sqrt(one(eltype(γ)) + (B[k,j])^2 / (δ[j] - β[j]))
        end

        for j = 1 : NTest
            ℓ[j] = - B[k,j] * (one(eltype(ℓ)) + β[j] / (δ[j] - β[j])) / δ[j] / γ[j]
        end

        for j = 1 : NTest
            μ[j] += ℓ[j] / γ[j] * (y[k] + B[k,j] * α[j] / (δ[j] - β[j]))
        end
        @. σ += ℓ^2
        old_k = k
    end

    # We are reverting the reversion, for now, to not interfere with parts of the
    # code that might require the original ordering.
    reverse!(skel.parents)
    reverse!(skel.children)
end

# Strangely slow
function predict_threaded(skeletons::Vector{Skeleton{Ti}}, ITest::AbstractVector{Ti}, yTrain, Kij!) where {Ti}
    # Computing the required size of the buffers
    maxChildren = maximum(length.( getfield.(skeletons, :children)))
    maxParents = maximum(length.( getfield.(skeletons, :parents)))
    NTest = length(ITest)
    NTrain = sum( length.(getfield.(skeletons, :parents)))

    δ = Vector{Float64}(undef, NTest)

    # Defining Buffers
    LBuffers =  Vector{Vector{Float64}}(undef, Threads.nthreads())
    BBuffers =  Vector{Vector{Float64}}(undef, Threads.nthreads())
    yBuffers =  Vector{Vector{Float64}}(undef, Threads.nthreads())
    αs =  Vector{Vector{Float64}}(undef, Threads.nthreads())
    βs =  Vector{Vector{Float64}}(undef, Threads.nthreads())
    γs =  Vector{Vector{Float64}}(undef, Threads.nthreads())
    ℓs =  Vector{Vector{Float64}}(undef, Threads.nthreads())
    μs =  Vector{Vector{Float64}}(undef, Threads.nthreads())
    σs =  Vector{Vector{Float64}}(undef, Threads.nthreads())

    # Preallocating buffers
    for k = 1 : Threads.nthreads()
        LBuffers[k] = Vector{Float64}(undef, maxChildren^2)
        BBuffers[k] = Vector{Float64}(undef, maxChildren * NTest)
        yBuffers[k] = Vector{Float64}(undef, maxChildren)
        αs[k] = Vector{Float64}(undef, NTest)
        βs[k] = Vector{Float64}(undef, NTest)
        γs[k] = Vector{Float64}(undef, NTest)
        ℓs[k] = Vector{Float64}(undef, NTest)
        μs[k] = zeros(NTest)
        σs[k] = zeros(NTest)
    end

    # A little cumbersome since VML.jl doesn't like subarrays
    tmp = Vector{Float64}(undef, 1)
    for i = 1 : NTest
        Kij!(tmp, ITest[i:i], ITest[i:i])
        δ[i] = tmp[1]
    end

    LinearAlgebra.BLAS.set_num_threads(1)

    println("Multithreaded")

    Threads.@threads for k_skel = 1 : length(skeletons)
        skel = skeletons[k_skel]
        k = Threads.threadid()
        nChildren = length(skel.children)
        # Setting up the outputs:
        L = unsafe_wrap(Array{Float64,2}, pointer(LBuffers[k]), (nChildren, nChildren))
        B = unsafe_wrap(Array{Float64,2}, pointer(BBuffers[k]), (nChildren, NTest))
        y = unsafe_wrap(Array{Float64,1}, pointer(yBuffers[k]), nChildren)
        y .= yTrain[skel.children]
        αs[k] .= 0.0
        βs[k] .= 0.0
        γs[k] .= 0.0
        ℓs[k] .= 0.0

        # Do the prediction using the io variables defined above
        predictSkeleton!(μs[k], σs[k], L, B, y, αs[k], βs[k], γs[k], δ, ℓs[k], skel, Kij!, ITest)
    end

    μ = sum(μs)
    σ = sum(σs)

    @. σ .+= 1. / δ
    @. σ = 1. / σ
    @. μ = - σ * μ
    return μ, σ
end

function predict(skeletons::Vector{Skeleton{Ti}}, ITest::AbstractVector{Ti}, yTrain, Kij!) where {Ti}
    # Computing the required size of the buffers
    maxChildren = maximum(length.( getfield.(skeletons, :children)))
    maxParents = maximum(length.( getfield.(skeletons, :parents)))
    NTest = length(ITest)
    NTrain = sum( length.(getfield.(skeletons, :parents)))

    μ = zeros(NTest)
    σ = zeros(NTest)

    #Preallocating buffers
    LBuffer = Vector{Float64}(undef, maxChildren^2)
    BBuffer = Vector{Float64}(undef, maxChildren * NTest)
    yBuffer = Vector{Float64}(undef, maxChildren)
    α = Vector{Float64}(undef, NTest)
    β = Vector{Float64}(undef, NTest)
    γ = Vector{Float64}(undef, NTest)
    δ = Vector{Float64}(undef, NTest)
    ℓ = Vector{Float64}(undef, NTest)

    # A little cumbersome since VML.jl doesn't like subarrays
    tmp = Vector{Float64}(undef, 1)
    for i = 1 : NTest
        Kij!(tmp, ITest[i:i], ITest[i:i])
        δ[i] = tmp[1]
    end

    @. σ .= 1. / δ

    for skel in skeletons
        nChildren = length(skel.children)
        # Setting up the outputs:
        L = unsafe_wrap(Array{Float64,2}, pointer(LBuffer), (nChildren, nChildren))
        B = unsafe_wrap(Array{Float64,2}, pointer(BBuffer), (nChildren, NTest))
        y = unsafe_wrap(Array{Float64,1}, pointer(yBuffer), nChildren)
        y .= yTrain[skel.children]
        α .= 0.0
        β .= 0.0
        γ .= 0.0
        ℓ .= 0.0

        # Do the prediction using the io variables defined above
        predictSkeleton!(μ, σ, L, B, y, α, β, γ, δ, ℓ, skel, Kij!, ITest)
    end

    @. σ = 1. / σ
    @. μ = - σ * μ
    return μ, σ
end

function predict_distributed( skeletons::Vector{Skeleton{Ti}}, ITest, yTrain, Kij!, chunksize=Ti(20) ) where {Ti}
    NTest = length(ITest)
    # μ = Vector{Float64}(undef, NTest)
    # σ = Vector{Float64}(undef, NTest)
    δ = Vector{Float64}(undef, NTest)

    # A little cumbersome since VML.jl doesn't like subarrays
    tmp = Vector{Float64}(undef, 1)
    for i = 1 : NTest
        Kij!(tmp, ITest[i:i], ITest[i:i])
        δ[i] = tmp[1]
    end
    # σ .= 0

    # @. σ .= 1. / δ

    # @show δ
    # return 0.0

    @everywhere include("./src/KoLesky.jl")
    @everywhere include("./src/SortSparse.jl")

    partitionSkeletons(quadcube, skeletons, chunksize)
    μ::Vector{Float64}, σ::Vector{Float64} = @sync @distributed (+) for skels in distribute(partitionSkeletons(quadcube, skeletons, chunksize))
        maxChildren = maximum(length.( getfield.(skels, :children)))
        maxParents = maximum(length.( getfield.(skels, :parents)))
        NTrain = sum( length.(getfield.(skels, :parents)))

        μLocal = zeros(NTest)
        σLocal = zeros(NTest)

        #Preallocating buffers
        LBuffer = Vector{Float64}(undef, maxChildren^2)
        BBuffer = Vector{Float64}(undef, maxChildren * NTest)
        yBuffer = Vector{Float64}(undef, maxChildren)
        α = Vector{Float64}(undef, NTest)
        β = Vector{Float64}(undef, NTest)
        γ = Vector{Float64}(undef, NTest)
        ℓ = Vector{Float64}(undef, NTest)

        μloc = zeros(NTest)
        σloc = zeros(NTest)
        for skel in skels
            nChildren = length(skel.children)
            # Setting up the outputs:
            L = unsafe_wrap(Array{Float64,2}, pointer(LBuffer), (nChildren, nChildren))
            B = unsafe_wrap(Array{Float64,2}, pointer(BBuffer), (nChildren, NTest))
            y = unsafe_wrap(Array{Float64,1}, pointer(yBuffer), nChildren)
            y .= yTrain[skel.children]
            α .= 0.0
            β .= 0.0
            γ .= 0.0
            ℓ .= 0.0

            # Do the prediction using the io variables defined above
            predictSkeleton!(μloc, σloc, L, B, y, α, β, γ, δ, ℓ, skel, Kij!, ITest)
        end
        [μloc, σloc]
    end

    @. σ += 1. / δ
    @. σ = 1. / σ
    @. μ = - σ * μ
    return μ, σ
end

function predict(skeletons::Vector{Skeleton{Ti}}, ITest, yTrain, x::AbstractArray, cov!, σ=zeros(size(x,2))) where {Ti}

    # A function that fills a matrix with the entries of the covariance matrix corresponding to a given set of indices
    function Kij!(Out::AbstractArray, I::AbstractVector, J::AbstractVector)
        @fastmath @inbounds for (indI, i) ∈ enumerate(I)
            for (indJ, j) ∈ enumerate(J)
                Out[indI, indJ] = zero(eltype(x))
                for d = 1 : size(x,1)
                    Out[indI, indJ] += (x[d,i] - x[d,j])^2
                end
            end
        end
        #compute covariance function
        cov!(IntelVectorMath.sqrt!(Out))

        @fastmath @inbounds for (indI, i) ∈ enumerate(I)
            for (indJ, j) ∈ enumerate(J)
                if i == j
                    Out[indI, indJ] += σ[i]
                end
            end
        end
    end

    return μ, σ = predict_distributed(skeletons, ITest, yTrain, Kij!, 100)
    # return μ, σ = predict(skeletons, ITest, yTrain, Kij!)
end

# a function that generates a sparse matrix with the sparsity pattern corresponding to a vector of skeletons
function assembleL(skeletons::Vector{Skeleton{Ti}}) where {Ti}
    IJ = [ij for s in skeletons for ij in (Iterators.product(s.children, s.parents))]
    IJ = filter(ij -> ij[1] >= ij[2], IJ)
    I = getindex.(IJ,1)
    J = getindex.(IJ,2)
    return(sparse(I, J, zeros(length(I))))
end

function assembleLSkeleton!(U, B, skel, Kij!)
    # We are using reverse ordering during this function
    reverse!(skel.parents)
    reverse!(skel.children)
    Kij!(U, skel.children, skel.children)
    # Compute the cholesky factor of the sub-covariance matrix

    U = cholesky!(Hermitian(U)).U

    # We are reverting the reversion, for now, to not interfere with parts of the
    # code that might require the original ordering.

    # Computes the leading k columns of the inverse of L
    B .= 0.0
    for (i, par) in enumerate(skel.parents)
        B[findlast(x -> x == par, skel.children), i] = 1.0
    end
    # B .= U \ B
    ldiv!(U, B)

    reverse!(vec(B))
    reverse!(skel.parents)
    reverse!(skel.children)
end

function assembleL(skeletons::Vector{Skeleton{Ti}}, x::AbstractArray, cov!, σ=zeros(size(x, 2))) where {Ti}
    # A function that fills a matrix with the entries of the covariance matrix corresponding to a given set of indices
    function Kij!(Out::AbstractArray, I::AbstractVector, J::AbstractVector)
        @fastmath @inbounds for (indI, i) ∈ enumerate(I)
            for (indJ, j) ∈ enumerate(J)
                Out[indI, indJ] = zero(eltype(x))
                for d = 1 : size(x,1)
                    Out[indI, indJ] += (x[d,i] - x[d,j])^2
                end
            end
        end

        #compute covariance function
        cov!(IntelVectorMath.sqrt!(Out))

        @fastmath @inbounds for (indI, i) ∈ enumerate(I)
            for (indJ, j) ∈ enumerate(J)
                if i == j
                    Out[indI, indJ] += σ[i]
                end
            end
        end
    end

    # Computing the required size of the buffers
    maxChildren = maximum(length.( getfield.(skeletons, :children)))
    maxParents = maximum(length.( getfield.(skeletons, :parents)))

    # Preallocating output (slightly excessive ram usage since only approximately lower triangular)
    maxEntries = sum([length(s.children) * length(s.parents) for s in skeletons])
    I = Vector{Ti}(undef, maxEntries)
    J = Vector{Ti}(undef, maxEntries)
    S = Vector{Float64}(undef, maxEntries)
    offset = 0

    #Preallocating buffers
    LBuffer = Vector{Float64}(undef, maxChildren^2)
    BBuffer = Vector{Float64}(undef, maxChildren * maxParents)

    for skel in skeletons
        nChildren = length(skel.children)
        nParents = length(skel.parents)
        # Setting up the outputs:
        L = unsafe_wrap(Array{Float64,2}, pointer(LBuffer), (nChildren, nChildren))
        B = unsafe_wrap(Array{Float64,2}, pointer(BBuffer), (nChildren, nParents))

        # Do the prediction using the io variables defined above
        assembleLSkeleton!(L, B, skel, Kij!)
        for (l, tup) in enumerate(Iterators.product(skel.children, skel.parents))
            I[offset + l] = tup[1]
            J[offset + l] = tup[2]
            S[offset + l] = B[l]
        end
        offset += nChildren * nParents
    end

    # Selecting the lower triangular part
    inds = findall(I .>= J)
    I, J, S = I[inds], J[inds], S[inds]

    # Construct sparse matrix and return
    return sparse(I,J,S)
end


text:
function _precompile_()
    ccall(:jl_generating_output, Cint, ()) == 1 || return nothing
    normedtypes = (N0f8, N0f16)                      # precompiled Normed types
    realtypes = (Float16, Float32, Float64, Int)     # types for mixed Normed/Real operations
    for T in normedtypes
        for f in (+, -, abs, eps, rand)       # unary operations
            precompile(Tuple{typeof(f),T})
        end
        precompile(Tuple{typeof(rand),T,Tuple{Int}})
        precompile(Tuple{typeof(rand),T,Tuple{Int,Int}})
        for f in (trunc, floor, ceil, round)  # rounding operations
            precompile(Tuple{typeof(f),T})
            precompile(Tuple{typeof(f),Type{Int},T})
        end
        for f in (+, -, *, /, <, <=, ==)      # binary operations
            precompile(Tuple{typeof(f),T,T})
            for S in realtypes
                precompile(Tuple{typeof(f),T,S})
                precompile(Tuple{typeof(f),S,T})
            end
        end
        # conversions
        for S in realtypes
            precompile(Tuple{Type{T},S})
            precompile(Tuple{Type{S},T})
            precompile(Tuple{typeof(convert),Type{T},S})
            precompile(Tuple{typeof(convert),Type{S},T})
        end
    end
end

ext: jl


text:
# Test the random variable macro with complex input
@randomvariable(m2, xs[i = 1:5], mean = 0)
means = ones(4)
@randomvariable(m2, x2s[i = 1:4], mean = means[i])
@randomvariable(m2, x3s[i = 1:3, j = 1:2], mean = 42)
means2 = ones(4, 4)
@randomvariable(m2, x4s[i = 1:4, j = 1:4], mean = means2[i, j])

# Check the recourse variable macro with vector and array
@recoursevariable(m2, ys[1:3])
@recoursevariable(m2, y2s[1:5, 1:6])

# Check the base JuMP macro
@variable(m2, zs[1:2])
@variable(m2, z2s[1:3, 1:5])
true


text:
"Tracks the completion and status of a kernel's execution."
mutable struct HSAStatusSignal
    signal::HSASignal
    exe::HSAExecutable
    queue::HSAQueue
    done::Base.Event
    exception::Union{Exception,Nothing}
    function HSAStatusSignal(signal::HSASignal, exe::HSAExecutable, queue::HSAQueue; kwargs...)
        signal = new(signal, exe, queue, Base.Event(), nothing)
        @async try
            _wait(signal; kwargs...) # the real waiter
        catch err
            signal.exception = err
            notify(signal.done)
        end
        signal
    end
end

function Base.show(io::IO, signal::HSAStatusSignal)
    ex = signal.exception
    print(io, "HSAStatusSignal(signal=$(signal.signal), done=$(signal.done.set)$(ex !== nothing ? ", exception=$ex" : ""))")
end

function Base.wait(signal::HSAStatusSignal)
    wait(signal.done)
    ex = signal.exception
    if ex !== nothing
        throw(ex)
    end
end
function _wait(signal::HSAStatusSignal; check_exceptions=true, cleanup=true, kwargs...)
    wait(signal.signal; kwargs...) # wait for completion signal
    unpreserve!(signal) # allow kernel-associated objects to be freed
    exe = signal.exe::HSAExecutable{Mem.Buffer}
    mod = EXE_TO_MODULE_MAP[exe].value
    agent = exe.agent
    ex = nothing
    signal_handle = (signal.signal.signal[]::HSA.Signal).handle
    if haskey(exe.globals, :__global_exception_flag)
        # Check if any wavefront for this kernel threw an exception
        ex_flag = get_global(exe, :__global_exception_flag)
        ex_flag_ptr = Base.unsafe_convert(Ptr{Int64}, ex_flag)
        ex_flag_value = Base.unsafe_load(ex_flag_ptr)
        if ex_flag_value != 0
            ex_strings = String[]
            if check_exceptions && haskey(exe.globals, :__global_exception_ring)
                # Check for and collect any exceptions, and clear their slots
                ex_ring = get_global(exe, :__global_exception_ring)
                ex_ring_ptr_ptr = Base.unsafe_convert(Ptr{Ptr{ExceptionEntry}}, ex_ring)
                ex_ring_ptr = unsafe_load(ex_ring_ptr_ptr)
                while (ex_ring_value = unsafe_load(ex_ring_ptr)).kern != 1
                    if ex_ring_value.kern == signal_handle
                        push!(ex_strings, unsafe_string(reinterpret(Ptr{UInt8}, ex_ring_value.ptr)))
                        # FIXME: Write rest of entry first, then CAS 0 to kern field
                        unsafe_store!(ex_ring_ptr, ExceptionEntry(UInt64(0), LLVMPtr{UInt8,1}(0)))
                    end
                    ex_ring_ptr += sizeof(ExceptionEntry)
                end
            end
            unique!(ex_strings)
            ex = KernelException(agent, isempty(ex_strings) ? nothing : join(ex_strings, '\n'))
        end
    end
    if cleanup
        # Clean-up malloc'd data
        for idx in length(mod.metadata):-1:1
            metadata_value = mod.metadata[idx]
            if metadata_value.kern == signal_handle
                @debug "Cleaning up data: $metadata_value"
                Mem.free(metadata_value.buf)
                deleteat!(mod.metadata, idx)
            end
        end
    end
    if ex !== nothing
        signal.exception = ex
    end
    lock(RT_LOCK) do
        if haskey(_active_kernels, signal.queue) # The queue might be dead
            deleteat!(_active_kernels[signal.queue], findall(x->x==signal, _active_kernels[signal.queue]))
        end
    end
    notify(signal.done)
end
Base.notify(signal::HSAStatusSignal) = notify(signal.signal)
barrier_and!(queue, signals::Vector{HSAStatusSignal}) = barrier_and!(queue, map(x->x.signal,signals))
barrier_or!(queue, signals::Vector{HSAStatusSignal}) = barrier_or!(queue, map(x->x.signal,signals))


text:
# This file is part of Kpax3. License is MIT.

#=
References:

Tajima F. and Nei M. (1984). Estimation of evolutionary distance between
nucleotide sequences. Mol Biol Evol 1 (3):269-285.
http://mbe.oxfordjournals.org/content/1/3/269

Tamura K. and Kumar S. (2002). Evolutionary Distance Estimation Under
Heterogeneous Substitution Pattern Among Lineages. Mol Biol Evol 19 (10):
1727-1736. http://mbe.oxfordjournals.org/content/19/10/1727
=#

#=
Description:

Compute Tajima Nei (1984) pairwise distances of dna sequences.

Arguments:

  data::Matrix{UInt8}
    m-by-n data matrix, where m is the common sequence length and n is the
    sample size
  ref::Vector{UInt8}
    reference sequence, i.e. a vector of length m storing the values of
    homogeneous sites

Details:

Only the four basic nucleotides are considered in the computations. It is
expected that Uracil has a value of 4 (equal to Thymidine).

If a pairwise distance is equal to -1.0, it means that is wasn't possible to
compute it. This usually happens when the hypotheses of the underlying
evolutionary model are not satisfied.

Value:

  d::Vector{Float64}
    evolutionary distances. Vector length is equal to n * (n - 1) / 2. It
    contains the values of the lower triangular matrix of the full distance
    matrix, ordered by column.
    To access the distance between units i and j (i < j), use
    d[n * (i - 1) - div(i * (i - 1), 2) + j - i]
=#
function distnttn84(data::Matrix{UInt8},
                    ref::Vector{UInt8})
  (m, n) = size(data)

  d = zeros(Float64, div(n * (n - 1), 2))

  gt = zeros(Float64, 4)
  gb = zeros(Float64, 4)
  gp = zeros(Float64, 6)

  a = UInt8('a')
  c = UInt8('c')
  g = UInt8('g')
  t = UInt8('t')

  for j in 1:m
    if ref[j] == a
      gt[1] += 1
    elseif ref[j] == c
      gt[2] += 1
    elseif ref[j] == g
      gt[3] += 1
    elseif ref[j] == t
      gt[4] += 1
    end
  end

  for i in 1:n, j in 1:m
    if data[j, i] == a
      gb[1] += 1
    elseif data[j, i] == c
      gb[2] += 1
    elseif data[j, i] == g
      gb[3] += 1
    elseif data[j, i] == t
      gb[4] += 1
    end
  end

  gb[1] += n * gt[1]
  gb[2] += n * gt[2]
  gb[3] += n * gt[3]
  gb[4] += n * gt[4]

  tot = gb[1] + gb[2] + gb[3] + gb[4]

  gb[1] /= tot
  gb[2] /= tot
  gb[3] /= tot
  gb[4] /= tot

  h = gt[1] + gt[2] + gt[3] + gt[4]

  gp[1] = 2 * gb[1] * gb[2]
  gp[2] = 2 * gb[1] * gb[3]
  gp[3] = 2 * gb[1] * gb[4]
  gp[4] = 2 * gb[2] * gb[3]
  gp[5] = 2 * gb[2] * gb[4]
  gp[6] = 2 * gb[3] * gb[4]

  v = 1 - (gb[1]^2 + gb[2]^2 + gb[3]^2 + gb[4]^2)

  idx = 1
  for j in 1:(n - 1), i in (j + 1):n
    d[idx] = nttn84(i, j, data, gp, h, v)
    idx += 1
  end

  d
end

#=
Description:

Compute Tajima Nei (1984) pairwise distances of dna sequences, with the Tamura
and Kumar (2002) correction for heterogeneous patterns.

Arguments:

  data::Matrix{UInt8}
    m-by-n data matrix, where m is the common sequence length and n is the
    sample size
  ref::Vector{UInt8}
    reference sequence, i.e. a vector of length m storing the values of
    homogeneous sites

Details:

Only the four basic nucleotides are considered in the computations. It is
expected that Uracil has a value of 4 (equal to Thymidine).

If a pairwise distance is equal to -1.0, it means that is wasn't possible to
compute it. This usually happens when the hypotheses of the underlying
evolutionary model are not satisfied.

Value:

  d::Vector{Float64}
    evolutionary distances. Vector length is equal to n * (n - 1) / 2. It
    contains the values of the lower triangular matrix of the full distance
    matrix, ordered by column.
    To access the distance between units i and j (i < j), use
    d[n * (i - 1) - div(i * (i - 1), 2) + j - i]
=#
function distntmtn84(data::Matrix{UInt8},
                     ref::Vector{UInt8})
  (m, n) = size(data)

  d = zeros(Float64, div(n * (n - 1), 2))

  gt = zeros(Float64, 4)
  gb = zeros(Float64, 4)

  a = UInt8('a')
  c = UInt8('c')
  g = UInt8('g')
  t = UInt8('t')

  for j in 1:m
    if ref[j] == a
      gt[1] += 1
    elseif ref[j] == c
      gt[2] += 1
    elseif ref[j] == g
      gt[3] += 1
    elseif ref[j] == t
      gt[4] += 1
    end
  end

  for i in 1:n, j in 1:m
    if data[j, i] == a
      gb[1] += 1
    elseif data[j, i] == c
      gb[2] += 1
    elseif data[j, i] == g
      gb[3] += 1
    elseif data[j, i] == t
      gb[4] += 1
    end
  end

  gb[1] += n * gt[1]
  gb[2] += n * gt[2]
  gb[3] += n * gt[3]
  gb[4] += n * gt[4]

  tot = gb[1] + gb[2] + gb[3] + gb[4]

  gb[1] /= tot
  gb[2] /= tot
  gb[3] /= tot
  gb[4] /= tot

  h = gt[1] + gt[2] + gt[3] + gt[4]

  v = 1 - (gb[1]^2 + gb[2]^2 + gb[3]^2 + gb[4]^2)

  idx = 1
  for j in 1:(n - 1), i in (j + 1):n
    d[idx] = ntmtn84(i, j, data, gt, h, v)
    idx += 1
  end

  d
end

#=
Description:

Compute the Tajima Nei (1984) distance between two dna sequences.

Arguments:

  i::Int
    index of first sequence
  j::Int
    index of second sequence
  data::Matrix{UInt8}
    m-by-n data matrix, where m is the common sequence length and n is the
    sample size
  h::Float64
    total number of homogeneous sites that are not missing
  gp::Vector{Float64}
    proportions (probabilities) of nucleotide pairs computed on the whole
    dataset
  v::Float64
    v = 1 - sum(pi^2), where pi is the proportion of nucleotide i observed in
    the whole dataset

Value:

  d::Float64
    evolutionary distance between the two dna sequences
=#
function nttn84(i::Int,
                j::Int,
                data::Matrix{UInt8},
                gp::Vector{Float64},
                h::Float64,
                v::Float64)
  d = -1.0

  # proportion of different elements
  p = 0.0

  # proportion of nucleotide pairs
  pn = zeros(Float64, 6)

  w = 0.0
  x = 0.0
  z = 0.0

  x1 = 0x00
  x2 = 0x00

  a = UInt8('a')
  c = UInt8('c')
  g = UInt8('g')
  t = UInt8('t')

  for b in 1:size(data, 1)
    x1 = data[b, i]
    x2 = data[b, j]

    if (x1 == a || x1 == c || x1 == g || x1 == t) &&
       (x2 == a || x2 == c || x2 == g || x2 == t)
      if x1 != x2
        p += 1

        if     ((x1 == a) && (x2 == c)) || ((x1 == c) && (x2 == a))
          pn[1] += 1
        elseif ((x1 == a) && (x2 == g)) || ((x1 == g) && (x2 == a))
          pn[2] += 1
        elseif ((x1 == a) && (x2 == t)) || ((x1 == t) && (x2 == a))
          pn[3] += 1
        elseif ((x1 == c) && (x2 == g)) || ((x1 == g) && (x2 == c))
          pn[4] += 1
        elseif ((x1 == c) && (x2 == t)) || ((x1 == t) && (x2 == c))
          pn[5] += 1
        elseif ((x1 == g) && (x2 == t)) || ((x1 == t) && (x2 == g))
          pn[6] += 1
        end
      end

      h += 1
    end
  end

  if p > 0
    p /= h
    pn /= h

    z = pn[1]^2 / gp[1] + pn[2]^2 / gp[2] + pn[3]^2 / gp[3] +
        pn[4]^2 / gp[4] + pn[5]^2 / gp[5] + pn[6]^2 / gp[6]

    x = (v + p^2 / z) / 2

    w = 1 - p / x

    if w > 0
      d = - x * log(w)
    end
  else
    # sequences are identical (or couldn't be compared because of missing
    # values. But in this case, by default, we consider them identical)
    d = 0.0
  end

  d
end

#=
Description:

Compute the Tajima Nei (1984) distance between two dna sequences, with the
Tamura and Kumar (2002) correction for heterogeneous patterns.

Arguments:

  i::Int
    index of first sequence
  j::Int
    index of second sequence
  data::Matrix{UInt8}
    m-by-n data matrix, where m is the common sequence length and n is the
    sample size
  gt::Vector{Float64}
    common absolute frequency for the 4 nucleotides, i.e. the count of each
    nucleotide at homogeneous sites
  h::Float64
    total number of homogeneous sites that are not missing
  v::Float64
    v = 1 - sum(pi^2), where pi is the proportion of nucleotide i observed in
    the whole dataset

Value:

  d::Float64
    evolutionary distance between the two dna sequences
=#
function ntmtn84(i::Int,
                 j::Int,
                 data::Matrix{UInt8},
                 gt::Vector{Float64},
                 h::Float64,
                 v::Float64)
  d = -1.0

  # effective length, i.e. total number of sites at which both sequences have
  # non-missing values
  n = fill(h, 3)

  # proportion of different elements
  p = 0.0

  # proportion of observed nucleotides
  g1 = copy(gt)
  g2 = copy(gt)

  f = 0.0
  w = 0.0

  x1 = 0x00
  x2 = 0x00

  a = UInt8('a')
  c = UInt8('c')
  g = UInt8('g')
  t = UInt8('t')

  for b in 1:size(data, 1)
    x1 = data[b, i]
    x2 = data[b, j]

    if (x1 == a || x1 == c || x1 == g || x1 == t)
      g1[x1] += 1
      n[1] += 1
    end

    if (x2 == a || x2 == c || x2 == g || x2 == t)
      g2[x2] += 1
      n[2] += 1
    end

    if (x1 == a || x1 == c || x1 == g || x1 == t) &&
       (x2 == a || x2 == c || x2 == g || x2 == t)
      if x1 != x2
        p += 1
      end

      n[3] += 1
    end
  end

  if p > 0
    g1 /= n[1]
    g2 /= n[2]

    p /= n[3]

    f = 1 - (g1[1] * g2[1] + g1[2] * g2[2] + g1[3] * g2[3] + g1[4] * g2[4])
    w = 1 - p / f

    if w > 0
      d = - v * log(w)
    end
  else
    # sequences are identical (or couldn't be compared because of missing
    # values. But in this case, by default, we consider them identical)
    d = 0.0
  end

  d
end


text:
countries = readcsv("countries.csv")
splitted_names = filter(x -> length(x) > 0, split.(countries[2:end,2]))
splitted_names = map(x -> lowercase.(x), splitted_names)

open("80.py.out") do f
    for line in readlines(f)
        if length(line) < 1
            continue
        end
        words = filter(x -> !isempty(x), lowercase.(split(line[1:end])))
        newwords = String[]
        idx = 1
        while idx < length(words)
            word = words[idx]
            found = false
            for c in splitted_names
                cl = length(c)
                if idx + cl - 1 >= length(words)
                    break
                end
                if length(c) > 1 && words[idx:idx+cl-1] == c
                    push!(newwords, join(c, "_"))
                    idx = idx + cl
                    found = true
                end
            end
            if !found
                idx += 1
                push!(newwords, word)
            end
        end

        words = newwords
        if length(words) > 0
            for token in words
                print(token, " ")
            end
            println("")
        end
    end
end


text:
# This file was generated by the Julia Swagger Code Generator
# Do not modify this file directly. Modify the swagger specification instead.

mutable struct IoK8sApiAutoscalingV2beta2HorizontalPodAutoscaler <: SwaggerModel
    apiVersion::Any # spec type: Union{ Nothing, String } # spec name: apiVersion
    kind::Any # spec type: Union{ Nothing, String } # spec name: kind
    metadata::Any # spec type: Union{ Nothing, IoK8sApimachineryPkgApisMetaV1ObjectMeta } # spec name: metadata
    spec::Any # spec type: Union{ Nothing, IoK8sApiAutoscalingV2beta2HorizontalPodAutoscalerSpec } # spec name: spec
    status::Any # spec type: Union{ Nothing, IoK8sApiAutoscalingV2beta2HorizontalPodAutoscalerStatus } # spec name: status

    function IoK8sApiAutoscalingV2beta2HorizontalPodAutoscaler(;apiVersion=nothing, kind=nothing, metadata=nothing, spec=nothing, status=nothing)
        o = new()
        validate_property(IoK8sApiAutoscalingV2beta2HorizontalPodAutoscaler, Symbol("apiVersion"), apiVersion)
        setfield!(o, Symbol("apiVersion"), apiVersion)
        validate_property(IoK8sApiAutoscalingV2beta2HorizontalPodAutoscaler, Symbol("kind"), kind)
        setfield!(o, Symbol("kind"), kind)
        validate_property(IoK8sApiAutoscalingV2beta2HorizontalPodAutoscaler, Symbol("metadata"), metadata)
        setfield!(o, Symbol("metadata"), metadata)
        validate_property(IoK8sApiAutoscalingV2beta2HorizontalPodAutoscaler, Symbol("spec"), spec)
        setfield!(o, Symbol("spec"), spec)
        validate_property(IoK8sApiAutoscalingV2beta2HorizontalPodAutoscaler, Symbol("status"), status)
        setfield!(o, Symbol("status"), status)
        o
    end
end # type IoK8sApiAutoscalingV2beta2HorizontalPodAutoscaler

const _property_map_IoK8sApiAutoscalingV2beta2HorizontalPodAutoscaler = Dict{Symbol,Symbol}(Symbol("apiVersion")=>Symbol("apiVersion"), Symbol("kind")=>Symbol("kind"), Symbol("metadata")=>Symbol("metadata"), Symbol("spec")=>Symbol("spec"), Symbol("status")=>Symbol("status"))
const _property_types_IoK8sApiAutoscalingV2beta2HorizontalPodAutoscaler = Dict{Symbol,String}(Symbol("apiVersion")=>"String", Symbol("kind")=>"String", Symbol("metadata")=>"IoK8sApimachineryPkgApisMetaV1ObjectMeta", Symbol("spec")=>"IoK8sApiAutoscalingV2beta2HorizontalPodAutoscalerSpec", Symbol("status")=>"IoK8sApiAutoscalingV2beta2HorizontalPodAutoscalerStatus")
Base.propertynames(::Type{ IoK8sApiAutoscalingV2beta2HorizontalPodAutoscaler }) = collect(keys(_property_map_IoK8sApiAutoscalingV2beta2HorizontalPodAutoscaler))
Swagger.property_type(::Type{ IoK8sApiAutoscalingV2beta2HorizontalPodAutoscaler }, name::Symbol) = Union{Nothing,eval(Meta.parse(_property_types_IoK8sApiAutoscalingV2beta2HorizontalPodAutoscaler[name]))}
Swagger.field_name(::Type{ IoK8sApiAutoscalingV2beta2HorizontalPodAutoscaler }, property_name::Symbol) =  _property_map_IoK8sApiAutoscalingV2beta2HorizontalPodAutoscaler[property_name]

function check_required(o::IoK8sApiAutoscalingV2beta2HorizontalPodAutoscaler)
    true
end

function validate_property(::Type{ IoK8sApiAutoscalingV2beta2HorizontalPodAutoscaler }, name::Symbol, val)
end


text:
function massij(xi,zi,i,j,wi, int_polynomial)
	# to compute the mass matrix by quadrature,
	# we only need to compute the value of the
	# polynomials at point xi[j]!

	# xi has enough points for exactly interpolating
	# the polynomial given by the product of phi_i(x)*psi_j(x)

	# but phi_i(x) = 1 at xi[i] and 0 otherwise.
	# for this reason:
	return int_polynomial(xi[j],zi,i)*wi[j]
end

function massij(xi,zi,i,j,xquad, wquad, int_polynomial)
	# case where the collocation points are not Gauss-Legendre
	# an auxiliary set of quadrature points need to be evaluated
	# to compute the integral!
	mij = 0.;
	for k = 1:length(xquad)
		mij += int_polynomial(xquad[k],xi,j)*int_polynomial(xquad[k],zi,i)*wquad[k]
	end
	return mij
end

function massmatrix(N :: Integer ,a :: Number,b :: Number, order = 1)
	xi,wi = lgwt(N+order,a,b)
	if N > 1
		zi,wiz = lgwt(N,a,b)
	else
		zi,wiz = (a+b)/2, (b-a);
	end
	Mass = massmatrix(xi,zi,wi)
	Mass, wiz
end

function massmatrix(xi :: Array, zi :: Number, wi :: Array)
	massmatrix(xi, [zi], wi)
end

function massmatrix(xi :: Array, zi :: Array, wi :: Array, int_polynomial = leg_pol)
	Mass = zeros(length(zi),length(xi));
	for i = 1:length(zi)
		for j = 1:length(xi)
			mij = massij(xi,zi,i,j,wi, int_polynomial)
			Mass[i,j] = mij[1]
		end
	end
	Mass
end

function massmatrix(xi :: Array, zi :: Array, xquad :: Array, wquad :: Array, int_polynomial = leg_pol)
	Mass = zeros(length(zi),length(xi));
	for i = 1:length(zi)
		for j = 1:length(xi)
			mij = massij(xi,zi,i,j,xquad, wquad, int_polynomial)
			Mass[i,j] = mij
		end
	end
	Mass
end

function Q_partial(p :: Phs, a, b)
	xi = p.disc_data.flow.xi;
	N = length(xi);
	zi,wzi = lgwt(N*2,a,b);
	Q_parts = zeros(N,N);
	for i = 1:N
		for j = 1:N
			for k = 1:length(zi)
				Q_parts[i,j] += wzi[k]*leg_pol(zi[k],xi,i)*leg_pol(zi[k],xi,j)
			end
		end
	end
	return Q_parts
end

max_stars_repo_name: flavioluiz/phjulia

max_issues_repo_name: flavioluiz/phjulia

max_forks_repo_name: flavioluiz/phjulia


text:
@glfunc glGetNamedFramebufferParameterivEXT(framebuffer::GLuint, pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glDrawElementsInstancedBaseVertexBaseInstance(mode::GLenum, count::GLsizei, type_::GLenum, indices::Ptr{Cvoid}, instancecount::GLsizei, basevertex::GLint, baseinstance::GLuint)::Cvoid
@glfunc glReadBuffer(mode::GLenum)::Cvoid
@glfunc glBindBufferBase(target::GLenum, index::GLuint, buffer::GLuint)::Cvoid
@glfunc glClientWaitSync(sync::GLsync, flags::GLbitfield, timeout::GLuint64)::GLenum
@glfunc glGetIntegeri_v(target::GLenum, index::GLuint, data::Ptr{GLint})::Cvoid
@glfunc glTexCoordP2ui(type_::GLenum, coords::GLuint)::Cvoid
@glfunc glTexParameterIiv(target::GLenum, pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glVertexAttribI2iv(index::GLuint, v::Ptr{GLint})::Cvoid
@glfunc glProgramUniformMatrix4fv(program::GLuint, location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLfloat})::Cvoid
@glfunc glSamplerParameteri(sampler::GLuint, pname::GLenum, param::GLint)::Cvoid
@glfunc glStencilFuncSeparate(face::GLenum, func_::GLenum, ref::GLint, mask::GLuint)::Cvoid
@glfunc glResumeTransformFeedback()::Cvoid
@glfunc glProgramUniform1fv(program::GLuint, location::GLint, count::GLsizei, value::Ptr{GLfloat})::Cvoid
@glfunc glProgramUniform3uiv(program::GLuint, location::GLint, count::GLsizei, value::Ptr{GLuint})::Cvoid
@glfunc glUniform1d(location::GLint, x::GLdouble)::Cvoid
@glfunc glUniformMatrix2x4dv(location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLdouble})::Cvoid
@glfunc glFinish()::Cvoid
@glfunc glProgramUniformMatrix2x3fv(program::GLuint, location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLfloat})::Cvoid
@glfunc glClear(mask::GLbitfield)::Cvoid
@glfunc glBindTransformFeedback(target::GLenum, id::GLuint)::Cvoid
@glfunc glShaderSource(shader::GLuint, count::GLsizei, string_::Ptr{Ptr{GLchar}}, length::Ptr{GLint})::Cvoid
@glfunc glUniform2iv(location::GLint, count::GLsizei, value::Ptr{GLint})::Cvoid
@glfunc glBindTexture(target::GLenum, texture::GLuint)::Cvoid
@glfunc glDrawElementsIndirect(mode::GLenum, type_::GLenum, indirect::Ptr{Cvoid})::Cvoid
@glfunc glUniformMatrix3dv(location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLdouble})::Cvoid
@glfunc glGetSamplerParameterIiv(sampler::GLuint, pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glGetPointerv(pname::GLenum, params::Ptr{Ptr{Cvoid}})::Cvoid
@glfunc glReleaseShaderCompiler()::Cvoid
@glfunc glGetQueryObjectui64v(id::GLuint, pname::GLenum, params::Ptr{GLuint64})::Cvoid
@glfunc glVertexAttribDivisor(index::GLuint, divisor::GLuint)::Cvoid
@glfunc glVertexAttribP4ui(index::GLuint, type_::GLenum, normalized::GLboolean, value::GLuint)::Cvoid
@glfunc glDeleteProgram(program::GLuint)::Cvoid
@glfunc glSamplerParameterIuiv(sampler::GLuint, pname::GLenum, param::Ptr{GLuint})::Cvoid
@glfunc glGetProgramiv(program::GLuint, pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glUniform3dv(location::GLint, count::GLsizei, value::Ptr{GLdouble})::Cvoid
@glfunc glProgramUniform4fv(program::GLuint, location::GLint, count::GLsizei, value::Ptr{GLfloat})::Cvoid
@glfunc glDrawTransformFeedbackInstanced(mode::GLenum, id::GLuint, instancecount::GLsizei)::Cvoid
@glfunc glScissorArrayv(first::GLuint, count::GLsizei, v::Ptr{GLint})::Cvoid
@glfunc glGenerateMipmap(target::GLenum)::Cvoid
@glfunc glProgramUniform2dv(program::GLuint, location::GLint, count::GLsizei, value::Ptr{GLdouble})::Cvoid
@glfunc glUniform4d(location::GLint, x::GLdouble, y::GLdouble, z::GLdouble, w::GLdouble)::Cvoid
@glfunc glDeleteRenderbuffers(n::GLsizei, renderbuffers::Ptr{GLuint})::Cvoid
@glfunc glPopDebugGroup()::Cvoid
@glfunc glGetShaderSource(shader::GLuint, bufSize::GLsizei, length::Ptr{GLsizei}, source::Ptr{GLchar})::Cvoid
@glfunc glIsBuffer(buffer::GLuint)::Bool
@glfunc glGetAttachedShaders(program::GLuint, maxCount::GLsizei, count::Ptr{GLsizei}, obj::Ptr{GLuint})::Cvoid
@glfunc glVertexAttribI1uiv(index::GLuint, v::Ptr{GLuint})::Cvoid
@glfunc glMultiTexCoordP1ui(texture::GLenum, type_::GLenum, coords::GLuint)::Cvoid
@glfunc glTextureView(texture::GLuint, target::GLenum, origtexture::GLuint, internalformat::GLenum, minlevel::GLuint, numlevels::GLuint, minlayer::GLuint, numlayers::GLuint)::Cvoid
@glfunc glProgramUniform4uiv(program::GLuint, location::GLint, count::GLsizei, value::Ptr{GLuint})::Cvoid
@glfunc glSecondaryColorP3uiv(type_::GLenum, color::Ptr{GLuint})::Cvoid
@glfunc glQueryCounter(id::GLuint, target::GLenum)::Cvoid
@glfunc glTexStorage3DMultisample(target::GLenum, samples::GLsizei, internalformat::GLenum, width::GLsizei, height::GLsizei, depth::GLsizei, fixedsamplelocations::GLboolean)::Cvoid
@glfunc glDrawArraysIndirect(mode::GLenum, indirect::Ptr{Cvoid})::Cvoid
@glfunc glUniform4ui(location::GLint, v0::GLuint, v1::GLuint, v2::GLuint, v3::GLuint)::Cvoid
@glfunc glProgramUniform4f(program::GLuint, location::GLint, v0::GLfloat, v1::GLfloat, v2::GLfloat, v3::GLfloat)::Cvoid
@glfunc glCompressedTexSubImage1D(target::GLenum, level::GLint, xoffset::GLint, width::GLsizei, format::GLenum, imageSize::GLsizei, data::Ptr{Cvoid})::Cvoid
@glfunc glProgramUniformMatrix2dv(program::GLuint, location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLdouble})::Cvoid
@glfunc glTexParameterf(target::GLenum, pname::GLenum, param::GLfloat)::Cvoid
@glfunc glShaderBinary(count::GLsizei, shaders::Ptr{GLuint}, binaryformat::GLenum, binary::Ptr{Cvoid}, length::GLsizei)::Cvoid
@glfunc glPauseTransformFeedback()::Cvoid
@glfunc glMultiDrawElements(mode::GLenum, count::Ptr{GLsizei}, type_::GLenum, indices::Ptr{Ptr{Cvoid}}, drawcount::GLsizei)::Cvoid
@glfunc glGetBufferPointerv(target::GLenum, pname::GLenum, params::Ptr{Ptr{Cvoid}})::Cvoid
@glfunc glVertexAttribP4uiv(index::GLuint, type_::GLenum, normalized::GLboolean, value::Ptr{GLuint})::Cvoid
@glfunc glVertexArrayVertexAttribIFormatEXT(vaobj::GLuint, attribindex::GLuint, size::GLint, type_::GLenum, relativeoffset::GLuint)::Cvoid
@glfunc glEndConditionalRender()::Cvoid
@glfunc glFlush()::Cvoid
@glfunc glBlendFuncSeparatei(buf::GLuint, srcRGB::GLenum, dstRGB::GLenum, srcAlpha::GLenum, dstAlpha::GLenum)::Cvoid
@glfunc glProgramUniform1dv(program::GLuint, location::GLint, count::GLsizei, value::Ptr{GLdouble})::Cvoid
@glfunc glProgramUniform2ui(program::GLuint, location::GLint, v0::GLuint, v1::GLuint)::Cvoid
@glfunc glActiveTexture(texture::GLenum)::Cvoid
@glfunc glSecondaryColorP3ui(type_::GLenum, color::GLuint)::Cvoid
@glfunc glProgramUniformMatrix3dv(program::GLuint, location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLdouble})::Cvoid
@glfunc glBlendEquationi(buf::GLuint, mode::GLenum)::Cvoid
@glfunc glPolygonOffset(factor::GLfloat, units::GLfloat)::Cvoid
@glfunc glDetachShader(program::GLuint, shader::GLuint)::Cvoid
@glfunc glUniform4uiv(location::GLint, count::GLsizei, value::Ptr{GLuint})::Cvoid
@glfunc glTexParameteriv(target::GLenum, pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glGetIntegerv(pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glEnable(cap::GLenum)::Cvoid
@glfunc glClearBufferData(target::GLenum, internalformat::GLenum, format::GLenum, type_::GLenum, data::Ptr{Cvoid})::Cvoid
@glfunc glMapBufferRange(target::GLenum, offset::GLintptr, length::GLsizeiptr, access::GLbitfield)::Ptr{Cvoid}
@glfunc glTexCoordP4uiv(type_::GLenum, coords::Ptr{GLuint})::Cvoid
@glfunc glDepthRangeArrayv(first::GLuint, count::GLsizei, v::Ptr{GLdouble})::Cvoid
@glfunc glGetCompressedTexImage(target::GLenum, level::GLint, img::Ptr{Cvoid})::Cvoid
@glfunc glProgramUniformMatrix4x2fv(program::GLuint, location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLfloat})::Cvoid
@glfunc glIsTransformFeedback(id::GLuint)::Bool
@glfunc glMultiTexCoordP1uiv(texture::GLenum, type_::GLenum, coords::Ptr{GLuint})::Cvoid
@glfunc glSamplerParameterIiv(sampler::GLuint, pname::GLenum, param::Ptr{GLint})::Cvoid
@glfunc glProgramUniform2i(program::GLuint, location::GLint, v0::GLint, v1::GLint)::Cvoid
@glfunc glUniform4dv(location::GLint, count::GLsizei, value::Ptr{GLdouble})::Cvoid
@glfunc glGetDoublev(pname::GLenum, params::Ptr{GLdouble})::Cvoid
@glfunc glTexCoordP1uiv(type_::GLenum, coords::Ptr{GLuint})::Cvoid
@glfunc glProgramUniform1f(program::GLuint, location::GLint, v0::GLfloat)::Cvoid
@glfunc glTexParameterIuiv(target::GLenum, pname::GLenum, params::Ptr{GLuint})::Cvoid
@glfunc glUniformMatrix2x3dv(location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLdouble})::Cvoid
@glfunc glPixelStorei(pname::GLenum, param::GLint)::Cvoid
@glfunc glUniform3ui(location::GLint, v0::GLuint, v1::GLuint, v2::GLuint)::Cvoid
@glfunc glGetTexParameterIuiv(target::GLenum, pname::GLenum, params::Ptr{GLuint})::Cvoid
@glfunc glGetShaderiv(shader::GLuint, pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glTexCoordP4ui(type_::GLenum, coords::GLuint)::Cvoid
@glfunc glPointParameteri(pname::GLenum, param::GLint)::Cvoid
@glfunc glTextureStorage1DEXT(texture::GLuint, target::GLenum, levels::GLsizei, internalformat::GLenum, width::GLsizei)::Cvoid
@glfunc glEnablei(target::GLenum, index::GLuint)::Cvoid
@glfunc glTexCoordP3uiv(type_::GLenum, coords::Ptr{GLuint})::Cvoid
@glfunc glGetRenderbufferParameteriv(target::GLenum, pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glVertexAttribI4sv(index::GLuint, v::Ptr{GLshort})::Cvoid
@glfunc glGetActiveSubroutineName(program::GLuint, shadertype::GLenum, index::GLuint, bufsize::GLsizei, length::Ptr{GLsizei}, name::Ptr{GLchar})::Cvoid
@glfunc glCompileShader(shader::GLuint)::Cvoid
@glfunc glLinkProgram(program::GLuint)::Cvoid
@glfunc glReadPixels(x::GLint, y::GLint, width::GLsizei, height::GLsizei, format::GLenum, type_::GLenum, pixels::Ptr{Cvoid})::Cvoid
@glfunc glCreateShaderProgramv(type_::GLenum, count::GLsizei, strings::Ptr{GLchar})::GLuint
@glfunc glBufferData(target::GLenum, size::GLsizeiptr, data::Ptr{Cvoid}, usage::GLenum)::Cvoid
@glfunc glPointParameteriv(pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glUniform2fv(location::GLint, count::GLsizei, value::Ptr{GLfloat})::Cvoid
@glfunc glDrawTransformFeedbackStream(mode::GLenum, id::GLuint, stream::GLuint)::Cvoid
@glfunc glUniform2dv(location::GLint, count::GLsizei, value::Ptr{GLdouble})::Cvoid
@glfunc glTexSubImage1D(target::GLenum, level::GLint, xoffset::GLint, width::GLsizei, format::GLenum, type_::GLenum, pixels::Ptr{Cvoid})::Cvoid
@glfunc glDispatchCompute(num_groups_x::GLuint, num_groups_y::GLuint, num_groups_z::GLuint)::Cvoid
@glfunc glGetBufferSubData(target::GLenum, offset::GLintptr, size::GLsizeiptr, data::Ptr{Cvoid})::Cvoid
@glfunc glVertexP2uiv(type_::GLenum, value::Ptr{GLuint})::Cvoid
@glfunc glUniform4fv(location::GLint, count::GLsizei, value::Ptr{GLfloat})::Cvoid
@glfunc glGetProgramResourceLocation(program::GLuint, programCinterface::GLenum, name::Ptr{GLchar})::GLint
@glfunc glVertexArrayVertexAttribLFormatEXT(vaobj::GLuint, attribindex::GLuint, size::GLint, type_::GLenum, relativeoffset::GLuint)::Cvoid
@glfunc glGetUniformuiv(program::GLuint, location::GLint, params::Ptr{GLuint})::Cvoid
@glfunc glBindImageTexture(unit::GLuint, texture::GLuint, level::GLint, layered::GLboolean, layer::GLint, access::GLenum, format::GLenum)::Cvoid
@glfunc glVertexAttribL4dv(index::GLuint, v::Ptr{GLdouble})::Cvoid
@glfunc glColorP4ui(type_::GLenum, color::GLuint)::Cvoid
@glfunc glUniform2f(location::GLint, v0::GLfloat, v1::GLfloat)::Cvoid
@glfunc glColorP4uiv(type_::GLenum, color::Ptr{GLuint})::Cvoid
@glfunc glVertexAttribIPointer(index::GLuint, size::GLint, type_::GLenum, stride::GLsizei, pointer::Ptr{Cvoid})::Cvoid
@glfunc glGetProgramPipelineiv(pipeline::GLuint, pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glMultiTexCoordP3uiv(texture::GLenum, type_::GLenum, coords::Ptr{GLuint})::Cvoid
@glfunc glGetProgramResourceName(program::GLuint, programInterface::GLenum, index::GLuint, bufSize::GLsizei, length::Ptr{GLsizei}, name::Ptr{GLchar})::Cvoid
@glfunc glVertexP4ui(type_::GLenum, value::GLuint)::Cvoid
@glfunc glFrontFace(mode::GLenum)::Cvoid
@glfunc glProgramUniform4i(program::GLuint, location::GLint, v0::GLint, v1::GLint, v2::GLint, v3::GLint)::Cvoid
@glfunc glPointParameterfv(pname::GLenum, params::Ptr{GLfloat})::Cvoid
@glfunc glShaderStorageBlockBinding(program::GLuint, storageBlockIndex::GLuint, storageBlockBinding::GLuint)::Cvoid
@glfunc glClearStencil(s::GLint)::Cvoid
@glfunc glBlendEquation(mode::GLenum)::Cvoid
@glfunc glIsProgramPipeline(pipeline::GLuint)::Bool
@glfunc glUniform3f(location::GLint, v0::GLfloat, v1::GLfloat, v2::GLfloat)::Cvoid
@glfunc glVertexAttribI4usv(index::GLuint, v::Ptr{GLushort})::Cvoid
@glfunc glFramebufferParameteri(target::GLenum, pname::GLenum, param::GLint)::Cvoid
@glfunc glGenSamplers(count::GLsizei, samplers::Ptr{GLuint})::Cvoid
@glfunc glUniformMatrix4fv(location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLfloat})::Cvoid
@glfunc glBlendColor(red::GLfloat, green::GLfloat, blue::GLfloat, alpha::GLfloat)::Cvoid
@glfunc glInvalidateTexImage(texture::GLuint, level::GLint)::Cvoid
@glfunc glGetSubroutineIndex(program::GLuint, shadertype::GLenum, name::Ptr{GLchar})::GLuint
@glfunc glVertexAttribL3dv(index::GLuint, v::Ptr{GLdouble})::Cvoid
@glfunc glProgramUniformMatrix2fv(program::GLuint, location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLfloat})::Cvoid
@glfunc glDrawElementsInstancedBaseInstance(mode::GLenum, count::GLsizei, type_::GLenum, indices::Ptr{Cvoid}, instancecount::GLsizei, baseinstance::GLuint)::Cvoid
@glfunc glIndexub(c::GLubyte)::Cvoid
@glfunc glGenRenderbuffers(n::GLsizei, renderbuffers::Ptr{GLuint})::Cvoid
@glfunc glProgramUniform4dv(program::GLuint, location::GLint, count::GLsizei, value::Ptr{GLdouble})::Cvoid
@glfunc glProgramUniformMatrix2x3dv(program::GLuint, location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLdouble})::Cvoid
@glfunc glTexImage3D(target::GLenum, level::GLint, internalformat::GLint, width::GLsizei, height::GLsizei, depth::GLsizei, border::GLint, format::GLenum, type_::GLenum, pixels::Ptr{Cvoid})::Cvoid
@glfunc glGetVertexAttribfv(index::GLuint, pname::GLenum, params::Ptr{GLfloat})::Cvoid
@glfunc glVertexAttribL4d(index::GLuint, x::GLdouble, y::GLdouble, z::GLdouble, w::GLdouble)::Cvoid
@glfunc glBindFramebuffer(target::GLenum, framebuffer::GLuint)::Cvoid
@glfunc glFramebufferTexture3D(target::GLenum, attachment::GLenum, textarget::GLenum, texture::GLuint, level::GLint, zoffset::GLint)::Cvoid
@glfunc glVertexArrayVertexAttribFormatEXT(vaobj::GLuint, attribindex::GLuint, size::GLint, type_::GLenum, normalized::GLboolean, relativeoffset::GLuint)::Cvoid
@glfunc glGetVertexAttribLdv(index::GLuint, pname::GLenum, params::Ptr{GLdouble})::Cvoid
@glfunc glVertexAttribBinding(attribindex::GLuint, bindingindex::GLuint)::Cvoid
@glfunc glUniformMatrix3fv(location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLfloat})::Cvoid
@glfunc glUniformMatrix4dv(location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLdouble})::Cvoid
@glfunc glProgramUniformMatrix4x3dv(program::GLuint, location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLdouble})::Cvoid
@glfunc glProgramUniformMatrix3x4fv(program::GLuint, location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLfloat})::Cvoid
@glfunc glGetDebugMessageLog(count::GLuint, bufsize::GLsizei, sources::Ptr{GLenum}, types::Ptr{GLenum}, ids::Ptr{GLuint}, severities::Ptr{GLenum}, lengths::Ptr{GLsizei}, messageLog::Ptr{GLchar})::GLuint
@glfunc glGetVertexAttribiv(index::GLuint, pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glDebugMessageInsert(source::GLenum, type_::GLenum, id::GLuint, severity::GLenum, length::GLsizei, buf::Ptr{GLchar})::Cvoid
@glfunc glNormalP3ui(type_::GLenum, coords::GLuint)::Cvoid
@glfunc glDrawArraysInstanced(mode::GLenum, first::GLint, count::GLsizei, instancecount::GLsizei)::Cvoid
@glfunc glCompressedTexImage2D(target::GLenum, level::GLint, internalformat::GLenum, width::GLsizei, height::GLsizei, border::GLint, imageSize::GLsizei, data::Ptr{Cvoid})::Cvoid
@glfunc glPushDebugGroup(source::GLenum, id::GLuint, length::GLsizei, message::Ptr{GLchar})::Cvoid
@glfunc glGetUniformBlockIndex(program::GLuint, uniformBlockName::Ptr{GLchar})::GLuint
@glfunc glInvalidateFramebuffer(target::GLenum, numAttachments::GLsizei, attachments::Ptr{GLenum})::Cvoid
@glfunc glVertexAttribP2uiv(index::GLuint, type_::GLenum, normalized::GLboolean, value::Ptr{GLuint})::Cvoid
@glfunc glIsEnabledi(target::GLenum, index::GLuint)::Bool
@glfunc glVertexAttribP2ui(index::GLuint, type_::GLenum, normalized::GLboolean, value::GLuint)::Cvoid
@glfunc glDrawArrays(mode::GLenum, first::GLint, count::GLsizei)::Cvoid
@glfunc glGetActiveAttrib(program::GLuint, index::GLuint, bufSize::GLsizei, length::Ptr{GLsizei}, size::Ptr{GLint}, type_::Ptr{GLenum}, name::Ptr{GLchar})::Cvoid
@glfunc glCopyTexImage1D(target::GLenum, level::GLint, internalformat::GLenum, x::GLint, y::GLint, width::GLsizei, border::GLint)::Cvoid
@glfunc glProgramUniform2f(program::GLuint, location::GLint, v0::GLfloat, v1::GLfloat)::Cvoid
@glfunc glCopyImageSubData(srcName::GLuint, srcTarget::GLenum, srcLevel::GLint, srcX::GLint, srcY::GLint, srcZ::GLint, dstName::GLuint, dstTarget::GLenum, dstLevel::GLint, dstX::GLint, dstY::GLint, dstZ::GLint, srcWidth::GLsizei, srcHeight::GLsizei, srcDepth::GLsizei)::Cvoid
@glfunc glGetError()::GLenum
@glfunc glNormalP3uiv(type_::GLenum, coords::Ptr{GLuint})::Cvoid
@glfunc glTexStorage2D(target::GLenum, levels::GLsizei, internalformat::GLenum, width::GLsizei, height::GLsizei)::Cvoid
@glfunc glProgramUniformMatrix4x3fv(program::GLuint, location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLfloat})::Cvoid
@glfunc glDrawRangeElementsBaseVertex(mode::GLenum, start::GLuint, END::GLuint, count::GLsizei, type_::GLenum, indices::Ptr{Cvoid}, basevertex::GLint)::Cvoid
@glfunc glGenProgramPipelines(n::GLsizei, pipelines::Ptr{GLuint})::Cvoid
@glfunc glVertexAttribI4uiv(index::GLuint, v::Ptr{GLuint})::Cvoid
@glfunc glActiveShaderProgram(pipeline::GLuint, program::GLuint)::Cvoid
@glfunc glGetInteger64v(pname::GLenum, params::Ptr{GLint64})::Cvoid
@glfunc glPrimitiveRestartIndex(index::GLuint)::Cvoid
@glfunc glDeleteShader(shader::GLuint)::Cvoid
@glfunc glGenBuffers(n::GLsizei, buffers::Ptr{GLuint})::Cvoid
@glfunc glTexParameterfv(target::GLenum, pname::GLenum, params::Ptr{GLfloat})::Cvoid
@glfunc glGetSamplerParameteriv(sampler::GLuint, pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glProgramUniform3d(program::GLuint, location::GLint, v0::GLdouble, v1::GLdouble, v2::GLdouble)::Cvoid
@glfunc glVertexAttribI1iv(index::GLuint, v::Ptr{GLint})::Cvoid
@glfunc glUniform2uiv(location::GLint, count::GLsizei, value::Ptr{GLuint})::Cvoid
@glfunc glUniform1i(location::GLint, v0::GLint)::Cvoid
@glfunc glUniform3uiv(location::GLint, count::GLsizei, value::Ptr{GLuint})::Cvoid
@glfunc glProgramUniform1uiv(program::GLuint, location::GLint, count::GLsizei, value::Ptr{GLuint})::Cvoid
@glfunc glUniform1iv(location::GLint, count::GLsizei, value::Ptr{GLint})::Cvoid
@glfunc glUniform1fv(location::GLint, count::GLsizei, value::Ptr{GLfloat})::Cvoid
@glfunc glScissorIndexedv(index::GLuint, v::Ptr{GLint})::Cvoid
@glfunc glIsTexture(texture::GLuint)::Bool
@glfunc glDrawArraysInstancedBaseInstance(mode::GLenum, first::GLint, count::GLsizei, instancecount::GLsizei, baseinstance::GLuint)::Cvoid
@glfunc glVertexAttribI1i(index::GLuint, x::GLint)::Cvoid
@glfunc glVertexAttribI3ui(index::GLuint, x::GLuint, y::GLuint, z::GLuint)::Cvoid
@glfunc glGetActiveUniformBlockiv(program::GLuint, uniformBlockIndex::GLuint, pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glVertexAttribI3i(index::GLuint, x::GLint, y::GLint, z::GLint)::Cvoid
@glfunc glBlendFunci(buf::GLuint, src::GLenum, dst::GLenum)::Cvoid
@glfunc glGetVertexAttribdv(index::GLuint, pname::GLenum, params::Ptr{GLdouble})::Cvoid
@glfunc glBlendEquationSeparate(modeRGB::GLenum, modeAlpha::GLenum)::Cvoid
@glfunc glFenceSync(condition::GLenum, flags::GLbitfield)::GLsync
@glfunc glSamplerParameterfv(sampler::GLuint, pname::GLenum, param::Ptr{GLfloat})::Cvoid
@glfunc glIsShader(shader::GLuint)::Bool
@glfunc glProgramUniform3f(program::GLuint, location::GLint, v0::GLfloat, v1::GLfloat, v2::GLfloat)::Cvoid
@glfunc glUniformMatrix4x3fv(location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLfloat})::Cvoid
@glfunc glGetQueryObjectuiv(id::GLuint, pname::GLenum, params::Ptr{GLuint})::Cvoid
@glfunc glPointParameterf(pname::GLenum, param::GLfloat)::Cvoid
@glfunc glIndexubv(c::Ptr{GLubyte})::Cvoid
@glfunc glClearBufferiv(buffer::GLenum, drawbuffer::GLint, value::Ptr{GLint})::Cvoid
@glfunc glBindVertexArray(array::GLuint)::Cvoid
@glfunc glGetInternalformati64v(target::GLenum, internalformat::GLenum, pname::GLenum, bufSize::GLsizei, params::Ptr{GLint64})::Cvoid
@glfunc glVertexP4uiv(type_::GLenum, value::Ptr{GLuint})::Cvoid
@glfunc glVertexAttribI2uiv(index::GLuint, v::Ptr{GLuint})::Cvoid
@glfunc glGetProgramResourceiv(program::GLuint, programInterface::GLenum, index::GLuint, propCount::GLsizei, props::Ptr{GLenum}, bufSize::GLsizei, length::Ptr{GLsizei}, params::Ptr{GLint})::Cvoid
@glfunc glViewport(x::GLint, y::GLint, width::GLsizei, height::GLsizei)::Cvoid
@glfunc glTexImage1D(target::GLenum, level::GLint, internalformat::GLint, width::GLsizei, border::GLint, format::GLenum, type_::GLenum, pixels::Ptr{Cvoid})::Cvoid
@glfunc glUniform1uiv(location::GLint, count::GLsizei, value::Ptr{GLuint})::Cvoid
@glfunc glProgramUniform4ui(program::GLuint, location::GLint, v0::GLuint, v1::GLuint, v2::GLuint, v3::GLuint)::Cvoid
@glfunc glUniform1f(location::GLint, v0::GLfloat)::Cvoid
@glfunc glVertexAttribP3uiv(index::GLuint, type_::GLenum, normalized::GLboolean, value::Ptr{GLuint})::Cvoid
@glfunc glBeginQuery(target::GLenum, id::GLuint)::Cvoid
@glfunc glMultiDrawArrays(mode::GLenum, first::Ptr{GLint}, count::Ptr{GLsizei}, drawcount::GLsizei)::Cvoid
@glfunc glDrawBuffer(mode::GLenum)::Cvoid
@glfunc glLogicOp(opcode::GLenum)::Cvoid
@glfunc glObjectLabel(identifier::GLenum, name::GLuint, length::GLsizei, label::Ptr{GLchar})::Cvoid
@glfunc glUniformMatrix3x2dv(location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLdouble})::Cvoid
@glfunc glUniform3d(location::GLint, x::GLdouble, y::GLdouble, z::GLdouble)::Cvoid
@glfunc glDepthRangeIndexed(index::GLuint, n::GLdouble, f::GLdouble)::Cvoid
@glfunc glGetProgramBinary(program::GLuint, bufSize::GLsizei, length::Ptr{GLsizei}, binaryFormat::Ptr{GLenum}, binary::Ptr{Cvoid})::Cvoid
@glfunc glPointSize(size::GLfloat)::Cvoid
@glfunc glGetUniformfv(program::GLuint, location::GLint, params::Ptr{GLfloat})::Cvoid
@glfunc glClearBufferfv(buffer::GLenum, drawbuffer::GLint, value::Ptr{GLfloat})::Cvoid
@glfunc glCopyTexSubImage1D(target::GLenum, level::GLint, xoffset::GLint, x::GLint, y::GLint, width::GLsizei)::Cvoid
@glfunc glIsEnabled(cap::GLenum)::Bool
@glfunc glCreateShader(type_::GLenum)::GLuint
@glfunc glTextureStorage2DEXT(texture::GLuint, target::GLenum, levels::GLsizei, internalformat::GLenum, width::GLsizei, height::GLsizei)::Cvoid
@glfunc glPixelStoref(pname::GLenum, param::GLfloat)::Cvoid
@glfunc glGetMultisamplefv(pname::GLenum, index::GLuint, val::Ptr{GLfloat})::Cvoid
@glfunc glGetFragDataIndex(program::GLuint, name::Ptr{GLchar})::GLint
@glfunc glGetUniformIndices(program::GLuint, uniformCount::GLsizei, uniformNames::Ptr{Ptr{GLchar}}, uniformIndices::Ptr{GLuint})::Cvoid
@glfunc glUniform1dv(location::GLint, count::GLsizei, value::Ptr{GLdouble})::Cvoid
@glfunc glGetFragDataLocation(program::GLuint, name::Ptr{GLchar})::GLint
@glfunc glMultiTexCoordP2ui(texture::GLenum, type_::GLenum, coords::GLuint)::Cvoid
@glfunc glDepthFunc(func_::GLenum)::Cvoid
@glfunc glVertexAttribI4iv(index::GLuint, v::Ptr{GLint})::Cvoid
@glfunc glUniformMatrix2x4fv(location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLfloat})::Cvoid
@glfunc glBufferSubData(target::GLenum, offset::GLintptr, size::GLsizeiptr, data::Ptr{Cvoid})::Cvoid
@glfunc glUniformMatrix3x4fv(location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLfloat})::Cvoid
@glfunc glBindBufferRange(target::GLenum, index::GLuint, buffer::GLuint, offset::GLintptr, size::GLsizeiptr)::Cvoid
@glfunc glGenQueries(n::GLsizei, ids::Ptr{GLuint})::Cvoid
@glfunc glDebugMessageCallback(callback::Ptr{Cvoid}, userParam::Ptr{Cvoid})::Cvoid
@glfunc glDebugMessageCallbackARB(callback::Ptr{Cvoid}, userParam::Ptr{Cvoid})::Cvoid
@glfunc glInvalidateTexSubImage(texture::GLuint, level::GLint, xoffset::GLint, yoffset::GLint, zoffset::GLint, width::GLsizei, height::GLsizei, depth::GLsizei)::Cvoid
@glfunc glColorP3uiv(type_::GLenum, color::Ptr{GLuint})::Cvoid
@glfunc glTexStorage1D(target::GLenum, levels::GLsizei, internalformat::GLenum, width::GLsizei)::Cvoid
@glfunc glBlendFunc(sfactor::GLenum, dfactor::GLenum)::Cvoid
@glfunc glGetBooleanv(pname::GLenum, params::Ptr{GLboolean})::Cvoid
@glfunc glUniformMatrix3x4dv(location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLdouble})::Cvoid
@glfunc glGetObjectLabel(identifier::GLenum, name::GLuint, bufSize::GLsizei, length::Ptr{GLsizei}, label::Ptr{GLchar})::Cvoid
@glfunc glSampleCoverage(value::GLfloat, invert::GLboolean)::Cvoid
@glfunc glProgramUniformMatrix3x2fv(program::GLuint, location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLfloat})::Cvoid
@glfunc glVertexAttribL2dv(index::GLuint, v::Ptr{GLdouble})::Cvoid
@glfunc glGetFloatv(pname::GLenum, params::Ptr{GLfloat})::Cvoid
@glfunc glProvokingVertex(mode::GLenum)::Cvoid
@glfunc glVertexAttribL3d(index::GLuint, x::GLdouble, y::GLdouble, z::GLdouble)::Cvoid
@glfunc glClearDepth(depth::GLdouble)::Cvoid
@glfunc glInvalidateBufferData(buffer::GLuint)::Cvoid
@glfunc glProgramParameteri(program::GLuint, pname::GLenum, value::GLint)::Cvoid
@glfunc glUniformMatrix3x2fv(location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLfloat})::Cvoid
@glfunc glDisable(cap::GLenum)::Cvoid
@glfunc glMultiDrawElementsIndirect(mode::GLenum, type_::GLenum, indirect::Ptr{Cvoid}, drawcount::GLsizei, stride::GLsizei)::Cvoid
@glfunc glMultiDrawElementsBaseVertex(mode::GLenum, count::Ptr{GLsizei}, type_::GLenum, indices::Ptr{Ptr{Cvoid}}, drawcount::GLsizei, basevertex::Ptr{GLint})::Cvoid
@glfunc glFlushMappedBufferRange(target::GLenum, offset::GLintptr, length::GLsizeiptr)::Cvoid
@glfunc glGetUniformdv(program::GLuint, location::GLint, params::Ptr{GLdouble})::Cvoid
@glfunc glGetProgramInterfaceiv(program::GLuint, programInterface::GLenum, pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glTransformFeedbackVaryings(program::GLuint, count::GLsizei, varyings::Ptr{Ptr{GLchar}}, bufferMode::GLenum)::Cvoid
@glfunc glGetVertexAttribIuiv(index::GLuint, pname::GLenum, params::Ptr{GLuint})::Cvoid
@glfunc glGetShaderInfoLog(shader::GLuint, bufSize::GLsizei, length::Ptr{GLsizei}, infoLog::Ptr{GLchar})::Cvoid
@glfunc glRenderbufferStorageMultisample(target::GLenum, samples::GLsizei, internalformat::GLenum, width::GLsizei, height::GLsizei)::Cvoid
@glfunc glUniformMatrix2x3fv(location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLfloat})::Cvoid
@glfunc glUseProgramStages(pipeline::GLuint, stages::GLbitfield, program::GLuint)::Cvoid
@glfunc glVertexAttribLFormat(attribindex::GLuint, size::GLint, type_::GLenum, relativeoffset::GLuint)::Cvoid
@glfunc glProgramUniform1i(program::GLuint, location::GLint, v0::GLint)::Cvoid
@glfunc glGetFramebufferParameteriv(target::GLenum, pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glDeleteProgramPipelines(n::GLsizei, pipelines::Ptr{GLuint})::Cvoid
@glfunc glProgramUniform2fv(program::GLuint, location::GLint, count::GLsizei, value::Ptr{GLfloat})::Cvoid
@glfunc glProgramUniform1iv(program::GLuint, location::GLint, count::GLsizei, value::Ptr{GLint})::Cvoid
@glfunc glBindBuffer(target::GLenum, buffer::GLuint)::Cvoid
@glfunc glGetAttribLocation(program::GLuint, name::Ptr{GLchar})::GLint
@glfunc glProgramUniform3ui(program::GLuint, location::GLint, v0::GLuint, v1::GLuint, v2::GLuint)::Cvoid
@glfunc glTexParameteri(target::GLenum, pname::GLenum, param::GLint)::Cvoid
@glfunc glWaitSync(sync::GLsync, flags::GLbitfield, timeout::GLuint64)::Cvoid
@glfunc glTextureStorage3DMultisampleEXT(texture::GLuint, target::GLenum, samples::GLsizei, internalformat::GLenum, width::GLsizei, height::GLsizei, depth::GLsizei, fixedsamplelocations::GLboolean)::Cvoid
@glfunc glIsVertexArray(array::GLuint)::Bool
@glfunc glEnableVertexAttribArray(index::GLuint)::Cvoid
@glfunc glObjectPtrLabel(ptr::Ptr{Cvoid}, length::GLsizei, label::Ptr{GLchar})::Cvoid
@glfunc glProgramBinary(program::GLuint, binaryFormat::GLenum, binary::Ptr{Cvoid}, length::GLsizei)::Cvoid
@glfunc glCompressedTexImage1D(target::GLenum, level::GLint, internalformat::GLenum, width::GLsizei, border::GLint, imageSize::GLsizei, data::Ptr{Cvoid})::Cvoid
@glfunc glTexCoordP2uiv(type_::GLenum, coords::Ptr{GLuint})::Cvoid
@glfunc glUseProgram(program::GLuint)::Cvoid
@glfunc glProgramUniform3i(program::GLuint, location::GLint, v0::GLint, v1::GLint, v2::GLint)::Cvoid
@glfunc glVertexAttribI2ui(index::GLuint, x::GLuint, y::GLuint)::Cvoid
@glfunc glGetActiveSubroutineUniformiv(program::GLuint, shadertype::GLenum, index::GLuint, pname::GLenum, values::Ptr{GLint})::Cvoid
@glfunc glDepthMask(flag::GLboolean)::Cvoid
@glfunc glPolygonMode(face::GLenum, mode::GLenum)::Cvoid
@glfunc glVertexAttribI3uiv(index::GLuint, v::Ptr{GLuint})::Cvoid
@glfunc glFramebufferTexture1D(target::GLenum, attachment::GLenum, textarget::GLenum, texture::GLuint, level::GLint)::Cvoid
@glfunc glGetActiveSubroutineUniformName(program::GLuint, shadertype::GLenum, index::GLuint, bufsize::GLsizei, length::Ptr{GLsizei}, name::Ptr{GLchar})::Cvoid
@glfunc glGenFramebuffers(n::GLsizei, framebuffers::Ptr{GLuint})::Cvoid
@glfunc glFramebufferTextureLayer(target::GLenum, attachment::GLenum, texture::GLuint, level::GLint, layer::GLint)::Cvoid
@glfunc glViewportArrayv(first::GLuint, count::GLsizei, v::Ptr{GLfloat})::Cvoid
@glfunc glDrawRangeElements(mode::GLenum, start::GLuint, END::GLuint, count::GLsizei, type_::GLenum, indices::Ptr{Cvoid})::Cvoid
@glfunc glCopyTexSubImage3D(target::GLenum, level::GLint, xoffset::GLint, yoffset::GLint, zoffset::GLint, x::GLint, y::GLint, width::GLsizei, height::GLsizei)::Cvoid
@glfunc glStencilMaskSeparate(face::GLenum, mask::GLuint)::Cvoid
@glfunc glGetProgramInfoLog(program::GLuint, bufSize::GLsizei, length::Ptr{GLsizei}, infoLog::Ptr{GLchar})::Cvoid
@glfunc glGetProgramResourceIndex(program::GLuint, programCinterface::GLenum, name::Ptr{GLchar})::GLuint
@glfunc glBlitFramebuffer(srcX0::GLint, srcY0::GLint, srcX1::GLint, srcY1::GLint, dstX0::GLint, dstY0::GLint, dstX1::GLint, dstY1::GLint, mask::GLbitfield, filter::GLenum)::Cvoid
@glfunc glBeginTransformFeedback(primitiveMode::GLenum)::Cvoid
@glfunc glVertexAttribI4bv(index::GLuint, v::Ptr{GLbyte})::Cvoid
@glfunc glIsSampler(sampler::GLuint)::Bool
@glfunc glVertexAttribI4ui(index::GLuint, x::GLuint, y::GLuint, z::GLuint, w::GLuint)::Cvoid
@glfunc glProgramUniformMatrix3x4dv(program::GLuint, location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLdouble})::Cvoid
@glfunc glCheckFramebufferStatus(target::GLenum)::GLenum
@glfunc glProgramUniformMatrix3fv(program::GLuint, location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLfloat})::Cvoid
@glfunc glTextureBufferRangeEXT(texture::GLuint, target::GLenum, internalformat::GLenum, buffer::GLuint, offset::GLintptr, size::GLsizeiptr)::Cvoid
@glfunc glInvalidateSubFramebuffer(target::GLenum, numAttachments::GLsizei, attachments::Ptr{GLenum}, x::GLint, y::GLint, width::GLsizei, height::GLsizei)::Cvoid
@glfunc glDeleteTransformFeedbacks(n::GLsizei, ids::Ptr{GLuint})::Cvoid
@glfunc glGetActiveUniformName(program::GLuint, uniformIndex::GLuint, bufSize::GLsizei, length::Ptr{GLsizei}, uniformName::Ptr{GLchar})::Cvoid
@glfunc glPatchParameterfv(pname::GLenum, values::Ptr{GLfloat})::Cvoid
@glfunc glProgramUniform4d(program::GLuint, location::GLint, v0::GLdouble, v1::GLdouble, v2::GLdouble, v3::GLdouble)::Cvoid
@glfunc glSamplerParameteriv(sampler::GLuint, pname::GLenum, param::Ptr{GLint})::Cvoid
@glfunc glTextureStorage2DMultisampleEXT(texture::GLuint, target::GLenum, samples::GLsizei, internalformat::GLenum, width::GLsizei, height::GLsizei, fixedsamplelocations::GLboolean)::Cvoid
@glfunc glStencilOpSeparate(face::GLenum, sfail::GLenum, dpfail::GLenum, dppass::GLenum)::Cvoid
@glfunc glScissorIndexed(index::GLuint, left::GLint, bottom::GLint, width::GLsizei, height::GLsizei)::Cvoid
@glfunc glVertexAttribI3iv(index::GLuint, v::Ptr{GLint})::Cvoid
@glfunc glBeginQueryIndexed(target::GLenum, index::GLuint, id::GLuint)::Cvoid
@glfunc glValidateProgramPipeline(pipeline::GLuint)::Cvoid
@glfunc glUnmapBuffer(target::GLenum)::Bool
@glfunc glEndQuery(target::GLenum)::Cvoid
@glfunc glStencilOp(fail::GLenum, zfail::GLenum, zpass::GLenum)::Cvoid
@glfunc glCompressedTexImage3D(target::GLenum, level::GLint, internalformat::GLenum, width::GLsizei, height::GLsizei, depth::GLsizei, border::GLint, imageSize::GLsizei, data::Ptr{Cvoid})::Cvoid
@glfunc glSampleMaski(index::GLuint, mask::GLbitfield)::Cvoid
@glfunc glDisableVertexAttribArray(index::GLuint)::Cvoid
@glfunc glVertexAttribI2i(index::GLuint, x::GLint, y::GLint)::Cvoid
@glfunc glCompressedTexSubImage2D(target::GLenum, level::GLint, xoffset::GLint, yoffset::GLint, width::GLsizei, height::GLsizei, format::GLenum, imageSize::GLsizei, data::Ptr{Cvoid})::Cvoid
@glfunc glGetVertexAttribPointerv(index::GLuint, pname::GLenum, pointer::Ptr{Ptr{Cvoid}})::Cvoid
@glfunc glDeleteFramebuffers(n::GLsizei, framebuffers::Ptr{GLuint})::Cvoid
@glfunc glUniformMatrix4x2dv(location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLdouble})::Cvoid
@glfunc glInvalidateBufferSubData(buffer::GLuint, offset::GLintptr, length::GLsizeiptr)::Cvoid
@glfunc glFramebufferTexture(target::GLenum, attachment::GLenum, texture::GLuint, level::GLint)::Cvoid
@glfunc glTexImage3DMultisample(target::GLenum, samples::GLsizei, internalformat::GLint, width::GLsizei, height::GLsizei, depth::GLsizei, fixedsamplelocations::GLboolean)::Cvoid
@glfunc glVertexAttribL1d(index::GLuint, x::GLdouble)::Cvoid
@glfunc glTextureStorage3DEXT(texture::GLuint, target::GLenum, levels::GLsizei, internalformat::GLenum, width::GLsizei, height::GLsizei, depth::GLsizei)::Cvoid
@glfunc glGetBufferParameteriv(target::GLenum, pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glCopyBufferSubData(readTarget::GLenum, writeTarget::GLenum, readOffset::GLintptr, writeOffset::GLintptr, size::GLsizeiptr)::Cvoid
@glfunc glSamplerParameterf(sampler::GLuint, pname::GLenum, param::GLfloat)::Cvoid
@glfunc glColorMask(red::GLboolean, green::GLboolean, blue::GLboolean, alpha::GLboolean)::Cvoid
@glfunc glBlendFuncSeparate(sfactorRGB::GLenum, dfactorRGB::GLenum, sfactorAlpha::GLenum, dfactorAlpha::GLenum)::Cvoid
@glfunc glUniform3fv(location::GLint, count::GLsizei, value::Ptr{GLfloat})::Cvoid
@glfunc glVertexAttribL1dv(index::GLuint, v::Ptr{GLdouble})::Cvoid
@glfunc glUniform4i(location::GLint, v0::GLint, v1::GLint, v2::GLint, v3::GLint)::Cvoid
@glfunc glMultiTexCoordP3ui(texture::GLenum, type_::GLenum, coords::GLuint)::Cvoid
@glfunc glDrawBuffers(n::GLsizei, bufs::Ptr{GLenum})::Cvoid
@glfunc glColorP3ui(type_::GLenum, color::GLuint)::Cvoid
@glfunc glProgramUniformMatrix2x4dv(program::GLuint, location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLdouble})::Cvoid
@glfunc glVertexP2ui(type_::GLenum, value::GLuint)::Cvoid
@glfunc glDrawElementsInstanced(mode::GLenum, count::GLsizei, type_::GLenum, indices::Ptr{Cvoid}, instancecount::GLsizei)::Cvoid
@glfunc glDrawElementsInstancedEXT(mode::GLenum, count::GLsizei, type_::GLenum, indices::Ptr{Cvoid}, instancecount::GLsizei)::Cvoid
@glfunc glGetUniformiv(program::GLuint, location::GLint, params::Ptr{GLint})::Cvoid
@glfunc glTexImage2D(target::GLenum, level::GLint, internalformat::GLint, width::GLsizei, height::GLsizei, border::GLint, format::GLenum, type_::GLenum, pixels::Ptr{Cvoid})::Cvoid
@glfunc glGetQueryObjecti64v(id::GLuint, pname::GLenum, params::Ptr{GLint64})::Cvoid
@glfunc glGetTexImage(target::GLenum, level::GLint, format::GLenum, type_::GLenum, pixels::Ptr{Cvoid})::Cvoid
@glfunc glGetTexLevelParameteriv(target::GLenum, level::GLint, pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glTexSubImage2D(target::GLenum, level::GLint, xoffset::GLint, yoffset::GLint, width::GLsizei, height::GLsizei, format::GLenum, type_::GLenum, pixels::Ptr{Cvoid})::Cvoid
@glfunc glDeleteVertexArrays(n::GLsizei, arrays::Ptr{GLuint})::Cvoid
@glfunc glIsRenderbuffer(renderbuffer::GLuint)::Bool
@glfunc glGetProgramResourceLocationIndex(program::GLuint, programCinterface::GLenum, name::Ptr{GLchar})::GLint
@glfunc glGetInteger64i_v(target::GLenum, index::GLuint, data::Ptr{GLint64})::Cvoid
@glfunc glProgramUniform1ui(program::GLuint, location::GLint, v0::GLuint)::Cvoid
@glfunc glUniform4iv(location::GLint, count::GLsizei, value::Ptr{GLint})::Cvoid
@glfunc glProgramUniform3fv(program::GLuint, location::GLint, count::GLsizei, value::Ptr{GLfloat})::Cvoid
@glfunc glVertexAttribL2d(index::GLuint, x::GLdouble, y::GLdouble)::Cvoid
@glfunc glUniform2d(location::GLint, x::GLdouble, y::GLdouble)::Cvoid
@glfunc glGetBufferParameteri64v(target::GLenum, pname::GLenum, params::Ptr{GLint64})::Cvoid
@glfunc glTexCoordP1ui(type_::GLenum, coords::GLuint)::Cvoid
@glfunc glDeleteBuffers(n::GLsizei, buffers::Ptr{GLuint})::Cvoid
@glfunc glProgramUniformMatrix2x4fv(program::GLuint, location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLfloat})::Cvoid
@glfunc glMultiTexCoordP4uiv(texture::GLenum, type_::GLenum, coords::Ptr{GLuint})::Cvoid
@glfunc glVertexAttribPointer(index::GLuint, size::GLint, type_::GLenum, normalized::GLboolean, stride::GLsizei, pointer::Ptr{Cvoid})::Cvoid
@glfunc glVertexP3uiv(type_::GLenum, value::Ptr{GLuint})::Cvoid
@glfunc glDispatchComputeIndirect(indirect::GLintptr)::Cvoid
@glfunc glProgramUniform1d(program::GLuint, location::GLint, v0::GLdouble)::Cvoid
@glfunc glGetFloati_v(target::GLenum, index::GLuint, data::Ptr{GLfloat})::Cvoid
@glfunc glDebugMessageControl(source::GLenum, type_::GLenum, severity::GLenum, count::GLsizei, ids::Ptr{GLuint}, enabled::GLboolean)::Cvoid
@glfunc glVertexAttribFormat(attribindex::GLuint, size::GLint, type_::GLenum, normalized::GLboolean, relativeoffset::GLuint)::Cvoid
@glfunc glClearColor(red::GLfloat, green::GLfloat, blue::GLfloat, alpha::GLfloat)::Cvoid
@glfunc glIsFramebuffer(framebuffer::GLuint)::Bool
@glfunc glVertexAttribP1uiv(index::GLuint, type_::GLenum, normalized::GLboolean, value::Ptr{GLuint})::Cvoid
@glfunc glUniform3i(location::GLint, v0::GLint, v1::GLint, v2::GLint)::Cvoid
@glfunc glGetString(name::GLenum)::Ptr{GLchar}
@glfunc glGenTextures(n::GLsizei, textures::Ptr{GLuint})::Cvoid
@glfunc glFramebufferRenderbuffer(target::GLenum, attachment::GLenum, renderbuffertarget::GLenum, renderbuffer::GLuint)::Cvoid
@glfunc glGetQueryObjectiv(id::GLuint, pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glBindProgramPipeline(pipeline::GLuint)::Cvoid
@glfunc glGetActiveUniformBlockName(program::GLuint, uniformBlockIndex::GLuint, bufSize::GLsizei, length::Ptr{GLsizei}, uniformBlockName::Ptr{GLchar})::Cvoid
@glfunc glUniformMatrix2fv(location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLfloat})::Cvoid
@glfunc glTexStorage3D(target::GLenum, levels::GLsizei, internalformat::GLenum, width::GLsizei, height::GLsizei, depth::GLsizei)::Cvoid
@glfunc glTexCoordP3ui(type_::GLenum, coords::GLuint)::Cvoid
@glfunc glDeleteSync(sync::GLsync)::Cvoid
@glfunc glBindFragDataLocation(program::GLuint, color::GLuint, name::Ptr{GLchar})::Cvoid
@glfunc glGetShaderPrecisionFormat(shadertype::GLenum, precisiontype::GLenum, range_::Ptr{GLint}, precision::Ptr{GLint})::Cvoid
@glfunc glGenTransformFeedbacks(n::GLsizei, ids::Ptr{GLuint})::Cvoid
@glfunc glProgramUniform4iv(program::GLuint, location::GLint, count::GLsizei, value::Ptr{GLint})::Cvoid
@glfunc glHint(target::GLenum, mode::GLenum)::Cvoid
@glfunc glVertexArrayVertexAttribBindingEXT(vaobj::GLuint, attribindex::GLuint, bindingindex::GLuint)::Cvoid
@glfunc glDrawTransformFeedback(mode::GLenum, id::GLuint)::Cvoid
@glfunc glUniform1ui(location::GLint, v0::GLuint)::Cvoid
@glfunc glTexSubImage3D(target::GLenum, level::GLint, xoffset::GLint, yoffset::GLint, zoffset::GLint, width::GLsizei, height::GLsizei, depth::GLsizei, format::GLenum, type_::GLenum, pixels::Ptr{Cvoid})::Cvoid
@glfunc glBeginConditionalRender(id::GLuint, mode::GLenum)::Cvoid
@glfunc glGetActiveUniformsiv(program::GLuint, uniformCount::GLsizei, uniformIndices::Ptr{GLuint}, pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glGetStringi(name::GLenum, index::GLuint)::Ptr{GLchar}
@glfunc glMultiDrawArraysIndirect(mode::GLenum, indirect::Ptr{Cvoid}, drawcount::GLsizei, stride::GLsizei)::Cvoid
@glfunc glDepthRange(near_::GLdouble, far_::GLdouble)::Cvoid
@glfunc glUniform2ui(location::GLint, v0::GLuint, v1::GLuint)::Cvoid
@glfunc glBindFragDataLocationIndexed(program::GLuint, colorNumber::GLuint, index::GLuint, name::Ptr{GLchar})::Cvoid
@glfunc glDrawElementsBaseVertex(mode::GLenum, count::GLsizei, type_::GLenum, indices::Ptr{Cvoid}, basevertex::GLint)::Cvoid
@glfunc glMultiTexCoordP4ui(texture::GLenum, type_::GLenum, coords::GLuint)::Cvoid
@glfunc glGetTexParameterfv(target::GLenum, pname::GLenum, params::Ptr{GLfloat})::Cvoid
@glfunc glVertexArrayBindVertexBufferEXT(vaobj::GLuint, bindingindex::GLuint, buffer::GLuint, offset::GLintptr, stride::GLsizei)::Cvoid
@glfunc glScissor(x::GLint, y::GLint, width::GLsizei, height::GLsizei)::Cvoid
@glfunc glClearDepthf(d::GLfloat)::Cvoid
@glfunc glProgramUniformMatrix4x2dv(program::GLuint, location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLdouble})::Cvoid
@glfunc glDrawElementsInstancedBaseVertex(mode::GLenum, count::GLsizei, type_::GLenum, indices::Ptr{Cvoid}, instancecount::GLsizei, basevertex::GLint)::Cvoid
@glfunc glClearNamedBufferDataEXT(buffer::GLuint, internalformat::GLenum, format::GLenum, type_::GLenum, data::Ptr{Cvoid})::Cvoid
@glfunc glProgramUniform2iv(program::GLuint, location::GLint, count::GLsizei, value::Ptr{GLint})::Cvoid
@glfunc glStencilMask(mask::GLuint)::Cvoid
@glfunc glCopyTexSubImage2D(target::GLenum, level::GLint, xoffset::GLint, yoffset::GLint, x::GLint, y::GLint, width::GLsizei, height::GLsizei)::Cvoid
@glfunc glGetTexLevelParameterfv(target::GLenum, level::GLint, pname::GLenum, params::Ptr{GLfloat})::Cvoid
@glfunc glColorMaski(index::GLuint, r::GLboolean, g::GLboolean, b::GLboolean, a::GLboolean)::Cvoid
@glfunc glVertexP3ui(type_::GLenum, value::GLuint)::Cvoid
@glfunc glUniformMatrix2dv(location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLdouble})::Cvoid
@glfunc glGetProgramPipelineInfoLog(pipeline::GLuint, bufSize::GLsizei, length::Ptr{GLsizei}, infoLog::Ptr{GLchar})::Cvoid
@glfunc glVertexAttribP1ui(index::GLuint, type_::GLenum, normalized::GLboolean, value::GLuint)::Cvoid
@glfunc glUniform3iv(location::GLint, count::GLsizei, value::Ptr{GLint})::Cvoid
@glfunc glUniformSubroutinesuiv(shadertype::GLenum, count::GLsizei, indices::Ptr{GLuint})::Cvoid
@glfunc glPatchParameteri(pname::GLenum, value::GLint)::Cvoid
@glfunc glGenVertexArrays(n::GLsizei, arrays::Ptr{GLuint})::Cvoid
@glfunc glStencilFunc(func_::GLenum, ref::GLint, mask::GLuint)::Cvoid
@glfunc glGetInternalformativ(target::GLenum, internalformat::GLenum, pname::GLenum, bufSize::GLsizei, params::Ptr{GLint})::Cvoid
@glfunc glMinSampleShading(value::GLfloat)::Cvoid
@glfunc glProgramUniform2uiv(program::GLuint, location::GLint, count::GLsizei, value::Ptr{GLuint})::Cvoid
@glfunc glGetActiveUniform(program::GLuint, index::GLuint, bufSize::GLsizei, length::Ptr{GLsizei}, size::Ptr{GLint}, type_::Ptr{GLenum}, name::Ptr{GLchar})::Cvoid
@glfunc glVertexAttribI4i(index::GLuint, x::GLint, y::GLint, z::GLint, w::GLint)::Cvoid
@glfunc glClearNamedBufferSubDataEXT(buffer::GLuint, internalformat::GLenum, offset::GLsizeiptr, size::GLsizeiptr, format::GLenum, type_::GLenum, data::Ptr{Cvoid})::Cvoid
@glfunc glUniformMatrix4x2fv(location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLfloat})::Cvoid
@glfunc glDeleteTextures(n::GLsizei, textures::Ptr{GLuint})::Cvoid
@glfunc glProgramUniformMatrix4dv(program::GLuint, location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLdouble})::Cvoid
@glfunc glCullFace(mode::GLenum)::Cvoid
@glfunc glProgramUniformMatrix3x2dv(program::GLuint, location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLdouble})::Cvoid
@glfunc glTexBufferRange(target::GLenum, internalformat::GLenum, buffer::GLuint, offset::GLintptr, size::GLsizeiptr)::Cvoid
@glfunc glClearBufferSubData(target::GLenum, internalformat::GLenum, offset::GLintptr, size::GLsizeiptr, format::GLenum, type_::GLenum, data::Ptr{Cvoid})::Cvoid
@glfunc glLineWidth(width::GLfloat)::Cvoid
@glfunc glCompressedTexSubImage3D(target::GLenum, level::GLint, xoffset::GLint, yoffset::GLint, zoffset::GLint, width::GLsizei, height::GLsizei, depth::GLsizei, format::GLenum, imageSize::GLsizei, data::Ptr{Cvoid})::Cvoid
@glfunc glVertexArrayVertexBindingDivisorEXT(vaobj::GLuint, bindingindex::GLuint, divisor::GLuint)::Cvoid
@glfunc glClearBufferfi(buffer::GLenum, drawbuffer::GLint, depth::GLfloat, stencil::GLint)::Cvoid
@glfunc glIsProgram(program::GLuint)::Bool
@glfunc glGetVertexAttribIiv(index::GLuint, pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glGetTransformFeedbackVarying(program::GLuint, index::GLuint, bufSize::GLsizei, length::Ptr{GLsizei}, size::Ptr{GLsizei}, type_::Ptr{GLenum}, name::Ptr{GLchar})::Cvoid
@glfunc glVertexAttribLPointer(index::GLuint, size::GLint, type_::GLenum, stride::GLsizei, pointer::Ptr{Cvoid})::Cvoid
@glfunc glGetFramebufferAttachmentParameteriv(target::GLenum, attachment::GLenum, pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glGetActiveAtomicCounterBufferiv(program::GLuint, bufferIndex::GLuint, pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glProgramUniform3dv(program::GLuint, location::GLint, count::GLsizei, value::Ptr{GLdouble})::Cvoid
@glfunc glUniformMatrix4x3dv(location::GLint, count::GLsizei, transpose::GLboolean, value::Ptr{GLdouble})::Cvoid
@glfunc glVertexAttribI4ubv(index::GLuint, v::Ptr{GLubyte})::Cvoid
@glfunc glCreateProgram()::GLuint
@glfunc glUniformBlockBinding(program::GLuint, uniformBlockIndex::GLuint, uniformBlockBinding::GLuint)::Cvoid
@glfunc glEndQueryIndexed(target::GLenum, index::GLuint)::Cvoid
@glfunc glTexStorage2DMultisample(target::GLenum, samples::GLsizei, internalformat::GLenum, width::GLsizei, height::GLsizei, fixedsamplelocations::GLboolean)::Cvoid
@glfunc glGetSynciv(sync::GLsync, pname::GLenum, bufSize::GLsizei, length::Ptr{GLsizei}, values::Ptr{GLint})::Cvoid
@glfunc glClampColor(target::GLenum, clamp::GLenum)::Cvoid
@glfunc glVertexAttribP3ui(index::GLuint, type_::GLenum, normalized::GLboolean, value::GLuint)::Cvoid
@glfunc glBindAttribLocation(program::GLuint, index::GLuint, name::Ptr{GLchar})::Cvoid
@glfunc glBindVertexBuffer(bindingindex::GLuint, buffer::GLuint, offset::GLintptr, stride::GLsizei)::Cvoid
@glfunc glValidateProgram(program::GLuint)::Cvoid
@glfunc glGetSamplerParameterfv(sampler::GLuint, pname::GLenum, params::Ptr{GLfloat})::Cvoid
@glfunc glGetBooleani_v(target::GLenum, index::GLuint, data::Ptr{GLboolean})::Cvoid
@glfunc glMultiTexCoordP2uiv(texture::GLenum, type_::GLenum, coords::Ptr{GLuint})::Cvoid
@glfunc glFramebufferTexture2D(target::GLenum, attachment::GLenum, textarget::GLenum, texture::GLuint, level::GLint)::Cvoid
@glfunc glEndTransformFeedback()::Cvoid
@glfunc glGetSubroutineUniformLocation(program::GLuint, shadertype::GLenum, name::Ptr{GLchar})::GLint
@glfunc glGetQueryiv(target::GLenum, pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glProgramUniform2d(program::GLuint, location::GLint, v0::GLdouble, v1::GLdouble)::Cvoid
@glfunc glProgramUniform3iv(program::GLuint, location::GLint, count::GLsizei, value::Ptr{GLint})::Cvoid
@glfunc glIsSync(sync::GLsync)::Bool
@glfunc glGetTexParameterIiv(target::GLenum, pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glGetObjectPtrLabel(ptr::Ptr{Cvoid}, bufSize::GLsizei, length::Ptr{GLsizei}, label::Ptr{GLchar})::Cvoid
@glfunc glGetUniformSubroutineuiv(shadertype::GLenum, location::GLint, params::Ptr{GLuint})::Cvoid
@glfunc glTexBuffer(target::GLenum, internalformat::GLenum, buffer::GLuint)::Cvoid
@glfunc glDeleteQueries(n::GLsizei, ids::Ptr{GLuint})::Cvoid
@glfunc glDisablei(target::GLenum, index::GLuint)::Cvoid
@glfunc glNamedFramebufferParameteriEXT(framebuffer::GLuint, pname::GLenum, param::GLint)::Cvoid
@glfunc glGetUniformLocation(program::GLuint, name::Ptr{GLchar})::GLint
@glfunc glMemoryBarrier(barriers::GLbitfield)::Cvoid
@glfunc glGetDoublei_v(target::GLenum, index::GLuint, data::Ptr{GLdouble})::Cvoid
@glfunc glClearBufferuiv(buffer::GLenum, drawbuffer::GLint, value::Ptr{GLuint})::Cvoid
@glfunc glRenderbufferStorage(target::GLenum, internalformat::GLenum, width::GLsizei, height::GLsizei)::Cvoid
@glfunc glViewportIndexedf(index::GLuint, x::GLfloat, y::GLfloat, w::GLfloat, h::GLfloat)::Cvoid
@glfunc glDrawElements(mode::GLenum, count::GLsizei, type_::GLenum, indices::Ptr{Cvoid})::Cvoid
@glfunc glVertexAttribI1ui(index::GLuint, x::GLuint)::Cvoid
@glfunc glUniform2i(location::GLint, v0::GLint, v1::GLint)::Cvoid
@glfunc glGetQueryIndexediv(target::GLenum, index::GLuint, pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glAttachShader(program::GLuint, shader::GLuint)::Cvoid
@glfunc glDrawTransformFeedbackStreamInstanced(mode::GLenum, id::GLuint, stream::GLuint, instancecount::GLsizei)::Cvoid
@glfunc glIsQuery(id::GLuint)::Bool
@glfunc glViewportIndexedfv(index::GLuint, v::Ptr{GLfloat})::Cvoid
@glfunc glVertexBindingDivisor(bindingindex::GLuint, divisor::GLuint)::Cvoid
@glfunc glCopyTexImage2D(target::GLenum, level::GLint, internalformat::GLenum, x::GLint, y::GLint, width::GLsizei, height::GLsizei, border::GLint)::Cvoid
@glfunc glDeleteSamplers(count::GLsizei, samplers::Ptr{GLuint})::Cvoid
@glfunc glGetProgramStageiv(program::GLuint, shadertype::GLenum, pname::GLenum, values::Ptr{GLint})::Cvoid
@glfunc glBindSampler(unit::GLuint, sampler::GLuint)::Cvoid
@glfunc glBindRenderbuffer(target::GLenum, renderbuffer::GLuint)::Cvoid
@glfunc glGetSamplerParameterIuiv(sampler::GLuint, pname::GLenum, params::Ptr{GLuint})::Cvoid
@glfunc glGetTexParameteriv(target::GLenum, pname::GLenum, params::Ptr{GLint})::Cvoid
@glfunc glVertexAttribIFormat(attribindex::GLuint, size::GLint, type_::GLenum, relativeoffset::GLuint)::Cvoid
@glfunc glBlendEquationSeparatei(buf::GLuint, modeRGB::GLenum, modeAlpha::GLenum)::Cvoid
@glfunc glTexImage2DMultisample(target::GLenum, samples::GLsizei, internalformat::GLint, width::GLsizei, height::GLsizei, fixedsamplelocations::GLboolean)::Cvoid
@glfunc glDepthRangef(n::GLfloat, f::GLfloat)::Cvoid
@glfunc glUniform4f(location::GLint, v0::GLfloat, v1::GLfloat, v2::GLfloat, v3::GLfloat)::Cvoid
@glfunc glMapBuffer(target::GLenum, access::GLenum)::Ptr{Cvoid}


text:
addprocs()
using ThreePhotons

# using ThreePhotons
# include("$(ENV["THREEPHOTONS_PATH"])/src/cuda.jl")
# CUDA_init()

LMAX = 25
for N in [32]
  for L in [16]
    for K2 in [38]
        for K3 in [20]
          density,fourier,intensity = createSphericalHarmonicsStructure("$(ENV["DETERMINATION_DATA"])/structures/crambin.pdb", LMAX, K2, float(K2))

          basis = calculate_basis(L, LMAX, N, K3, 4.0, dq(intensity))

          c3 = FullCorrelation_parallized(intensity, basis, true)
          c2 = twoPhotons(intensity, basis, K2, true)
          serializeToFile("$(ENV["DETERMINATION_DATA"])/output/data_generation/correlations_N$(N)_K2_$(K2)_K3_$(K3)_L$(L)_inf.dat", (Dict("num_pictures"=>"inf"),c2,c3))
      end
    end
  end
end


text:
using GardenOptim
using Test

@testset "randomindex" begin
    mask = rand(Bool, 5, 5)
    @test mask[GardenOptim.randomindex(mask)]
end
@testset "swap" begin
    grid = ones(Int, 5, 5)
    grid[2] = 5
    grid[8] = -3
    GardenOptim.swap!(grid, 2, 8)
    @test grid[2] == -3
    @test grid[8] == 5
    @test grid[6] == 1
end
@testset "neighbours" begin
    grid = ones(Int, 5, 5)
    @test length(GardenOptim.neighbours(grid, 4)) == 3
    @test length(GardenOptim.neighbours(grid, 5)) == 2
    @test length(GardenOptim.neighbours(grid, 8)) == 4
    @test length(GardenOptim.neighbours(grid, 25)) == 2
    @test GardenOptim.neighbours(grid, 1) == [1, 1]
    grid[3] = 0
    @test length(GardenOptim.neighbours(grid, 4)) == 2
end
@testset "deltacost" begin
    grid = ones(Int, 5, 5)
    costs = [[1. 0. 2.]; [0. 1. -1.]; [2. -1. 1.]]
    @test GardenOptim.deltacost(grid, costs, 3, 8) == 0
    grid[3] = 2
    grid[9] = 3
    @test GardenOptim.deltacost(grid, costs, 3, 8) != 0
end

max_stars_repo_name: dlozeve/GardenOptim

max_issues_repo_name: dlozeve/GardenOptim

max_forks_repo_name: dlozeve/GardenOptim


text:
function main(routes::Vector{Route})
    server = ServerTemplate(IP, PORT, routes, extensions = [logger])
    TLSERVER = server.start()
    return(TLSERVER)
end

                   #      vvv ?(Connection)
hello_world = route("/") do c
    write!(c, P("hello", text = "hello world!"))
end

fourofour = route("404", P("404", text = "404, not found!"))
rs = routes(hello_world, fourofour)
main(rs)


text:
using Random

ψ = randn(MPS{Float64}, 4, 3, 2)
O = randn(MPO{Float64}, 4, 3, 2)

IMPS = IdentityMPS()
IMPO = IdentityMPO()

@testset "multiplication of IdentityMPO" begin

    @testset "mutlitplication with MPS ψ returns ψ" begin
        @test IMPO * ψ == ψ
        @test ψ * IMPO == ψ
    end

    @testset "mutlitplication with MPO O returns O" begin
        @test IMPO * O == O
    end
end

@testset "Multiplication of IdentityMPS by an MPO O" begin
    ϕ = O * IMPS

    @testset "result has the correct type" begin
        @test typeof(ϕ) == MPS{Float64}
    end

    @testset "length of result is the same as O" begin
        @test length(ϕ) == length(O)
    end

    @testset "the multiplication drops the correct dims" begin
        for i ∈ eachindex(O)
            @test ϕ[i] == dropdims(sum(O[i], dims=4), dims=4)
        end
    end
end

@testset "Identities are singletons" begin
    @test IMPO === IdentityMPO()
    @test IMPS === IdentityMPS()
end

@testset "Identities have infinite length" begin
    @test length(IMPS) == Inf
    @test length(IMPO) == Inf
end

@testset "Indexing identities returns trivial tensors" begin
    @testset "Indexing IdentityMPS" begin
        A = IMPS[42]
        @test length(A) == 1
        @test ndims(A) == 3
        @test norm(A) == 1
    end

    @testset "Indexing IdentityMPO" begin
        B = IMPO[666]
        @test length(B) == 1
        @test ndims(B) == 4
        @test norm(B) == 1
    end
end

@testset "IdentityMPS is only equal to itself" begin
    @test IdentityMPS() == IdentityMPS()

    true_identity = IdentityMPS()
    tensors = [true_identity[i] for i in 1:4]

    @test IdentityMPS() != MPS(tensors)
    @test MPS(tensors) != IdentityMPS()

    Random.seed!(123)
    another_mps = randn(MPS{Float64}, 5, 3, 4)

    @test IdentityMPS() != another_mps
    @test another_mps != IdentityMPS()
end


text:
@testset "Disassembler tests" begin

    @testset "Without operands" begin
        @test disassemble(901) == "INP"
        @test disassemble(902) == "OUT"
        @test disassemble(000) == "HLT"
    end

    @testset "With operands" begin
        @test disassemble(105) == "ADD 5"
        @test disassemble(112) == "ADD 12"
        @test disassemble(243) == "SUB 43"
        @test disassemble(399) == "STA 99"
        @test disassemble(510) == "LDA 10"
        @test disassemble(600) == "BRA 0"
        @test disassemble(645) == "BRA 45"
        @test disassemble(782) == "BRZ 82"
    end
end


text:
facts("Generating set search") do

  ss = symmetric_search_space(3, (0.0, 1.0))
  @fact BlackBoxOptim.calc_initial_step_size(ss) => (0.5 * (1.0 - 0.0))

  ss = symmetric_search_space(3, (-1.2, 42.0))
  @fact BlackBoxOptim.calc_initial_step_size(ss, 0.80) => (0.80 * (42.0 + 1.2))

end


text:
using Revise
using ADSeismic
using ADCME
using PyPlot
using MAT
using DelimitedFiles
using JLD2
using PyCall
matplotlib.use("Agg")
close("all")

ADCME.options.customop.verbose = false

#################################################################
output_dir = "data/elastic"
if !ispath(output_dir)
  mkpath(output_dir)
end

################### Generate synthetic data #####################
reset_default_graph()
mpi_init()

# model_name = "models/marmousi2-model-true-large.mat"
model_name = "models/marmousi2-model-true.mat"
# model_name = "models/BP-model-true.mat"

param = load_params(model_name, "MPIElastic")
compute_PML_Params!(param)

vp = matread(model_name)["vp"]
vs = matread(model_name)["vs"]
rho = matread(model_name)["rho"]

vp = extract_local_patch(param, vp, tag = 0)
vs = extract_local_patch(param, vs, deps = sum(vp), tag = 810000)
rho = extract_local_patch(param, rho, deps = sum(vs), tag = 820000)

λ, μ, ρ = compute_lame_parameters(vp, vs, rho)

# src = load_elastic_source(model_name, use_mpi=true, param=param)[4:4]
# receiver = load_elastic_receiver(model_name, use_mpi=true, param=param)[4:4]
# propagator = x->MPIElasticPropagatorSolver(param, x, ρ, λ, μ)
# [MPISimulatedObservation!(propagator(src[i]), receiver[i]) for i = 1:length(src)]
# Rs_ = [receiver[i].rcvv for i = 1:length(receiver)]

src = load_elastic_source(model_name, use_mpi=true, param=param)
receiver = load_elastic_receiver(model_name, use_mpi=true, param=param)

Rs_ = []
Vs_ = []

@info param.NSTEP, param.n
# for i = 1:length(src)
for i = 1:4
  src_ = src[i]
  receiver_ = receiver[i]

  propagator = MPIElasticPropagatorSolver(param, src_, ρ, λ, μ; tag_offset = i*100000, dep = length(Vs_)==0 ? nothing : sum(Vs_[end]))
  MPISimulatedObservation!(propagator, receiver_)

  # if (i < length(src)) && !ismissing(src[i+1].srcv)
  #   src[i+1].srcv += sum(propagator.vx[end,:]) * 1e-20
  # end

  push!(Rs_, receiver_.rcvv)
  push!(Vs_, propagator.vy)
end
session_conf = tf.ConfigProto(
      inter_op_parallelism_threads=1)
sess = Session(config = session_conf); init(sess)

@info "starting..."

@time Rs = run(sess, Rs_)
@info "saving..."
@save "data/data$(mpi_rank())-$(mpi_size()).jld2" Rs

# vx = run(sess, propagator(src[1]).vx)
# @info "saving..."
# @save "data/vx$(mpi_rank())-$(mpi_size()).jld2" vx

if mpi_rank()==0 && mpi_size()==1
  ii = 1 # source number
  u = run(sess, propagator(src[ii]).vx)
  p = visualize_wavefield(u, param)
  saveanim(p, "marmousi-wavefield.gif")
end

if mpi_size()>1
    mpi_finalize()
end


text:
function iterate_ienumerable(enumerator::CLRObject)
    enumeratorty = T"System.Collections.IEnumerator"
    hasnext = invokemember(enumeratorty, enumerator, :MoveNext)
    hasnext || return nothing
    next = invokemember(enumeratorty, enumerator, :Current)
    return (next, (enumerator, enumeratorty))
end

function iterate_ienumerable_t(enumerator::CLRObject, elt::CLRObject)
    enumeratorty = makegenerictype(T"System.Collections.Generic.IEnumerator`1", elt)
    hasnext = invokemember(enumeratorty, enumerator, :MoveNext)
    hasnext || return nothing
    next = invokemember(enumeratorty, enumerator, :Current)
    return (next, (enumerator, enumeratorty))
end

function Base.iterate(obj::CLRObject)
    isnull(obj) && return nothing
    objty = clrtypeof(obj)
    enumerablety = T"System.Collections.IEnumerable"
    if isassignable(enumerablety, objty)
        enumerator = invokemember(enumerablety, obj, :GetEnumerator)
        return iterate_ienumerable(enumerator)
    end
    elt = clreltype(obj)
    if !isnull(elt)
        enumerablety = makegenerictype(T"System.Collections.Generic.IEnumerable`1", elt)
        if isassignable(enumerablety, objty)
            enumerator = invokemember(enumerablety, obj, :GetEnumerator)
            return iterate_ienumerable(enumerator)
        end
    end
    (unbox(obj), nothing)
end

Base.iterate(::CLRObject, ::Nothing) = nothing

function Base.iterate(::CLRObject, state)
    enumerator, enumeratorty = state
    hasnext = invokemember(enumeratorty, enumerator, :MoveNext)
    hasnext || return nothing
    next = invokemember(enumeratorty, enumerator, :Current)
    return (next, (enumerator, enumeratorty))
end

function clreltype(obj::CLRObject)
    ty = clrtypeof(obj)
    if isassignable(T"System.Collections.IEnumerable", ty) && invokemember(T"System.Type", ty, :IsGenericType)
        return arrayload(invokemember(T"System.Type", ty, :GetGenericArguments), 0)
    end
    invokemember(T"System.Type", ty, :GetElementType)
end

function Base.eltype(obj::CLRObject)
    elt = clreltype(obj)
    typestr = string(isnull(elt) ? Any : elt)
    return if haskey(TYPES_TO_UNBOX, typestr)
        TYPES_TO_UNBOX[typestr][1]
    else
        CLRObject
    end
end

function Base.length(obj::CLRObject)
    objty = clrtypeof(obj)
    if isassignable(T"System.Array", objty)
        invokemember(T"System.Array", obj, :Length)
    elseif isassignable(T"System.Collections.IList", objty)
        invokemember(obj, :Count)
    else
        throw(ArgumentError("length() is not supported by $objty"))
    end
end

function Base.axes(obj::CLRObject)
    objty = clrtypeof(obj)
    if isassignable(T"System.Array", objty)
        rank = invokemember(obj, :Rank)
        tuple((invokemember(obj, :GetLength, Int32(d)) for d = 0:rank-1)...)
    elseif isassignable(T"System.Collections.IList", objty)
        (Base.OneTo(invokemember(obj, :Count)),)
    else
        throw(ArgumentError("axes() is not supported by $objty"))
    end
end

function Base.IteratorSize(obj::CLRObject)
    objty = clrtypeof(obj)
    if isassignable(T"System.Array", objty)
        rank = invokemember(obj, :Rank)
        Base.HasShape{rank}()
    elseif isassignable(T"System.Collections.IList", objty)
        Base.HasLength()
    else
        Base.SizeUnknown()
    end
end

function arrayof(elty::CLRObject, dims)
    invokemember(T"System.Array", CLRObject(0), :CreateInstance, elty, dims...)
end

function arraystore(arr::CLRObject, index, x)
    invokemember(T"System.Array", arr, :SetValue, x, index...)
end

function arrayload(arr::CLRObject, index)
    invokemember(T"System.Array", arr, :GetValue, index...)
end

makearraytype(ty::CLRObject, rank) = invokemember(ty, :MakeArrayType, rank)

function box(x::AbstractArray{T,N}, handle) where {T,N}
    a = arrayof(boxedtype(T), size(x))
    clrind = PermutedDimsArray(CartesianIndices(size(x)), ndims(x):-1:1)
    for i in LinearIndices(x)
        arraystore(a, Tuple(clrind[i]) .- 1, x[i])
    end
    return gethandle(a)
end

boxedtype(::Type{AbstractArray{T,N}}) where {T,N} = makearraytype(boxedtype(T), N)