content stringlengths 6 1.03M | input_ids listlengths 4 535k | ratio_char_token float64 0.68 8.61 | token_count int64 4 535k |
|---|---|---|---|
function _local_baseline(xs, ys, xₗ, xᵣ, b::UncertainBound)
ŷₗ = mean(lininterp(q, xs, ys) for q in b._left_quantiles)
ŷᵣ = mean(lininterp(q, xs, ys) for q in b._right_quantiles)
x̂ₗ = b._left_quantiles[IDX_BOUND_MEDIAN]
x̂ᵣ = b._right_quantiles[IDX_BOUND_MEDIAN]
yₗ = lininterp(xₗ, x̂ₗ, x̂ᵣ, ŷₗ, ... | [
8818,
4808,
12001,
62,
12093,
4470,
7,
34223,
11,
331,
82,
11,
2124,
158,
224,
245,
11,
2124,
39611,
96,
11,
275,
3712,
3118,
39239,
49646,
8,
198,
220,
220,
220,
331,
136,
224,
158,
224,
245,
796,
1612,
7,
2815,
3849,
79,
7,
80... | 2.333333 | 1,320 |
# https://arxiv.org/abs/1511.05286
struct SegmentedLSE{T, U} <: AggregationFunction
ρ::T
C::U
end
Flux.@functor SegmentedLSE
SegmentedLSE(d::Int) = SegmentedLSE(randn(Float32, d), zeros(Float32, d))
r_map(ρ) = softplus.(ρ)
inv_r_map = (r) -> max.(r, 0) .+ log1p.(-exp.(-abs.(r)))
(m::SegmentedLSE)(x::MaybeMa... | [
2,
3740,
1378,
283,
87,
452,
13,
2398,
14,
8937,
14,
1314,
1157,
13,
2713,
27033,
198,
7249,
1001,
5154,
276,
43,
5188,
90,
51,
11,
471,
92,
1279,
25,
19015,
43068,
22203,
198,
220,
220,
220,
18074,
223,
3712,
51,
198,
220,
220,
... | 1.774209 | 2,055 |
for p in ("Knet","ArgParse","Images")
Pkg.installed(p) == nothing && Pkg.add(p)
end
include(Pkg.dir("Knet","data","mnist.jl"))
include(Pkg.dir("Knet","data","imagenet.jl"))
module CGAN
using Knet
using Images
using ArgParse
using JLD2, FileIO
function main(args)
o = parse_options(args)
o[:seed] > 0 && Kne... | [
1640,
279,
287,
5855,
42,
3262,
2430,
28100,
10044,
325,
2430,
29398,
4943,
198,
220,
220,
220,
350,
10025,
13,
37050,
7,
79,
8,
6624,
2147,
11405,
350,
10025,
13,
2860,
7,
79,
8,
198,
437,
198,
17256,
7,
47,
10025,
13,
15908,
720... | 2.049364 | 4,011 |
<reponame>ven-k/SciMLBenchmarks.jl<gh_stars>0
using DiffEqBase, DiffEqJump, DiffEqProblemLibrary, Plots, Statistics
using DiffEqProblemLibrary.JumpProblemLibrary: importjumpproblems; importjumpproblems()
import DiffEqProblemLibrary.JumpProblemLibrary: prob_jump_dnarepressor
gr()
fmt = :png
methods = (Direct(),Direct... | [
27,
7856,
261,
480,
29,
574,
12,
74,
14,
50,
979,
5805,
44199,
14306,
13,
20362,
27,
456,
62,
30783,
29,
15,
198,
198,
3500,
10631,
36,
80,
14881,
11,
10631,
36,
80,
36046,
11,
10631,
36,
80,
40781,
23377,
11,
1345,
1747,
11,
14... | 2.49311 | 1,016 |
<filename>backend/anime_data/snapshots_37976.jl
{"score": 7.69, "timestamp": 1571343527.0, "score_count": 94393}
{"score": 7.7, "timestamp": 1565672260.0, "score_count": 89634}
{"score": 7.7, "timestamp": 1565143946.0, "score_count": 89634}
{"score": 7.7, "timestamp": 1565141744.0, "score_count": 89634}
{"score": 7.7, ... | [
27,
34345,
29,
1891,
437,
14,
272,
524,
62,
7890,
14,
45380,
20910,
62,
29088,
4304,
13,
20362,
198,
4895,
26675,
1298,
767,
13,
3388,
11,
366,
16514,
27823,
1298,
23313,
19880,
2327,
1983,
13,
15,
11,
366,
26675,
62,
9127,
1298,
10... | 2.357283 | 4,064 |
<filename>src/sim.jl
struct BanditSim
b::Bandit
G::ObjectiveFunc
metadata::Dict
end
function BanditSim(b::Bandit, G::ObjectiveFunc)
BanditSim(b, G, Dict(:sim_algorithm=>string(b), :sim_objective=>string(G)))
end
POMDPs.simulate(sim::BanditSim) = POMDPs.solve(sim.b, sim.G)
| [
27,
34345,
29,
10677,
14,
14323,
13,
20362,
198,
7249,
10243,
270,
8890,
198,
220,
220,
220,
275,
3712,
31407,
270,
198,
220,
220,
220,
402,
3712,
10267,
425,
37,
19524,
220,
198,
220,
220,
220,
20150,
3712,
35,
713,
198,
437,
198,
... | 2.221374 | 131 |
<filename>test/glue/hooks.jl
# TODO: Need a simple environment for test here! | [
27,
34345,
29,
9288,
14,
4743,
518,
14,
25480,
82,
13,
20362,
198,
2,
16926,
46,
25,
10664,
257,
2829,
2858,
329,
1332,
994,
0
] | 3.08 | 25 |
function planar_rx()
v2he = Dict{Int, Int}(
1 => 1,
2 => 9,
3 => 4,
4 => 8,
5 => 6,
6 => 14,
)
half_edges = Dict{Int, HalfEdge}(
1 => HalfEdge(1, 2),
2 => HalfEdge(2, 1),
3 => HalfEdge(1, 3),
4 => HalfEdge(3, 1),
5 => Ha... | [
8818,
1410,
283,
62,
40914,
3419,
198,
220,
220,
220,
410,
17,
258,
796,
360,
713,
90,
5317,
11,
2558,
92,
7,
198,
220,
220,
220,
220,
220,
220,
220,
352,
5218,
352,
11,
198,
220,
220,
220,
220,
220,
220,
220,
362,
5218,
860,
... | 1.615806 | 11,856 |
module IOtxt
# types
StringVector = Vector{String}
export
getFilesInDir,
readEEG
# read EEG data from a .txt file in LORETA format and put it in a matrix
# of dimension txn, where n=#electrodes and t=#samples.
# if optional keyword argument `msg` is not empty, print `msg` on exit
function readEEG(filename:... | [
21412,
220,
24418,
14116,
198,
198,
2,
3858,
198,
10100,
38469,
796,
20650,
90,
10100,
92,
198,
198,
39344,
198,
220,
220,
220,
651,
25876,
818,
35277,
11,
198,
220,
220,
220,
1100,
6500,
38,
628,
198,
2,
1100,
48749,
1366,
422,
257... | 2.557784 | 1,047 |
<filename>Interpreter/lib/src/default/math.jl<gh_stars>1-10
def epsilon 0.000001
def int_pow(x, n) if 1 == n x else x*int_pow(x,n-1)
def pow(x,n) {
{result, value, power} = (1f, x as Float, n)
while power > epsilon {
if power % 2 == 1
result = result*value
{value, power} =... | [
27,
34345,
29,
9492,
3866,
353,
14,
8019,
14,
10677,
14,
12286,
14,
11018,
13,
20362,
27,
456,
62,
30783,
29,
16,
12,
940,
198,
4299,
304,
862,
33576,
657,
13,
2388,
486,
201,
198,
201,
198,
4299,
493,
62,
79,
322,
7,
87,
11,
... | 1.806122 | 294 |
using FastTransforms, Makie, Random
include("SLPDE.jl")
include("etdrk4.jl")
include("evaluate_lambda.jl")
include("sphcesaro.jl")
Random.seed!(0)
n = 64
U0 = zeros(4n, 8n-1);
U0[1:n, 1:2n-1] = sphrandn(Float64, n, 2n-1)/n
n = size(U0, 1)
θ = [0;(0.5:n-0.5)/n;1]
φ = [(0:2n-2)*2/(2n-1);2]
x = Float32[cospi(φ)*sinpi(... | [
3500,
12549,
8291,
23914,
11,
15841,
494,
11,
14534,
198,
198,
17256,
7203,
8634,
5760,
36,
13,
20362,
4943,
198,
17256,
7203,
316,
7109,
74,
19,
13,
20362,
4943,
198,
17256,
7203,
49786,
62,
50033,
13,
20362,
4943,
198,
17256,
7203,
... | 1.874804 | 639 |
<filename>src/BasicDirectory.jl<gh_stars>1-10
export BasicDirectory
"""
BasicDirectory(map::BlockMap)
Creates a BasicDirectory, which implements the methods of Directory with
basic implmentations
"""
mutable struct BasicDirectory{GID <: Integer, PID <:Integer, LID <: Integer} <: Directory{GID, PID, LID}
map::B... | [
27,
34345,
29,
10677,
14,
26416,
43055,
13,
20362,
27,
456,
62,
30783,
29,
16,
12,
940,
198,
39344,
14392,
43055,
198,
198,
37811,
198,
220,
220,
220,
14392,
43055,
7,
8899,
3712,
12235,
13912,
8,
198,
16719,
274,
257,
14392,
43055,
... | 1.950134 | 4,111 |
# Active patterns
module Active
using MLStyle
using MLStyle.Infras
using MLStyle.MatchCore
using MLStyle.Qualification
using MLStyle.TypeVarExtraction
export @active, def_active_pattern
function def_active_pattern(qualifier_ast, case, active_body, mod)
(case_name, IDENTS, param) = @match case begin
:($(ca... | [
2,
14199,
7572,
198,
21412,
14199,
198,
3500,
13981,
774,
293,
198,
3500,
13981,
774,
293,
13,
818,
8310,
292,
198,
3500,
13981,
774,
293,
13,
23850,
14055,
198,
3500,
13981,
774,
293,
13,
46181,
2649,
198,
3500,
13981,
774,
293,
13,
... | 1.797053 | 2,104 |
<filename>__lib__/math/ode/test/test_ode_sample.jl
include("../ode_test_functions/ode_test_functions.jl")
include("../src/ode_module.jl")
module otest
using ..odesample
using ..ode
using PyPlot
PyPlot.pygui(true)
time_interval = ode.TimeInterval(5.0)
initial_values = [0.0, 1.0]
options =... | [
27,
34345,
29,
834,
8019,
834,
14,
11018,
14,
1098,
14,
9288,
14,
9288,
62,
1098,
62,
39873,
13,
20362,
198,
201,
198,
201,
198,
17256,
7203,
40720,
1098,
62,
9288,
62,
12543,
2733,
14,
1098,
62,
9288,
62,
12543,
2733,
13,
20362,
... | 1.985149 | 404 |
using Documenter, TriMatrices
makedocs(;
modules=[TriMatrices],
authors="<NAME>",
repo="https://github.com/jlumpe/TriMatrices.jl/blob/{commit}{path}#L{line}",
sitename="TriMatrices.jl",
pages=[
"index.md",
"api.md",
],
)
deploydocs(
repo="github.com/jlumpe/TriMatrices.jl.git",
) | [
3500,
16854,
263,
11,
7563,
19044,
45977,
628,
198,
76,
4335,
420,
82,
7,
26,
198,
197,
18170,
41888,
14824,
19044,
45977,
4357,
198,
197,
41617,
2625,
27,
20608,
29,
1600,
198,
197,
260,
7501,
2625,
5450,
1378,
12567,
13,
785,
14,
... | 2.244275 | 131 |
using JuliaSet
using Base.Test
# write your own tests here
@test 1 == 1
x = collect((-10:10)/100);
y = collect((-10:10)/100);
n_iter = 10;
escape_tol = 5;
function R(z)
return z
end
A=GenerateJuliaSet(R,x,y,n_iter);
@test all(A.==escape_tol+1); | [
3500,
22300,
7248,
198,
3500,
7308,
13,
14402,
198,
198,
2,
3551,
534,
898,
5254,
994,
198,
31,
9288,
352,
6624,
352,
198,
198,
87,
796,
2824,
19510,
12,
940,
25,
940,
20679,
3064,
1776,
198,
88,
796,
2824,
19510,
12,
940,
25,
940... | 2.252252 | 111 |
d = rand(2:4)
A, B = rand(d, d), rand(d, d)
α = rand()
@test isapprox(det(A * B), det(A) * det(B))
@test isapprox(det(A * B), det(B) * det(A))
@test isapprox(det(A * B), det(B * A))
@test isapprox(det(convert(Array{Float64}, transpose(A))), det(A))
@test isapprox(det(α .* A), α^d * det(A))
| [
67,
796,
43720,
7,
17,
25,
19,
8,
198,
32,
11,
347,
796,
43720,
7,
67,
11,
288,
828,
43720,
7,
67,
11,
288,
8,
198,
17394,
796,
43720,
3419,
628,
198,
31,
9288,
318,
1324,
13907,
7,
15255,
7,
32,
1635,
347,
828,
1062,
7,
32,... | 2.034722 | 144 |
# p33.jl - solve linear BVP u_xx = exp(4x), u'(-1)=u(1)=0
N = 16;
(D,x) = cheb(N);
D2 = D^2;
D2[N+1,:] = D[N+1,:]; # Neumann condition at x = -1
D2 = D2[2:N+1,2:N+1];
f = @. exp(4*x[2:N]);
u = D2\[f;0];
u = [0;u];
clf();
plot(x,u,".",markersize=10);
axis([-1,1,-4,0]);
xx = -1:.01:1;
uu = polyval(polyfit(x,u... | [
2,
279,
2091,
13,
20362,
532,
8494,
14174,
347,
8859,
334,
62,
5324,
796,
1033,
7,
19,
87,
828,
334,
6,
32590,
16,
47505,
84,
7,
16,
47505,
15,
198,
198,
45,
796,
1467,
26,
198,
7,
35,
11,
87,
8,
796,
1125,
65,
7,
45,
1776,
... | 1.718978 | 274 |
using Test, SpectralDistances, DSP, ControlSystems, Optim
import SpectralDistances: softmax
ip(x,y) = x'y/norm(x)/norm(y)
# const Continuous = SpectralDistances.Continuous
@testset "ISA" begin
@info "Testing ISA"
## Extreme case 1- each measure is like a point, the bc should be close to the Euclidean mean of ... | [
3500,
6208,
11,
13058,
1373,
20344,
1817,
11,
360,
4303,
11,
6779,
11964,
82,
11,
30011,
198,
11748,
13058,
1373,
20344,
1817,
25,
2705,
9806,
198,
541,
7,
87,
11,
88,
8,
796,
2124,
6,
88,
14,
27237,
7,
87,
20679,
27237,
7,
88,
... | 2.008206 | 8,774 |
using QuadDIRECT, StaticArrays, LinearAlgebra
using Test
@testset "Bounded least squares" begin
B = [1 -0.2; -0.2 2]
f = [-15.0,7.0]
xunc = -B\f
x = QuadDIRECT.lls_bounded(B, f, [-1,-1], [1,1])
@test x ≈ [1,-1]
x = QuadDIRECT.lls_bounded(B, f, [-10,-3], [10,3])
@test x ≈ [10,-2.5]
x = Q... | [
3500,
20648,
17931,
23988,
11,
36125,
3163,
20477,
11,
44800,
2348,
29230,
198,
3500,
6208,
198,
198,
31,
9288,
2617,
366,
33,
6302,
1551,
24438,
1,
2221,
198,
220,
220,
220,
347,
796,
685,
16,
532,
15,
13,
17,
26,
532,
15,
13,
17... | 1.983362 | 8,655 |
<filename>src/nexproperties.jl
"""
setnexproperty!(nid::NexID, property::Symbol, val)
Set property of a Nextion object given by it's NexID
# Example:
`setnexproperty!(NexID("t0"), :txt, "Hello!")` send and execute
on the Nextion display `t0.txt="Hello"`
`setnexproperty!(NexID("n0"), :val, 3)` send and execute
on the... | [
27,
34345,
29,
10677,
14,
12413,
48310,
13,
20362,
198,
37811,
198,
2617,
12413,
26745,
0,
7,
77,
312,
3712,
45,
1069,
2389,
11,
3119,
3712,
13940,
23650,
11,
1188,
8,
198,
198,
7248,
3119,
286,
257,
7406,
295,
2134,
1813,
416,
340,... | 2.499506 | 1,013 |
<reponame>foldfelis/Terming.jl
struct QuitEvent <: T.Event end
Base.show(io::IO, ::QuitEvent) = Base.print(io, "QuitEvent")
struct App
pipeline::Vector{Channel}
end
get_event_queue(app::App) = app.pipeline[end]
function init_pipeline(size=Inf)
sequence_queue = Channel{String}(size, spawn=true) do ch
... | [
27,
7856,
261,
480,
29,
11379,
69,
417,
271,
14,
15156,
2229,
13,
20362,
198,
7249,
48887,
9237,
1279,
25,
309,
13,
9237,
886,
198,
198,
14881,
13,
12860,
7,
952,
3712,
9399,
11,
7904,
4507,
270,
9237,
8,
796,
7308,
13,
4798,
7,
... | 2.268945 | 673 |
# # Foundations of Bilevel Programming: Example 5
# This example is from the book _Foundations of Bilevel Programming_ by Stephan
# Dempe, Chapter 8.1, Page 255. [url](https://www.springer.com/gp/book/9781402006319)
# Here, only the second level is described
# Model of the problem
# First level
# ```math
# \min 0,\\
... | [
2,
1303,
4062,
602,
286,
347,
576,
626,
30297,
25,
17934,
642,
198,
2,
770,
1672,
318,
422,
262,
1492,
4808,
21077,
602,
286,
347,
576,
626,
30297,
62,
416,
20800,
198,
2,
1897,
431,
11,
7006,
807,
13,
16,
11,
7873,
14280,
13,
6... | 2.845261 | 517 |
<gh_stars>10-100
const IT = Interpolations
function pairs(curve::Contour.Curve2)
collect(zip(Contour.coordinates(curve)...))
end
function LinearInterpolation(xs,ys,A)
itp = IT.interpolate(A, IT.BSpline(IT.Linear(IT.OnGrid())))
IT.scale(itp, xs, ys)
end
function CubicInterpolation(xs,ys,A)
itp = IT.i... | [
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
198,
9979,
7283,
796,
4225,
16104,
602,
198,
198,
8818,
14729,
7,
22019,
303,
3712,
4264,
454,
13,
26628,
303,
17,
8,
198,
220,
220,
220,
2824,
7,
13344,
7,
4264,
454,
13,
37652,
17540,
... | 1.90836 | 1,244 |
@testset "xnor constraint violated or solved?" begin
m = Model(optimizer_with_attributes(CS.Optimizer, "no_prune" => true, "logging" => []))
@variable(m, 0 <= x[1:2] <= 5, Int)
@constraint(m, !((sum(x) <= 2) ⊻ (sum(x) > 3)))
optimize!(m)
com = CS.get_inner_model(m)
variables = com.search_space
... | [
31,
9288,
2617,
366,
87,
13099,
32315,
13998,
393,
16019,
1701,
2221,
198,
220,
220,
220,
285,
796,
9104,
7,
40085,
7509,
62,
4480,
62,
1078,
7657,
7,
7902,
13,
27871,
320,
7509,
11,
366,
3919,
62,
1050,
1726,
1,
5218,
2081,
11,
3... | 2.285156 | 5,632 |
#printing that is not needed in Atom
import Base: show
show(io::IO, block::InputData) = df_show(io, block)
show(io::IO, band::Band) = df_show(io, band)
show(io::IO, job::Job) = df_show(io, job)
show(io::IO, c::Calculation) = df_show(io, c)
show(io::IO, flag_info::Calculations.QEFlagInfo) = df_show(io, flag_info)
sho... | [
2,
4798,
278,
326,
318,
407,
2622,
287,
33102,
198,
11748,
7308,
25,
905,
198,
198,
12860,
7,
952,
3712,
9399,
11,
2512,
3712,
20560,
6601,
8,
796,
47764,
62,
12860,
7,
952,
11,
2512,
8,
198,
198,
12860,
7,
952,
3712,
9399,
11,
... | 2.36 | 275 |
# The infite loop was patched with a killswitch after certain number of iterations.
# Now the obtained reconstructions are too good to be real and I need to check what
push!(LOAD_PATH, "../models")
push!(LOAD_PATH, "../")
using SparseInverseProblems
using SuperResModels
using TestCases
using Utils
using PyCall
@pyimpo... | [
2,
383,
1167,
578,
9052,
373,
39378,
351,
257,
1494,
31943,
706,
1728,
1271,
286,
34820,
13,
198,
2,
2735,
262,
6492,
31081,
507,
389,
1165,
922,
284,
307,
1103,
290,
314,
761,
284,
2198,
644,
198,
14689,
0,
7,
35613,
62,
34219,
1... | 2.604552 | 1,406 |
<gh_stars>10-100
using MonteCarloMeasurements: Particles
@testset "InferenceData" begin
data = load_arviz_data("centered_eight")
@testset "construction" begin
pydata = PyObject(data)
@test InferenceData(pydata) isa InferenceData
@test PyObject(InferenceData(pydata)) === pydata
... | [
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
3500,
22489,
9914,
5439,
47384,
902,
25,
2142,
2983,
198,
198,
31,
9288,
2617,
366,
818,
4288,
6601,
1,
2221,
198,
220,
220,
220,
1366,
796,
3440,
62,
283,
85,
528,
62,
7890,
7203,
38050... | 2.121983 | 3,025 |
function persistence(num)
count = 0
while num > 9
num = reduce(*,digits(num))
count += 1
end
count
end | [
8818,
30802,
7,
22510,
8,
198,
220,
220,
220,
954,
796,
657,
198,
220,
220,
220,
981,
997,
1875,
860,
198,
220,
220,
220,
220,
220,
220,
220,
997,
796,
4646,
7,
25666,
12894,
896,
7,
22510,
4008,
198,
220,
220,
220,
220,
220,
22... | 2.196721 | 61 |
<reponame>FelipeLema/Lint.jl
@testset "Dictionary keys" begin
s = """
Dict(:a=>1, :b=>2, :a=>3)
"""
msgs = lintstr(s)
@test msgs[1].code == :E334
s = """
Dict{Symbol,Int}(:a=>1, :b=>"")
"""
msgs = lintstr(s)
@test msgs[1].code == :E532
s = """
Dict{Symbol,Int}(:a=>1, "b"=>2)
"""
msgs =... | [
27,
7856,
261,
480,
29,
42493,
3757,
43,
19687,
14,
43,
600,
13,
20362,
198,
31,
9288,
2617,
366,
35,
14188,
8251,
1,
2221,
198,
220,
220,
220,
264,
796,
37227,
198,
35,
713,
7,
25,
64,
14804,
16,
11,
1058,
65,
14804,
17,
11,
... | 1.812808 | 203 |
<reponame>ilancoulon/GeometricFlux.jl<filename>src/operations/linalg.jl<gh_stars>0
## Linear algebra API for adjacency matrix
using LinearAlgebra
function adjacency_matrix(adj::AbstractMatrix, T::DataType=eltype(adj))
m, n = size(adj)
(m == n) || throw(DimensionMismatch("adjacency matrix is not a square matrix... | [
27,
7856,
261,
480,
29,
346,
1192,
2852,
261,
14,
10082,
16996,
37,
22564,
13,
20362,
27,
34345,
29,
10677,
14,
3575,
602,
14,
75,
1292,
70,
13,
20362,
27,
456,
62,
30783,
29,
15,
198,
2235,
44800,
37139,
7824,
329,
9224,
330,
138... | 2.664563 | 2,060 |
# TODO: remove `vars` hack that avoids https://github.com/Alexander-Barth/NCDatasets.jl/issues/135
mutable struct NetCDFIO_Stats
root_grp::NC.NCDataset{Nothing}
profiles_grp::NC.NCDataset{NC.NCDataset{Nothing}}
ts_grp::NC.NCDataset{NC.NCDataset{Nothing}}
grid::Grid
last_output_time::Float64
uu... | [
198,
2,
16926,
46,
25,
4781,
4600,
85,
945,
63,
8156,
326,
30940,
3740,
1378,
12567,
13,
785,
14,
38708,
12,
10374,
400,
14,
7792,
27354,
292,
1039,
13,
20362,
14,
37165,
14,
17059,
198,
198,
76,
18187,
2878,
3433,
34,
8068,
9399,
... | 2.070404 | 2,997 |
<gh_stars>0
using FastRecurFlux
using Flux
using Random
using Statistics
using Test
subarray(x::AbstractArray{T, N}) where {T, N} = view(x, ntuple(i -> :, N)...)
@testset "FastRecurFlux.jl" begin
M, V = rand(10, 10), rand(10, 1)
for lsub in (true, false), ltrans in (true, false),
rsub in (true, false... | [
27,
456,
62,
30783,
29,
15,
198,
3500,
12549,
6690,
333,
37,
22564,
198,
3500,
1610,
2821,
198,
3500,
14534,
198,
3500,
14370,
198,
3500,
6208,
198,
198,
7266,
18747,
7,
87,
3712,
23839,
19182,
90,
51,
11,
399,
30072,
810,
1391,
51,... | 1.739958 | 946 |
<gh_stars>10-100
using NeuralQuantum, Test
using NeuralQuantum: set_index!, trainable_first
using NeuralQuantum: out_similar, unsafe_get_batch
num_types = [Float32, Float64]
atol_types = [1e-5, 1e-8]
machines = Dict()
ma = (T, N) -> RBMSplit(T, N, 2)
machines["RBMSplit"] = ma
ma = (T, N) -> NDM(T, N, 2, 3, NeuralQu... | [
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
3500,
47986,
24915,
388,
11,
6208,
198,
3500,
47986,
24915,
388,
25,
900,
62,
9630,
28265,
4512,
540,
62,
11085,
198,
3500,
47986,
24915,
388,
25,
503,
62,
38610,
11,
21596,
62,
1136,
62,
... | 1.832975 | 2,790 |
<reponame>iskyd/validators.jl<filename>src/isip.jl
using Printf
export isip
function isip(str::AbstractString, version::Int=0)::Bool
ipv4SegmentFormat = "(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])"
ipv4AddressFormat = @sprintf("(%s[.]){3}%s", ipv4SegmentFormat, ipv4SegmentFormat)
ipv4AddressReg ... | [
27,
7856,
261,
480,
29,
1984,
5173,
14,
12102,
2024,
13,
20362,
27,
34345,
29,
10677,
14,
271,
541,
13,
20362,
198,
3500,
12578,
69,
198,
198,
39344,
318,
541,
198,
198,
8818,
318,
541,
7,
2536,
3712,
23839,
10100,
11,
2196,
3712,
... | 1.898955 | 861 |
<reponame>giordano/DataScienceTutorials.jl<gh_stars>10-100
# This file was generated, do not modify it. # hide
using MLJ, PrettyPrinting, DataFrames, Statistics
X, y = @load_reduced_ames
X = DataFrame(X)
@show size(X)
first(X, 3) |> pretty | [
27,
7856,
261,
480,
29,
12397,
585,
5733,
14,
6601,
26959,
51,
44917,
82,
13,
20362,
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
2,
770,
2393,
373,
7560,
11,
466,
407,
13096,
340,
13,
1303,
7808,
198,
3500,
10373,
41,
11,
20090,
... | 2.696629 | 89 |
ansi(x) = string("\x1b[", x, "m")
clear = ansi(0)
bold = ansi(1)
black = ansi(30)
red = ansi(31)
green = ansi(32)
yellow = ansi(33)
blue = ansi(34)
magenta = ansi(35)
cyan = ansi(36)
white = ansi(37)
"""
log(str...)
Simply prints the arguments provided. This may be reworked later to provide
more robust lo... | [
504,
72,
7,
87,
8,
796,
4731,
7203,
59,
87,
16,
65,
58,
1600,
2124,
11,
366,
76,
4943,
198,
20063,
796,
9093,
72,
7,
15,
8,
198,
36575,
796,
9093,
72,
7,
16,
8,
198,
13424,
796,
9093,
72,
7,
1270,
8,
198,
445,
796,
9093,
7... | 2.837758 | 339 |
<reponame>UnofficialJuliaMirror/CodecXz.jl-ba30903b-d9e8-5048-a5ec-d1f5b0d4b47b
using CodecXz
using TranscodingStreams
using Test
@testset "Xz Codec" begin
codec = XzCompressor()
@test codec isa XzCompressor
@test occursin(r"^(CodecXz\.)?XzCompressor\(level=\d, check=\d+\)$", sprint(show, codec))
@test... | [
27,
7856,
261,
480,
29,
3118,
16841,
16980,
544,
27453,
1472,
14,
43806,
721,
55,
89,
13,
20362,
12,
7012,
26895,
3070,
65,
12,
67,
24,
68,
23,
12,
1120,
2780,
12,
64,
20,
721,
12,
67,
16,
69,
20,
65,
15,
67,
19,
65,
2857,
6... | 2.271919 | 787 |
<reponame>AI4DBiological-Systems/NMRDataSetup.jl<gh_stars>0
module NMRDataSetup
import PyCall, Optim, NLopt
include("utils.jl")
include("DSP.jl")
include("load.jl")
include("assemble_mixture.jl")
export loadspectrum, getwraparoundDFTfreqs, evalcomplexLorentzian, gettimerange
end
| [
27,
7856,
261,
480,
29,
20185,
19,
11012,
15071,
12,
11964,
82,
14,
45,
13599,
6601,
40786,
13,
20362,
27,
456,
62,
30783,
29,
15,
198,
21412,
399,
13599,
6601,
40786,
198,
198,
11748,
9485,
14134,
11,
30011,
11,
22879,
8738,
198,
1... | 2.679245 | 106 |
@testset "Test Linear Basis" begin
bas1 = BasisMatrices.Basis(BasisMatrices.Lin(), [0.0,4.0], 5)
@testset "test type" begin
bas2 = BasisMatrices.Basis(BasisMatrices.Lin(), [0.0,2.0,4.0], 5)
@test bas1.params[1].breaks == [0.0,1.0,2.0,3.0,4.0]
@test bas2.params[1].evennum == 3
... | [
31,
9288,
2617,
366,
14402,
44800,
6455,
271,
1,
2221,
628,
220,
220,
220,
1615,
16,
796,
6455,
271,
19044,
45977,
13,
15522,
271,
7,
15522,
271,
19044,
45977,
13,
14993,
22784,
685,
15,
13,
15,
11,
19,
13,
15,
4357,
642,
8,
628,
... | 2.140039 | 507 |
isdefined(Base, :__precompile__) && __precompile__()
module BeaData
using Requests
using DataFrames, DataStructures
using DocStringExtensions
using Compat
import Base.show
export
Bea,
BeaNipaTable,
get_nipa_table,
nipa_metadata_tex,
table_metadata_tex
const DEFAULT_API_URL = "http://www.bea.go... | [
271,
23211,
7,
14881,
11,
1058,
834,
3866,
5589,
576,
834,
8,
11405,
11593,
3866,
5589,
576,
834,
3419,
198,
198,
21412,
1355,
64,
6601,
198,
198,
3500,
9394,
3558,
198,
3500,
6060,
35439,
11,
6060,
44909,
942,
198,
3500,
14432,
10100... | 2.481764 | 1,179 |
<gh_stars>100-1000
# Returns index corresponding to the name in NamedTupleDist.
# If the name corresponds to a multivariate distribution,
# an array containig all indices of this distribution is returned.
function asindex(vs::NamedTupleShape, name::Symbol)
name = string(name)
if name in (rn = repeatednames(vs))... | [
27,
456,
62,
30783,
29,
3064,
12,
12825,
198,
2,
16409,
6376,
11188,
284,
262,
1438,
287,
34441,
51,
29291,
20344,
13,
198,
2,
1002,
262,
1438,
24866,
284,
257,
1963,
42524,
6082,
11,
198,
2,
281,
7177,
3994,
328,
477,
36525,
286,
... | 2.762445 | 1,145 |
# Load sample, Calculate and Plot STA
# load sample (stim and ρ)
include("sample.jl")
# Calculate STA
include("sta.jl")
num_timesteps = 150
sta_val = sta(stim, ρ, num_timesteps)
# Plot
using PyPlot
time = 1-length(sta_val):0
plot(time*2, sta_val, color="red", linewidth=1.0, linestyle="-")
xlabel("Time (ms)");
... | [
2,
8778,
6291,
11,
27131,
378,
290,
28114,
47550,
220,
198,
198,
2,
3440,
6291,
357,
42003,
290,
18074,
223,
8,
198,
17256,
7203,
39873,
13,
20362,
4943,
198,
198,
2,
27131,
378,
47550,
198,
17256,
7203,
38031,
13,
20362,
4943,
198,
... | 2.503356 | 149 |
<filename>test/lib.jl
#=
Copyright (c) 2015, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of co... | [
27,
34345,
29,
9288,
14,
8019,
13,
20362,
198,
2,
28,
198,
15269,
357,
66,
8,
1853,
11,
8180,
10501,
198,
3237,
2489,
10395,
13,
198,
198,
7738,
396,
3890,
290,
779,
287,
2723,
290,
13934,
5107,
11,
351,
393,
1231,
220,
198,
4666,... | 2.45144 | 1,493 |
<reponame>Wicmage/GraphAlgorithms.jl
function diversity(graph::AbstractGraph)
D = Dict{Integer,Number}()
k = degree(graph)
w = Dict{AbstractEdge,Number}()
for e = edges(graph)
w[e] = typeof(graph)<:AbstractSimpleWeightedGraph ? weight(e) : 1
end
for v = vertices(graph)
Ev = edg... | [
27,
7856,
261,
480,
29,
54,
291,
25561,
14,
37065,
2348,
7727,
907,
13,
20362,
198,
8818,
9573,
7,
34960,
3712,
23839,
37065,
8,
198,
220,
220,
220,
360,
796,
360,
713,
90,
46541,
11,
15057,
92,
3419,
198,
220,
220,
220,
479,
796,... | 1.941581 | 291 |
# Load Julia packages (libraries) needed for the snippets in chapter 0
using DynamicHMCModels
ProjDir = @__DIR__
cd(ProjDir)
# Read in data
delim = ';'
df = CSV.read(joinpath("..", "..", "data", "rugged.csv"), DataFrame; delim)
df = filter(row -> !(ismissing(row[:rgdppc_2000])), df)
df.log_gdp = log.(df.rgdppc_200... | [
2,
8778,
22300,
10392,
357,
75,
11127,
8,
2622,
220,
329,
262,
45114,
287,
6843,
657,
198,
198,
3500,
26977,
39,
9655,
5841,
1424,
198,
198,
2964,
73,
35277,
796,
2488,
834,
34720,
834,
198,
10210,
7,
2964,
73,
35277,
8,
198,
198,
... | 2.230769 | 923 |
import ProximalOperators: Conjugate
Conjugate(f::IndFree) = IndZero()
Conjugate(f::IndZero) = IndFree()
Conjugate(f::SqrNormL2) = SqrNormL2(1.0/f.lambda)
# TODO: Add other useful functions and calculus rules such as translation
| [
11748,
1041,
87,
4402,
18843,
2024,
25,
1482,
31761,
378,
198,
198,
3103,
31761,
378,
7,
69,
3712,
5497,
11146,
8,
796,
1423,
28667,
3419,
198,
3103,
31761,
378,
7,
69,
3712,
5497,
28667,
8,
796,
1423,
11146,
3419,
198,
3103,
31761,
... | 2.674419 | 86 |
open("/dev/tape", "w") do f
write(f, "Hello tape!")
end
| [
9654,
7203,
14,
7959,
14,
83,
1758,
1600,
366,
86,
4943,
466,
277,
198,
220,
220,
220,
3551,
7,
69,
11,
366,
15496,
9154,
2474,
8,
198,
437,
198
] | 2.068966 | 29 |
<gh_stars>1-10
module LighthouseFlux
using Zygote: Zygote
using Flux: Flux
using Lighthouse: Lighthouse, classes, log_resource_info!, log_value!
export FluxClassifier
#####
##### `FluxClassifier`
#####
struct FluxClassifier{M,O,C,P,OH,OC} <: Lighthouse.AbstractClassifier
model::M
optimiser::O
classes::C... | [
27,
456,
62,
30783,
29,
16,
12,
940,
198,
21412,
406,
32303,
37,
22564,
198,
198,
3500,
1168,
35641,
1258,
25,
1168,
35641,
1258,
198,
3500,
1610,
2821,
25,
1610,
2821,
198,
3500,
406,
32303,
25,
406,
32303,
11,
6097,
11,
2604,
62,
... | 2.773404 | 1,880 |
<gh_stars>0
# This file was generated by the Julia Swagger Code Generator
# Do not modify this file directly. Modify the swagger specification instead.
module FirecrackerApis
using Random
using Dates
using HTTP
using Swagger
import Swagger: set_field!, get_field, isset_field, validate_field, SwaggerApi, SwaggerModel
... | [
27,
456,
62,
30783,
29,
15,
198,
2,
770,
2393,
373,
7560,
416,
262,
22300,
2451,
7928,
6127,
35986,
198,
2,
2141,
407,
13096,
428,
2393,
3264,
13,
3401,
1958,
262,
1509,
7928,
20855,
2427,
13,
198,
198,
21412,
3764,
6098,
10735,
251... | 3.788793 | 232 |
using LinearAlgebra
mutable struct Broyden{R <: Real, C <: Union{R, Complex{R}}, T <: AbstractArray{C}}
H
theta_bar::R
function Broyden{R, C, T}(x::T, H, theta_bar) where {R, C, T}
new(H, theta_bar)
end
end
Broyden(x::T; H=I, theta_bar=R(0.2)) where {
R <: Real, C <: Union{R, Complex{R}}, ... | [
3500,
44800,
2348,
29230,
198,
198,
76,
18187,
2878,
2806,
43955,
90,
49,
1279,
25,
6416,
11,
327,
1279,
25,
4479,
90,
49,
11,
19157,
90,
49,
92,
5512,
309,
1279,
25,
27741,
19182,
90,
34,
11709,
198,
220,
220,
220,
367,
198,
220,... | 1.892116 | 482 |
function test_ad(test_function, Δoutput, inputs...; atol=1e-6, rtol=1e-6)
# Verify that the forwards-pass produces the correct answer.
output, pb = Zygote.pullback(test_function, inputs...)
@test output ≈ test_function(inputs...)
# Compute the adjoints using AD and FiniteDifferences.
dW_ad = pb(Δo... | [
8818,
1332,
62,
324,
7,
9288,
62,
8818,
11,
37455,
22915,
11,
17311,
986,
26,
379,
349,
28,
16,
68,
12,
21,
11,
374,
83,
349,
28,
16,
68,
12,
21,
8,
628,
220,
220,
220,
1303,
49899,
326,
262,
22052,
12,
6603,
11073,
262,
3376,... | 2.489796 | 245 |
<gh_stars>1-10
@testset "ACEtb.SlaterKoster Kwon Test" begin
using ACEtb.SlaterKoster, JuLIP, Test, LinearAlgebra
OldSK = ACEtb.SlaterKoster.OldSK
using SlaterKoster: assembleRI
@info("Old Kwon Tests... just checking that it still runs in principle")
oldkwon = OldSK.KwonHamiltonian()
at = bulk(:Si, cubic = true, pb... | [
27,
456,
62,
30783,
29,
16,
12,
940,
198,
198,
31,
9288,
2617,
366,
11598,
83,
65,
13,
11122,
729,
42,
6197,
509,
26502,
6208,
1,
2221,
198,
198,
3500,
40488,
83,
65,
13,
11122,
729,
42,
6197,
11,
12585,
43,
4061,
11,
6208,
11,
... | 2.637343 | 557 |
type ForwardRateAgreement{DC <: DayCount, BC <: BusinessCalendar, C <: BusinessDayConvention, Y <: YieldTermStructure, P <: PositionType} <: AbstractForward
lazyMixin::LazyMixin
underlyingIncome::Float64
underlyingSpotValue::Float64
dc::DC
calendar::BC
convention::C
settlementDays::Int
payoff::ForwardTy... | [
4906,
19530,
32184,
10262,
10237,
90,
9697,
1279,
25,
3596,
12332,
11,
11843,
1279,
25,
7320,
9771,
9239,
11,
327,
1279,
25,
7320,
12393,
3103,
4018,
11,
575,
1279,
25,
575,
1164,
40596,
1273,
5620,
11,
350,
1279,
25,
23158,
6030,
92,... | 3.098831 | 941 |
### Main Program: parse args and call main() ###
using ArgParse
using WWURay
""" parse_cmdline
Parse the command line args to specify scene, camera, and image size """
function parse_cmdline()
s = ArgParseSettings()
@add_arg_table s begin
"--scene", "-s"
help="scene"
... | [
21017,
8774,
6118,
25,
21136,
26498,
290,
869,
1388,
3419,
44386,
197,
198,
3500,
20559,
10044,
325,
197,
198,
198,
3500,
13505,
4261,
323,
197,
198,
198,
37811,
21136,
62,
28758,
1370,
197,
198,
10044,
325,
262,
3141,
1627,
26498,
284,... | 1.966667 | 480 |
using MultivariateFunctions
using DataFrames
using Dates
using Random
using GLM
tol = 10*eps()
Random.seed!(1)
obs = 1000
X = rand(obs)
y = X .+ rand(Normal(),obs) .+ 7
# Basic use case with 2 degrees
lm1 = fit(LinearModel, hcat(ones(obs), X, X .^ 2), y)
glm_preds = predict(lm1, hcat(ones(obs), X, X .^ 2))
package_a... | [
3500,
7854,
42524,
24629,
2733,
198,
3500,
6060,
35439,
198,
3500,
44712,
198,
3500,
14534,
198,
3500,
10188,
44,
198,
198,
83,
349,
796,
838,
9,
25386,
3419,
198,
198,
29531,
13,
28826,
0,
7,
16,
8,
198,
8158,
796,
8576,
198,
55,
... | 2.364713 | 1,774 |
<filename>src/timestamps.jl
struct TimestampResolver{T₁ <: AbstractString, T₂ <: Number, T₃ <: Number} <: Function
timezone::T₁
timestamp::T₂
intersample_duration::T₃
nested_interval::NestedInterval
end
function get_timezone(resolver::TimestampResolver)
resolver.timezone
end
function get_timestamp... | [
27,
34345,
29,
10677,
14,
16514,
395,
9430,
13,
20362,
198,
7249,
5045,
27823,
4965,
14375,
90,
51,
158,
224,
223,
1279,
25,
27741,
10100,
11,
309,
158,
224,
224,
1279,
25,
7913,
11,
309,
158,
224,
225,
1279,
25,
7913,
92,
1279,
2... | 2.658487 | 489 |
<gh_stars>0
abstract type AbstractEstuary end
| [
27,
456,
62,
30783,
29,
15,
198,
198,
397,
8709,
2099,
27741,
22362,
2838,
886,
628
] | 3 | 16 |
using Test
using Distances: Euclidean
using SparseArrays
using LinearAlgebra
using UMAP
using UMAP: fuzzy_simplicial_set, compute_membership_strengths, smooth_knn_dists, smooth_knn_dist, spectral_layout, optimize_embedding, pairwise_knn
include("umap_tests.jl") | [
3500,
6208,
198,
3500,
4307,
1817,
25,
48862,
485,
272,
198,
3500,
1338,
17208,
3163,
20477,
198,
3500,
44800,
2348,
29230,
198,
3500,
471,
33767,
198,
3500,
471,
33767,
25,
34669,
62,
14323,
489,
6652,
62,
2617,
11,
24061,
62,
30814,
... | 3.011494 | 87 |
<filename>src/HyperGraphAlgos.jl
#=------------------------------------------------------------------------------
Functions typically associated with hypergraph operations, functions placed
here should relate to how to operate on the abstract representation of the
tensor. Note that these may be common operatio... | [
27,
34345,
29,
10677,
14,
38197,
37065,
2348,
70,
418,
13,
20362,
198,
2,
28,
10097,
26171,
198,
220,
220,
40480,
6032,
3917,
351,
8718,
34960,
4560,
11,
5499,
4624,
198,
220,
220,
994,
815,
15124,
284,
703,
284,
8076,
319,
262,
125... | 3.02491 | 2,489 |
using ADCME
using PyCall
using LinearAlgebra
using PyPlot
using Random
Random.seed!(233)
if Sys.islinux()
py"""
import tensorflow as tf
libDirichletBD = tf.load_op_library('build/libDirichletBD.so')
@tf.custom_gradient
def dirichlet_bd(ii,jj,dof,vv):
uu = libDirichletBD.dirichlet_bd(ii,jj,dof,vv)
def grad(dy):... | [
3500,
49169,
11682,
198,
3500,
9485,
14134,
198,
3500,
44800,
2348,
29230,
198,
3500,
9485,
43328,
198,
3500,
14534,
198,
29531,
13,
28826,
0,
7,
25429,
8,
198,
198,
361,
311,
893,
13,
271,
23289,
3419,
198,
9078,
37811,
198,
11748,
1... | 2.022202 | 1,126 |
<reponame>HoBeZwe/BEAST.jl<gh_stars>10-100
abstract type Continuity{T} end
function raviartthomas(mesh, ::Type{Continuity{:none}})
@assert dimension(mesh) == 2
P = vertextype(mesh)
S = Shape{coordtype(mesh)}
F = Vector{S}
nf = 3*numcells(mesh)
functions = Vector{F}(undef, nf)
positions =... | [
27,
7856,
261,
480,
29,
28900,
3856,
57,
732,
14,
12473,
11262,
13,
20362,
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
397,
8709,
2099,
6389,
14834,
90,
51,
92,
886,
198,
198,
8818,
374,
15820,
433,
400,
16911,
7,
76,
5069,
11,
... | 1.895288 | 382 |
using CSV, DataFrames, CategoricalArrays
data = CSV.read("../data/purchaseData.csv", copycols = true)
println("Levels of Grade: ", levels(data.Grade))
println("Data points: ", nrow(data))
n = sum(.!(ismissing.(data.Grade)))
println("Non-missing data points: ", n)
data2 = dropmissing(data[:,[:Grade]],:Grade)
gradeInQ... | [
3500,
44189,
11,
6060,
35439,
11,
327,
2397,
12409,
3163,
20477,
198,
198,
7890,
796,
44189,
13,
961,
7203,
40720,
7890,
14,
79,
18737,
6601,
13,
40664,
1600,
4866,
4033,
82,
796,
2081,
8,
198,
35235,
7203,
4971,
82,
286,
22653,
25,
... | 2.816817 | 333 |
using CompressedStacks
using Base.Test
# write your own tests here
@test 1 == 1
# IO test
include("temp.jl")
println("Test IO")
io_test()
| [
3500,
3082,
2790,
1273,
4595,
198,
3500,
7308,
13,
14402,
198,
198,
2,
3551,
534,
898,
5254,
994,
198,
31,
9288,
352,
6624,
352,
198,
198,
2,
24418,
1332,
198,
17256,
7203,
29510,
13,
20362,
4943,
198,
198,
35235,
7203,
14402,
24418,
... | 2.877551 | 49 |
<gh_stars>0
"""
RegularInTime{
T, Tts<:AbstactVector{<:Real}, Tvs<:AbstractVector{<:AbstractVector{T}},
} <: AbstractVector{T}
Represents data that has multiple observations at each of a given collection of time slices.
"""
struct RegularInTime{
T, Tts<:AbstractVector{<:Real}, Tvs<:AbstractVector{<... | [
27,
456,
62,
30783,
29,
15,
198,
37811,
198,
220,
220,
220,
23603,
818,
7575,
90,
198,
220,
220,
220,
220,
220,
220,
220,
309,
11,
309,
912,
27,
25,
4826,
301,
529,
38469,
90,
27,
25,
15633,
5512,
309,
14259,
27,
25,
23839,
3846... | 2.381958 | 521 |
<reponame>rasmushenningsson/SynapseClient.jl<filename>test/unit/run_unit_tests.jl
include("unit_tests.jl")
include("unit_test_annotations.jl")
include("unit_test_Entity.jl")
include("unit_test_Evaluation.jl")
include("unit_test_Wiki.jl")
include("unit_test_DictObject.jl")
| [
27,
7856,
261,
480,
29,
81,
8597,
385,
831,
23400,
1559,
14,
29934,
7512,
11792,
13,
20362,
27,
34345,
29,
9288,
14,
20850,
14,
5143,
62,
20850,
62,
41989,
13,
20362,
198,
17256,
7203,
20850,
62,
41989,
13,
20362,
4943,
198,
17256,
... | 2.70297 | 101 |
<filename>test/test_math_kernel/runtests.jl
include("test_exports.jl")
include("test_div_by_zero.jl")
include("test_basic_dh.jl")
include("test_geometry_kernel.jl")
include("test_poly_approx.jl")
include("test_utility.jl")
include("test_vector_projections.jl")
include("test_rotations.jl")
| [
27,
34345,
29,
9288,
14,
9288,
62,
11018,
62,
33885,
14,
81,
2797,
3558,
13,
20362,
198,
198,
17256,
7203,
9288,
62,
1069,
3742,
13,
20362,
4943,
198,
17256,
7203,
9288,
62,
7146,
62,
1525,
62,
22570,
13,
20362,
4943,
198,
17256,
72... | 2.694444 | 108 |
<reponame>jnicolasthouvenin/branch-and-bound-2OKP
# NSGAII implementation
# source: https://doi.org/10.1007/3-540-45356-3_83
function NSGAII_update(P::Vector{Sol}, config::Config)
debug && DEBUG_correct_evaluations(P, crowding = true)
#------ Offsprings -------#
N = length(P)
# generate offsprings... | [
27,
7856,
261,
480,
29,
73,
6988,
12456,
400,
280,
574,
259,
14,
1671,
3702,
12,
392,
12,
7784,
12,
17,
11380,
47,
198,
198,
2,
10896,
9273,
3978,
7822,
198,
2,
2723,
25,
3740,
1378,
34023,
13,
2398,
14,
940,
13,
44318,
14,
18,
... | 2.195545 | 1,616 |
# faster than builtin, same behavior
@inline fast_minmax{T<:AbstractFloat}(a::T, b::T) = ifelse(a<b,(a,b),(b,a))
@inline fast_maxmin{T<:AbstractFloat}(a::T, b::T) = ifelse(a>b,(a,b),(b,a))
@inline minmax{T<:AbstractFloat}(a::T, b::T) = ifelse(a<b, (a,b), ifelse(isnan(b),(a,b),(b,a)))
@inline maxmin{T<:AbstractFloat}(... | [
2,
5443,
621,
3170,
259,
11,
976,
4069,
198,
198,
31,
45145,
3049,
62,
1084,
9806,
90,
51,
27,
25,
23839,
43879,
92,
7,
64,
3712,
51,
11,
275,
3712,
51,
8,
796,
611,
17772,
7,
64,
27,
65,
11,
7,
64,
11,
65,
828,
7,
65,
11,... | 1.54724 | 2,138 |
<filename>src/interpolators/quad_quad_interp.jl
module QuadQuadInterpMod
import FEM: AbstractInterpolator, Point2, FENode2, Vertex6, inv2x2t!, det2x2,
dNmatrix, Jmatrix, dNdxmatrix, Nvec, get_area
export QuadQuadInterp
immutable QuadQuadInterp <: AbstractInterpolator
N::Vector{Float64}
dN::Matrix{Floa... | [
27,
34345,
29,
10677,
14,
3849,
16104,
2024,
14,
47003,
62,
47003,
62,
3849,
79,
13,
20362,
198,
21412,
20648,
4507,
324,
9492,
79,
5841,
198,
198,
11748,
376,
3620,
25,
27741,
9492,
16104,
1352,
11,
6252,
17,
11,
376,
1677,
1098,
1... | 1.695652 | 1,679 |
<filename>test/style.jl
@testset "▶ types/style " begin
t = G.TextStyle()
@test isnothing(t.font)
@test isnothing(t.hei)
@test isnothing(t.color)
t = G.TextStyle(font="psh", hei=0.5, color=colorant"red")
@test t.font == "psh"
@test t.hei == 0.5
@test t.color == colorant"r... | [
27,
34345,
29,
9288,
14,
7635,
13,
20362,
198,
31,
9288,
2617,
366,
5008,
114,
3858,
14,
7635,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
2221,
198,
220,
220,
220,
256,
796,
402,
13,
820... | 2.074672 | 2,973 |
# Path function wrapper with user provided jacobian. Ideally provided
# Jacobian will be computed analytically, but this does not necessaraly
# need to be the case as long as each entry in each Jacobian is provided.
mutable struct AnalyticPathFunction{type, PFT<:Function, SJT, CJT, STJT, TJT} <: PathFunction{type}
... | [
2,
10644,
2163,
29908,
351,
2836,
2810,
474,
330,
672,
666,
13,
40067,
2810,
220,
198,
2,
12806,
666,
481,
307,
29231,
4284,
83,
1146,
11,
475,
428,
857,
407,
2418,
283,
3400,
220,
198,
2,
761,
284,
307,
262,
1339,
355,
890,
355,
... | 1.981289 | 2,886 |
# coding: utf-8
# In[1]:
#this is a test on how recursion with memory reduces time complexity
# In[2]:
#this is the fibonacci recursion function without memory
#it is basically algorithm 101 for any coding language
function fib(n)
if n==1
return 1
elseif n==2
return 1
elseif n<=... | [
198,
2,
19617,
25,
3384,
69,
12,
23,
198,
198,
2,
554,
58,
16,
5974,
628,
198,
2,
5661,
318,
257,
1332,
319,
703,
664,
24197,
351,
4088,
12850,
640,
13357,
628,
198,
2,
554,
58,
17,
5974,
628,
198,
2,
5661,
318,
262,
12900,
26... | 2.448855 | 655 |
<gh_stars>1-10
"""
transport!(ts, stt, acc)
1. filter `stt.dispatch_queue` for dispatch to be executed at current timestep `ts` and \
remove filtered dispatch from `stt.dispatch_queue`
2. update `stt.current_stock` given the executed dispatch at the current timestep `ts` \
and add the executed dispatch to `acc.exe... | [
27,
456,
62,
30783,
29,
16,
12,
940,
198,
198,
37811,
198,
220,
220,
220,
4839,
0,
7,
912,
11,
336,
83,
11,
697,
8,
198,
16,
13,
8106,
4600,
301,
83,
13,
6381,
17147,
62,
36560,
63,
329,
27965,
284,
307,
10945,
379,
1459,
4628... | 2.176282 | 624 |
<gh_stars>1-10
# usage from repository root:
#
# julia --project=. examples/fasync_tumour_invasion.jl
#
using BooleanNetworks
import Random
Random.seed!(1234)
model = "models/Tumour_invasion.bnet"
outputs = ["Apoptosis"; "CellCycleArrest"; "Invasion"; "Metastasis"; "Migration"]
free_nodes = ["DNAdamage", "ECMicroenv... | [
27,
456,
62,
30783,
29,
16,
12,
940,
198,
2,
8748,
422,
16099,
6808,
25,
198,
2,
198,
2,
474,
43640,
1377,
16302,
28,
13,
6096,
14,
69,
292,
13361,
62,
83,
388,
454,
62,
16340,
4247,
13,
20362,
198,
2,
198,
198,
3500,
41146,
7... | 2.566176 | 408 |
<gh_stars>10-100
using Test
using Printf: @printf
using QuantumLattices.Essentials.QuantumOperators
using QuantumLattices.Interfaces: id, value, rank, add!, sub!, mul!, div!
using QuantumLattices.Prerequisites: Float
using QuantumLattices.Prerequisites.Combinatorics: Combinations
using QuantumLattices.Prerequisites.Tra... | [
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
3500,
6208,
198,
3500,
12578,
69,
25,
2488,
37435,
198,
3500,
29082,
43,
1078,
1063,
13,
29508,
14817,
13,
24915,
388,
18843,
2024,
198,
3500,
29082,
43,
1078,
1063,
13,
9492,
32186,
25,
4... | 2.002573 | 5,441 |
"""
solve(prob::SingleTermFODEProblem, n, ChebSpectral())
Using Chebyshev spectral method to solve single term fractional ordinary differential equations.
!!! warning
Chebyshev spectral method only support for linear fractional differential equations, and the time span of the problem should be ``[-1, 1]``.
... | [
37811,
198,
220,
220,
220,
8494,
7,
1676,
65,
3712,
28008,
40596,
37,
16820,
40781,
11,
299,
11,
2580,
65,
49738,
1373,
28955,
198,
198,
12814,
2580,
48209,
258,
85,
37410,
2446,
284,
8494,
2060,
3381,
13390,
282,
8850,
22577,
27490,
... | 1.517311 | 2,484 |
export randSeisChannel,
randSeisData,
randSeisEvent,
randSeisHdr,
randPhaseCat,
randSeisSrc
| [
39344,
43720,
4653,
271,
29239,
11,
198,
220,
43720,
4653,
271,
6601,
11,
198,
220,
43720,
4653,
271,
9237,
11,
198,
220,
43720,
4653,
271,
39,
7109,
11,
198,
220,
43720,
35645,
21979,
11,
198,
220,
43720,
4653,
271,
50,
6015,
198,
... | 2.333333 | 45 |
<reponame>jvkerckh/ManpowerPlanning.jl
function processInitPopAges( ages::Vector{Float64}, ageRes::Float64 )
result = DataFrame()
# Summary statistics.
minAge = minimum( ages )
maxAge = maximum( ages )
ageSummary = [mean( ages ), median( ages ),
length( ages ) == 1 ? missing : std( ages ),... | [
27,
7856,
261,
480,
29,
73,
85,
6122,
694,
71,
14,
5124,
6477,
20854,
768,
13,
20362,
198,
8818,
1429,
31768,
16979,
32,
3212,
7,
9337,
3712,
38469,
90,
43879,
2414,
5512,
2479,
4965,
3712,
43879,
2414,
1267,
628,
220,
220,
220,
125... | 2.646497 | 314 |
touch(joinpath(@__DIR__, "buildartifact"))
| [
29332,
7,
22179,
6978,
7,
31,
834,
34720,
834,
11,
366,
11249,
433,
29660,
48774,
198
] | 2.6875 | 16 |
const JULIAN_EPOCH = TTEpoch(AstroDates.JULIAN_EPOCH, AstroDates.H12)
const J2000_EPOCH = TTEpoch(AstroDates.J2000_EPOCH, AstroDates.H12)
const MODIFIED_JULIAN_EPOCH = TTEpoch(AstroDates.MODIFIED_JULIAN_EPOCH, AstroDates.H00)
const FIFTIES_EPOCH = TTEpoch(AstroDates.FIFTIES_EPOCH, AstroDates.H00)
const CCSDS_EPOCH = TT... | [
9979,
49349,
16868,
62,
8905,
46,
3398,
796,
309,
9328,
79,
5374,
7,
32,
20661,
35,
689,
13,
41,
6239,
16868,
62,
8905,
46,
3398,
11,
35167,
35,
689,
13,
39,
1065,
8,
198,
9979,
449,
11024,
62,
8905,
46,
3398,
796,
309,
9328,
79... | 2.017045 | 352 |
mutable struct MPState{Y<:Tensor{T,3} where T}
As :: Vector{Y}
center :: Int
end
@inline center(mps::MPState) = mps.center
@inline tensortype(::MPState{Y}) where {Y} = Y
@inline Base.eltype(::MPState{Y}) where {Y} = eltype(Y)
@inline Base.length(mps::MPState) = length(mps.As)
#@inline checkbounds(mps, l) =... | [
76,
18187,
2878,
4904,
9012,
90,
56,
27,
25,
51,
22854,
90,
51,
11,
18,
92,
810,
309,
92,
198,
220,
220,
220,
1081,
220,
220,
220,
220,
7904,
20650,
90,
56,
92,
198,
220,
220,
220,
3641,
7904,
2558,
198,
437,
198,
198,
31,
451... | 1.829072 | 7,939 |
@testset "Plotting $f" for f in (:empty, :onetask, :chain, :shortlong, :medium)
# Just making sure no errors are thrown
proj = getfield(Examples, f)
pert_chart = visualize_chart(proj)
end
| [
31,
9288,
2617,
366,
43328,
889,
720,
69,
1,
329,
277,
287,
357,
25,
28920,
11,
1058,
36823,
2093,
11,
1058,
7983,
11,
1058,
19509,
6511,
11,
1058,
24132,
8,
198,
220,
220,
220,
1303,
2329,
1642,
1654,
645,
8563,
389,
8754,
198,
2... | 2.702703 | 74 |
<reponame>LaurenceA/Turing.jl
module Turing
using Distributions
using ReverseDiffOverload
export @sf, State, sample, normal, langevinposterior, If_, EndIf_
immutable NoCond end
const nocond = NoCond()
abstract TraceElement
Trace = Vector{TraceElement}
type If <: TraceElement
cond::Bool
trace::Vector{TraceEl... | [
27,
7856,
261,
480,
29,
14772,
495,
1198,
32,
14,
51,
870,
13,
20362,
198,
21412,
39141,
198,
198,
3500,
46567,
507,
198,
3500,
31849,
28813,
5886,
2220,
198,
198,
39344,
2488,
28202,
11,
1812,
11,
6291,
11,
3487,
11,
300,
858,
7114... | 2.406747 | 2,075 |
function encode(input::AbstractString)
end
function decode(input::AbstractString)
end
| [
8818,
37773,
7,
15414,
3712,
23839,
10100,
8,
198,
198,
437,
198,
198,
8818,
36899,
7,
15414,
3712,
23839,
10100,
8,
198,
198,
437,
628
] | 3.6 | 25 |
<gh_stars>1-10
import Base: *, sort
using Random, Statistics, DataFrames, CSV
using BioSequences,RCall,ArgParse
import BioSequences: iscompatible
################################################
#OligoRL Toolset
#################################################
# Overload the concatenation operator to combine a sequ... | [
27,
456,
62,
30783,
29,
16,
12,
940,
198,
11748,
7308,
25,
1635,
11,
3297,
198,
3500,
14534,
11,
14370,
11,
6060,
35439,
11,
44189,
198,
3500,
16024,
44015,
3007,
11,
7397,
439,
11,
28100,
10044,
325,
198,
11748,
16024,
44015,
3007,
... | 2.26819 | 19,214 |
<filename>example/fgTypeVis.jl
# Visualize 2 sessions in Arena using local fgs
using UUIDs
using IncrementalInference
using RoME
using Arena.Amphitheatre
##
# create a local fg hexslam
# start with an empty factor graph object
fg1 = initfg()
v = addVariable!(fg1, :x0, Pose2, labels=["POSE"]) # Add the first pose :x0... | [
27,
34345,
29,
20688,
14,
40616,
6030,
15854,
13,
20362,
198,
2,
15612,
1096,
362,
10991,
287,
10937,
1262,
1957,
277,
14542,
198,
198,
3500,
471,
27586,
82,
198,
3500,
10791,
37098,
818,
4288,
198,
3500,
5564,
11682,
198,
3500,
10937,
... | 2.311133 | 1,006 |
let
epc = Epoch(2018,1,1,12,0,0)
a = R_EARTH + 500e3
oe = [a, 0, 0, 0, 0, sqrt(GM_EARTH/a)]
eci = sOSCtoCART(oe, use_degrees=true)
r_rtn = rRTNtoECI(eci)
r_rtn_t = rECItoRTN(eci)
r = r_rtn * r_rtn_t
tol = 1e-8
@test isapprox(r[1, 1], 1.0, atol=tol)
@test isapprox(r[1... | [
1616,
198,
220,
220,
220,
2462,
66,
796,
4551,
5374,
7,
7908,
11,
16,
11,
16,
11,
1065,
11,
15,
11,
15,
8,
628,
220,
220,
220,
257,
220,
220,
796,
371,
62,
17133,
4221,
1343,
5323,
68,
18,
198,
220,
220,
220,
267,
68,
220,
7... | 1.738709 | 2,989 |
<reponame>ccaballeroh/JuliaCORE21
using PyCall
tf = pyimport("tensorflow")
keras = pyimport("tensorflow.keras")
model = keras.Sequential([
keras.layers.Dense(10, activation="relu"),
keras.layers.Dense(1, activation="sigmoid")
])
model.compile(optimizer="adam", loss="mse")
X_train = tf.random.normal([1000, 3]... | [
27,
7856,
261,
480,
29,
535,
397,
439,
263,
1219,
14,
16980,
544,
34,
6965,
2481,
198,
3500,
9485,
14134,
198,
27110,
796,
12972,
11748,
7203,
83,
22854,
11125,
4943,
198,
6122,
292,
796,
12972,
11748,
7203,
83,
22854,
11125,
13,
6122... | 2.375 | 192 |
<gh_stars>0
# EXAMPLE: aggregate by groups, general example from T Kwong
using DataFrames
using CSV
function download_titantic()
url = "https://www.openml.org/data/get_csv/16826755/phpMYEkMl"
return DataFrame(CSV.File(download(url); missingstring = "?"))
end
function summarize(df:AbstractDataFrame)
return... | [
27,
456,
62,
30783,
29,
15,
198,
2,
7788,
2390,
16437,
25,
19406,
416,
2628,
11,
2276,
1672,
422,
309,
31767,
506,
198,
3500,
6060,
35439,
198,
3500,
44189,
198,
198,
8818,
4321,
62,
83,
270,
5109,
3419,
198,
220,
220,
220,
19016,
... | 1.733813 | 1,529 |
<gh_stars>10-100
#
#
# abstract CostModel
#
# function cost(model::CostModel, y::AVecF, yhat::AVecF)
# c = 0.0
# for i in 1:length(y)
# c += cost(model, y[i], yhat[i])
# end
# # sum([cost(model, y[i], yhat[i]) for i in 1:length(y)])
# c
# end
#
# # note: the vector version of costMultiplier also returns ... | [
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
2,
220,
198,
2,
198,
2,
12531,
6446,
17633,
198,
2,
198,
2,
2163,
1575,
7,
19849,
3712,
13729,
17633,
11,
331,
3712,
10116,
721,
37,
11,
331,
5183,
3712,
10116,
721,
37,
8,
198,
2,
2... | 2.346154 | 1,170 |
<filename>src/sinks/sink_csvfile.jl
immutable CsvFile
filename::String
delim_char::Char
quote_char::Char
escape_char::Char
header::Bool
function CsvFile(filename, delim_char=',', quote_char='"', escape_char='\\', header=true)
new(filename, delim_char, quote_char, escape_char, header)
... | [
27,
34345,
29,
10677,
14,
82,
2973,
14,
82,
676,
62,
40664,
7753,
13,
20362,
198,
8608,
18187,
327,
21370,
8979,
198,
220,
220,
220,
29472,
3712,
10100,
198,
220,
220,
220,
46728,
62,
10641,
3712,
12441,
198,
220,
220,
220,
9577,
62... | 2.189116 | 735 |
@testset "Supercell angles" begin
@testset "fcc" begin
@test all(MkCell.cell_angles(fcc1*cellfcc) .≈ (90.0, 120.0, 60.0))
@test all(MkCell.cell_angles(fcc4*cellfcc) .≈ (90.0, 90.0, 90.0))
@test all(MkCell.cell_angles(fcc7*cellfcc) .≈ (99.59406822686046, 80.40593177313954, 80.40593177313954))
@test... | [
31,
9288,
2617,
366,
12442,
3846,
18333,
1,
2221,
198,
31,
9288,
2617,
366,
69,
535,
1,
2221,
198,
220,
220,
220,
2488,
9288,
477,
7,
44,
74,
28780,
13,
3846,
62,
27787,
7,
69,
535,
16,
9,
3846,
69,
535,
8,
220,
220,
764,
3570... | 1.903621 | 3,673 |
<filename>test/runtests.jl
using SafeTestsets
@safetestset "My f test" begin include("my_test.jl") end
| [
27,
34345,
29,
9288,
14,
81,
2797,
3558,
13,
20362,
198,
3500,
19978,
51,
3558,
1039,
198,
198,
31,
49585,
316,
395,
2617,
366,
3666,
277,
1332,
1,
2221,
2291,
7203,
1820,
62,
9288,
13,
20362,
4943,
886,
198
] | 2.666667 | 39 |
<gh_stars>10-100
using Test
using UncertainData
using Distributions
using StaticArrays
using StatsBase
using KernelDensity
#############################################
# UncertainValues module
#############################################
@testset "Uncertain values" begin
@testset "Assign distributions" begin
... | [
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
3500,
6208,
198,
3500,
28304,
1425,
6601,
198,
3500,
46567,
507,
198,
3500,
36125,
3163,
20477,
198,
3500,
20595,
14881,
198,
3500,
32169,
35,
6377,
628,
198,
198,
29113,
7804,
4242,
2,
198,... | 2.895349 | 2,924 |
#test/runtests.jl
#import Pkg; Pkg.add("Test")
using Test, DataFrames,SalesForceBulkApi
## Pulling the data ##
session = login("<EMAIL>", "<KEY>", "45.0")
all_object_fields_return = all_object_fields(session)
all_object_fields_return[[:name, :object]]
queries = ["Select Name From Account Limit 10", "Select LastName Fr... | [
2,
9288,
14,
81,
2797,
3558,
13,
20362,
198,
2,
11748,
350,
10025,
26,
350,
10025,
13,
2860,
7203,
14402,
4943,
198,
3500,
6208,
11,
6060,
35439,
11,
44490,
10292,
33,
12171,
32,
14415,
198,
198,
2235,
21429,
278,
262,
1366,
22492,
... | 2.781341 | 343 |
using BenchmarkTools
##
function benchmark_broadcasting()
shape, wcs = fullsky_geometry(deg2rad(1); dims=(3,))
A, B = rand(shape...), rand(shape...)
ma = Enmap(A, wcs)
mb = Enmap(B, wcs)
@btime $mb .* $ma .* exp.($ma.^2)
@btime $B .* $A .* exp.($A.^2)
return (mb .* ma .* exp.(ma.^2)) == ... | [
3500,
25187,
4102,
33637,
198,
198,
2235,
198,
198,
8818,
18335,
62,
36654,
19913,
3419,
198,
220,
220,
220,
5485,
11,
266,
6359,
796,
1336,
15688,
62,
469,
15748,
7,
13500,
17,
6335,
7,
16,
1776,
5391,
82,
16193,
18,
11,
4008,
198,... | 2.120915 | 306 |
<filename>src/DensityDynamics/DDmethods.jl
function force(x::Float64, potential::Potential)
f(y) = -derivative(potential.f,y)
f(x)
end
function friction(z::Float64, thermo::Thermostat)
g = y -> derivative(thermo.distribution,y)
g(z)/thermo.distribution(z)
end
function forcederivative(potential::Poten... | [
27,
34345,
29,
10677,
14,
35,
6377,
35,
4989,
873,
14,
16458,
24396,
82,
13,
20362,
198,
8818,
2700,
7,
87,
3712,
43879,
2414,
11,
2785,
3712,
25396,
1843,
8,
198,
220,
220,
220,
277,
7,
88,
8,
796,
532,
1082,
452,
876,
7,
13059... | 2.340684 | 907 |
<filename>lang/Julia/vector_speedtest.jl
using LinearAlgebra
using JuMP
function test(n::Int)
model = Model()
a = rand(n, n)
@variable(model, x[1:n, 1:n])
b = rand(n, n, n)
@variable(model, y[1:n, 1:n, 1:n])
c = rand(n)
@variable(model, z[1:n])
#initialize
@constraint(model, sum(c[... | [
27,
34345,
29,
17204,
14,
16980,
544,
14,
31364,
62,
12287,
9288,
13,
20362,
198,
3500,
44800,
2348,
29230,
198,
3500,
12585,
7378,
198,
198,
8818,
1332,
7,
77,
3712,
5317,
8,
198,
220,
220,
220,
2746,
796,
9104,
3419,
198,
220,
220... | 2.129568 | 602 |
<gh_stars>0
# Author: <NAME>
# Program to Find Largest Number Among Three Numbers
println("Enter 3 Numbers to find the largest : ")
first=readline()
first=parse(Int64,first)
second=readline()
second=parse(Int64,second)
third=readline()
third=parse(Int64,third)
if first >second && first>third
println("First Numbe... | [
27,
456,
62,
30783,
29,
15,
198,
2,
6434,
25,
1279,
20608,
29,
198,
2,
6118,
284,
9938,
406,
853,
395,
7913,
9754,
7683,
27797,
198,
35235,
7203,
17469,
513,
27797,
284,
1064,
262,
4387,
1058,
366,
8,
198,
11085,
28,
961,
1370,
34... | 3.139241 | 158 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.