content stringlengths 6 1.03M | input_ids listlengths 4 535k | ratio_char_token float64 0.68 8.61 | token_count int64 4 535k |
|---|---|---|---|
"Tableau for the explicit 1-stage stochastic Euler method"
function TableauStochasticEuler()
a = zeros(Float64, 1, 1)
b = [1.0]
c = [0.0]
TableauSERK(:Stochastic_Euler_explicit_method, 1, a, b, c, 1, a, b, c)
end
"Tableau for the explicit 2-stage stochastic Heun method"
function TableauStochasticHeun()
... | [
1,
10962,
559,
329,
262,
7952,
352,
12,
14247,
3995,
354,
3477,
412,
18173,
2446,
1,
198,
8818,
8655,
559,
1273,
5374,
3477,
36,
18173,
3419,
198,
220,
257,
796,
1976,
27498,
7,
43879,
2414,
11,
352,
11,
352,
8,
198,
220,
275,
796... | 1.742401 | 3,948 |
<reponame>dls/OpenSSL.jl
macro assert_equal(a, b)
quote
aval = $a
bval = $b
if aval != bval
println("Failure: (", aval, " != ", bval, "), expected it to ==")
else
print(".")
end
end
end
macro assert_not_equal(a, b)
quote
aval = $a
... | [
27,
7856,
261,
480,
29,
67,
7278,
14,
11505,
31127,
13,
20362,
198,
20285,
305,
6818,
62,
40496,
7,
64,
11,
275,
8,
198,
220,
220,
220,
9577,
198,
220,
220,
220,
220,
220,
220,
220,
37441,
796,
720,
64,
198,
220,
220,
220,
220,
... | 1.823529 | 272 |
# Basics of the mathematica SIR Model
using DifferentialEquations
using Plots
# This is a test for the Lorenz ODE system
function lorenz!(du,u,p,t)
du[1] = 10.0*(u[2]-u[1])
du[2] = u[1]*(28.0-u[3]) - u[2]
du[3] = u[1]*u[2] - (8/3)*u[3]
end
u0 = [1.0;0.0;0.0]
tspan = (0.0,100.0)
prob = ODEProblem(lorenz!,u0,tspa... | [
2,
45884,
286,
262,
33161,
64,
311,
4663,
9104,
628,
198,
3500,
20615,
498,
23588,
602,
198,
3500,
1345,
1747,
198,
198,
2,
770,
318,
257,
1332,
329,
262,
15639,
27305,
440,
7206,
1080,
198,
8818,
24044,
27305,
0,
7,
646,
11,
84,
... | 1.781095 | 402 |
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# Computing episode lenghts
# ------------------------------------------------------------------------------
# -----------------------------------------------... | [
2,
16529,
26171,
198,
2,
16529,
26171,
198,
2,
38589,
4471,
18896,
456,
912,
198,
2,
16529,
26171,
198,
2,
16529,
26171,
198,
8818,
11138,
66,
62,
38668,
62,
11925,
456,
83,
7,
20560,
82,
26,
773,
82,
796,
532,
16,
8,
198,
220,
... | 2.259149 | 2,350 |
"""
initial(::Type{RandomInitialLayout}, N::T) where {T <: EcologicalNetworks.AbstractEcologicalNetwork}
Random disposition of nodes in a circle. This is a good starting point for any
force-directed layout. The circle is scaled so that its radius is twice the
square root of the network richness, which helps most l... | [
37811,
198,
220,
220,
220,
4238,
7,
3712,
6030,
90,
29531,
24243,
32517,
5512,
399,
3712,
51,
8,
810,
1391,
51,
1279,
25,
14003,
2770,
7934,
5225,
13,
23839,
49136,
2770,
26245,
92,
198,
198,
29531,
24665,
286,
13760,
287,
257,
9197,
... | 2.971859 | 995 |
### A Pluto.jl notebook ###
# v0.18.1
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
loc... | [
21017,
317,
32217,
13,
20362,
20922,
44386,
198,
2,
410,
15,
13,
1507,
13,
16,
198,
198,
3500,
2940,
2902,
198,
3500,
21365,
18274,
4487,
198,
198,
2,
770,
32217,
20922,
3544,
2488,
21653,
329,
9427,
3458,
13,
1649,
2491,
428,
20922,
... | 1.735661 | 16,180 |
<reponame>msarfati/COSMO.jl
# Power cone constrained problems
using Test, LinearAlgebra, SparseArrays
using COSMO
# This test is precision agnostic and will be run with T precision
if !@isdefined(UnitTestFloats)
UnitTestFloats = [Float64] #if not run in full test setup, just do it for one float type
end
@testset ... | [
27,
7856,
261,
480,
29,
907,
37595,
7246,
14,
34,
2640,
11770,
13,
20362,
198,
2,
4333,
27763,
31070,
2761,
198,
3500,
6208,
11,
44800,
2348,
29230,
11,
1338,
17208,
3163,
20477,
198,
3500,
327,
2640,
11770,
198,
198,
2,
770,
1332,
... | 1.6 | 2,970 |
S = 35
N = 41
Theta = ones(S)
tauhat = rand(N*S, N*S)
tauFhat = rand(N*S, N)
wagehat = rand(N)
iter = 1
wagehat0 = wagehat
PrsjHat0 = rand(S, N*S)
PrFjHat0 = rand(S, N)
tol = 1e-3
maxit = 100
pfmax = 1
iterph = 1
cost = ones(S, N)
for s in 1:S
for j in 1:N
cost[s,j] = wagehat[j]^VAcoeff[s,j]
... | [
198,
198,
50,
796,
3439,
198,
45,
796,
6073,
198,
198,
464,
8326,
796,
3392,
7,
50,
8,
198,
83,
559,
5183,
796,
43720,
7,
45,
9,
50,
11,
399,
9,
50,
8,
198,
83,
559,
37,
5183,
796,
43720,
7,
45,
9,
50,
11,
399,
8,
198,
1... | 1.810522 | 4,961 |
<gh_stars>0
using LeftChildRightSiblingTrees, AbstractTrees
using Test
@testset "LeftChildRightSiblingTrees" begin
root = Node(0)
@test isroot(root)
@test isleaf(root)
nchildren = 0
for c in root
nchildren += 1
end
@test nchildren == 0
c1 = addchild(root, 1)
c2 = addchild(ro... | [
27,
456,
62,
30783,
29,
15,
198,
3500,
9578,
16424,
11028,
50,
27448,
51,
6037,
11,
27741,
51,
6037,
198,
3500,
6208,
198,
198,
31,
9288,
2617,
366,
18819,
16424,
11028,
50,
27448,
51,
6037,
1,
2221,
198,
220,
220,
220,
6808,
796,
... | 2.009353 | 1,283 |
<filename>src/plot_SNR.jl
#RSDeltaSigmaPort: Generate plots of the Signal-to-Noise Ratio
#-------------------------------------------------------------------------------
#==SNR plot
===============================================================================#
#TODO: Rename `plotSQNR`?
function plotSNR()
plot = con... | [
27,
34345,
29,
10677,
14,
29487,
62,
15571,
49,
13,
20362,
198,
2,
6998,
42430,
50,
13495,
13924,
25,
2980,
378,
21528,
286,
262,
26484,
12,
1462,
12,
2949,
786,
33956,
198,
2,
10097,
24305,
198,
198,
2,
855,
15571,
49,
7110,
198,
... | 2.427711 | 664 |
using LinearAlgebra
using BlockFactorizations
using BenchmarkTools
d = 512
n, m = 16, 8
A = [randn(d, d) for i in 1:n, j in 1:m]
B = BlockFactorization(A)
x = [randn(d) for _ in 1:m]
y = [zeros(d) for _ in 1:n]
@btime A*x
@btime mul!(y, A, x);
x = randn(d*m)
y = zeros(d*n)
@btime B*x;
@btime mul!(y, B, x);
d = 512
... | [
3500,
44800,
2348,
29230,
198,
3500,
9726,
41384,
4582,
198,
3500,
25187,
4102,
33637,
198,
198,
67,
796,
22243,
198,
77,
11,
285,
796,
1467,
11,
807,
198,
32,
796,
685,
25192,
77,
7,
67,
11,
288,
8,
329,
1312,
287,
352,
25,
77,
... | 1.963816 | 304 |
<reponame>wookay/Foundation.jl
using Foundation
using Test
@test "abc".count == 3
@test_throws MethodError "abc".unknown_function
| [
27,
7856,
261,
480,
29,
86,
566,
323,
14,
21077,
341,
13,
20362,
198,
3500,
5693,
198,
3500,
6208,
198,
198,
31,
9288,
366,
39305,
1911,
9127,
6624,
513,
198,
31,
9288,
62,
400,
8516,
11789,
12331,
366,
39305,
1911,
34680,
62,
8818,... | 2.977273 | 44 |
<gh_stars>0
using Pkg
Pkg.add("DataStructures")
Pkg.add("Revise")
| [
27,
456,
62,
30783,
29,
15,
198,
3500,
350,
10025,
198,
47,
10025,
13,
2860,
7203,
6601,
44909,
942,
4943,
198,
47,
10025,
13,
2860,
7203,
18009,
786,
4943,
198
] | 2.2 | 30 |
<gh_stars>1-10
using Zeros
using Test
using Test: @inferred
@testset "ambiguities" begin
ambiguities = detect_ambiguities(Base, Zeros)
for a in ambiguities
println(a[1], "\n", a[2], "\n")
end
@test length(ambiguities) <= 10
end
const Z = Zero()
const I = One()
@testset "Promotion" begin
@... | [
27,
456,
62,
30783,
29,
16,
12,
940,
198,
3500,
1168,
27498,
198,
3500,
6208,
198,
3500,
6208,
25,
2488,
259,
18186,
198,
198,
31,
9288,
2617,
366,
4131,
328,
84,
871,
1,
2221,
198,
220,
220,
220,
18203,
84,
871,
796,
4886,
62,
... | 2.023538 | 4,121 |
<filename>src/gle_script.jl
struct GLEScript
io::IOBuffer
end
GLEScript() = GLEScript(IOBuffer())
const GS = GLEScript
# write to buffer (or buffer encapsulating object) with form (s |> b)
|>(s::String, g::GS) = write(g.io, s, " ") # writing to g
|>(s::String, tio::Tuple) = @. |>(s, tio) # writing to... | [
27,
34345,
29,
10677,
14,
70,
293,
62,
12048,
13,
20362,
198,
7249,
10188,
1546,
6519,
198,
220,
220,
220,
33245,
3712,
9399,
28632,
198,
437,
198,
8763,
1546,
6519,
3419,
796,
10188,
1546,
6519,
7,
9399,
28632,
28955,
198,
198,
9979,... | 2.186441 | 236 |
# First millisecond of 2015.
const DISCORD_EPOCH = 1420070400000
# Discord's form of ID.
const Snowflake = UInt64
snowflake(s::Integer) = Snowflake(s)
snowflake(s::AbstractString) = parse(Snowflake, s)
# TODO: Put these in helpers?
snowflake2datetime(s::Snowflake) = unix2datetime(((s >> 22) + DISCORD_EPOCH) / 1000)
... | [
2,
3274,
33606,
623,
286,
1853,
13,
198,
9979,
13954,
34,
12532,
62,
8905,
46,
3398,
796,
1478,
2167,
2154,
7029,
830,
198,
198,
2,
39462,
338,
1296,
286,
4522,
13,
198,
9979,
7967,
47597,
796,
471,
5317,
2414,
198,
198,
82,
2197,
... | 2.178105 | 2,448 |
<filename>scripts/clang.jl
# TODO(odow):
#
# This script can be used to build the C interface to Gurobi. However, it
# requires you to manually set the path to the appropriate gurobi_c.h.
import Clang
const LIBGRB_HEADERS = [
"/Library/gurobi910/mac64/include/gurobi_c.h",
]
const GRB_VERSION = "91"
const GEN_DI... | [
27,
34345,
29,
46521,
14,
565,
648,
13,
20362,
198,
2,
16926,
46,
7,
375,
322,
2599,
198,
2,
198,
2,
770,
4226,
460,
307,
973,
284,
1382,
262,
327,
7071,
284,
402,
1434,
8482,
13,
2102,
11,
340,
198,
2,
4433,
345,
284,
14500,
... | 2.411111 | 450 |
<gh_stars>1-10
export Storage, update_storage
# Create a structure that will hold evaluation of the basis functions,
# as well as their derivative and second derivative
"""
$(TYPEDEF)
An immutable structure to hold the evaluation of basis functions
## Fields
$(TYPEDFIELDS)
"""
struct Storage
m::Int64
Nψ:... | [
27,
456,
62,
30783,
29,
16,
12,
940,
198,
198,
39344,
20514,
11,
4296,
62,
35350,
198,
198,
2,
13610,
257,
4645,
326,
481,
1745,
12660,
286,
262,
4308,
5499,
11,
198,
2,
355,
880,
355,
511,
27255,
290,
1218,
27255,
198,
198,
37811... | 1.754365 | 2,520 |
#
# Proquint.jl by <NAME>, MIT license
#
"""
# Proquints: Identifiers that are Readable, Spellable, and Pronounceable
This is a Julia implementation of Wilkerson's proquints
described in his article [http://arXiv.org/html/0901.4016](http://arXiv.org/html/0901.4016).
In short 16 bits get represented in a "proquint" ... | [
2,
220,
198,
2,
1041,
421,
600,
13,
20362,
416,
1279,
20608,
22330,
17168,
5964,
198,
2,
198,
37811,
198,
2,
1041,
421,
29503,
25,
11440,
13350,
326,
389,
4149,
540,
11,
11988,
540,
11,
290,
350,
1313,
8652,
540,
198,
198,
1212,
3... | 2.327806 | 784 |
const dimensions = 3
const screen_z = 250
"""
Takes a point in 3D space and calculates the position of its "camera" image.
Returns nothing if the point is outside the camera's field of view.
#
- `point::Tuple3{Float32}`: Point in 3D space
- `screen_size::Tuple2{UInt16}`: Width & height of the snapshot screen
"""
fu... | [
9979,
15225,
796,
513,
198,
9979,
3159,
62,
89,
796,
8646,
628,
198,
37811,
198,
51,
1124,
257,
966,
287,
513,
35,
2272,
290,
43707,
262,
2292,
286,
663,
366,
25695,
1,
2939,
13,
198,
35561,
2147,
611,
262,
966,
318,
2354,
262,
46... | 2.680946 | 3,128 |
<filename>test/operators.jl
module TestOperators
using Base.Test
using DataArrays
using DataFrames
using Dates
using TimeData
println("Running operator tests")
## init test values
vals = [1 1 1 1;
2 2 2 2;
3 3 3 3;
4 4 4 4]
dats = Date[Date(2013, 7, ii) for ii=1:4]
nams = [:A, :B, :C, :D]
va... | [
27,
34345,
29,
9288,
14,
3575,
2024,
13,
20362,
198,
21412,
6208,
18843,
2024,
198,
198,
3500,
7308,
13,
14402,
198,
3500,
6060,
3163,
20477,
198,
3500,
6060,
35439,
198,
3500,
44712,
198,
198,
3500,
3862,
6601,
198,
198,
35235,
7203,
... | 1.89239 | 1,301 |
<filename>src/iaea/io.jl
function ptype_disksize_nodefaults(h::IAEAHeader{Nf, Ni}) where {Nf, Ni}
1 + # typ
4 + # energy
12 + # x,y,z
8 + # u,v (w is not stored)
4 + # weight
4 * Nf +
4 * Ni
end
function ptype_disksize(h::IAEAHeader{Nf, Ni}) where {Nf, Ni}
size_reduction_due_to_defaults... | [
27,
34345,
29,
10677,
14,
544,
18213,
14,
952,
13,
20362,
198,
8818,
279,
4906,
62,
6381,
591,
1096,
62,
77,
375,
891,
13185,
7,
71,
3712,
3539,
16412,
39681,
90,
45,
69,
11,
11556,
30072,
810,
1391,
45,
69,
11,
11556,
92,
198,
... | 1.858913 | 1,453 |
<gh_stars>0
function setupexperimentresults(molecule_names,
ΩS_ppm,
Δsys_border::Vector{Vector{T}};
min_dist = 0.15) where T
metabolite_regions = collect( getmetaboliteintervals(molecule_names[n],
molecule_names, ΩS_ppm, Δsys_border;
min_dist = min_dist) for n = 1:length(molecule_names)... | [
27,
456,
62,
30783,
29,
15,
198,
8818,
900,
84,
24900,
525,
3681,
43420,
7,
76,
2305,
23172,
62,
14933,
11,
198,
220,
220,
220,
7377,
102,
50,
62,
381,
76,
11,
198,
220,
220,
220,
37455,
17597,
62,
20192,
3712,
38469,
90,
38469,
... | 2.278475 | 2,072 |
using GZip
file_path = ARGS[1]
f = gzopen(joinpath(file_path))
for i=1:11
print(readline(f))
end
close(f) | [
3500,
402,
41729,
198,
198,
7753,
62,
6978,
796,
5923,
14313,
58,
16,
60,
198,
198,
69,
796,
308,
89,
9654,
7,
22179,
6978,
7,
7753,
62,
6978,
4008,
198,
198,
1640,
1312,
28,
16,
25,
1157,
198,
220,
220,
220,
3601,
7,
961,
1370,... | 2.017857 | 56 |
using juliaPackage, Test
@testset "powell" begin
x, f = 10, x->x^4+x^3+x^2+sin(x)
@test powell(f, x) == (-0.5480747372690095, -0.29506124329088085)
x, f = -24.5, x->x^2
@test powell(f, x) == (0.0, 0.0)
end | [
3500,
474,
43640,
27813,
11,
6208,
198,
198,
31,
9288,
2617,
366,
79,
32829,
1,
2221,
628,
220,
220,
220,
2124,
11,
277,
796,
838,
11,
2124,
3784,
87,
61,
19,
10,
87,
61,
18,
10,
87,
61,
17,
10,
31369,
7,
87,
8,
198,
220,
22... | 1.761538 | 130 |
<reponame>JuliaTelecom/AbstractSDRs.jl<gh_stars>1-10
module Printing
using Printf
# This module is intended to provide fancy macros to display warning
export @inforx, @warnrx;
export @infotx, @warntx;
# ----------------------------------------------------
# --- Fancy prints
# ----------------------------------------... | [
27,
7856,
261,
480,
29,
16980,
544,
31709,
785,
14,
23839,
50,
7707,
82,
13,
20362,
27,
456,
62,
30783,
29,
16,
12,
940,
198,
21412,
44118,
220,
198,
3500,
12578,
69,
198,
198,
2,
770,
8265,
318,
5292,
284,
2148,
14996,
34749,
284... | 2.687755 | 490 |
<gh_stars>0
export XorEnv, fitness, new_gen!
using NeuroEvolution
"Random BERL environment: returns random fitness"
mutable struct XorEnv <: BERLenv
name::String
memory::Array # Array of storable data
X::Array{Array{Float64}}
y::Array{Array{Float64}}
end
environments["xor"]=XorEnv
function XorEnv(cf... | [
27,
456,
62,
30783,
29,
15,
198,
39344,
1395,
273,
4834,
85,
11,
13547,
11,
649,
62,
5235,
0,
198,
198,
3500,
13782,
15200,
2122,
198,
198,
1,
29531,
347,
1137,
43,
2858,
25,
5860,
4738,
13547,
1,
198,
76,
18187,
2878,
1395,
273,
... | 2.076509 | 928 |
<reponame>viniciuspiccoli/QP232.jl
# Types to do a HF calculation
abstract type BasisFunction end
#= 1s Gaussian-type function
Smallest possible basis set is called the minimal basis set, and it contais one orbital.
For example, hydrogen has just one orbital, but carbon has 5 (1s, 2s, 2px, 2py, and 2pz) even though on... | [
27,
7856,
261,
480,
29,
7114,
291,
3754,
16564,
4033,
72,
14,
48,
47,
24339,
13,
20362,
198,
2,
24897,
284,
466,
257,
42253,
17952,
198,
397,
8709,
2099,
6455,
271,
22203,
886,
198,
198,
2,
28,
352,
82,
12822,
31562,
12,
4906,
216... | 3.527273 | 330 |
using Helium, DelimitedFiles, Test
# Create testing matrix
testmat = [
1.5 8 12 24
7 22 24 75
]
# File name in .he format and CSV
fileName = string(@__DIR__,"/data/testFile.he")
csvFileName = string(fileName[1:end-2], "csv")
##########################
# TEST 1 Writing/Reading #
############... | [
3500,
5053,
1505,
11,
4216,
320,
863,
25876,
11,
6208,
628,
198,
2,
13610,
4856,
17593,
198,
9288,
6759,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
352,
13,
20,
220,
220,
807,
220,
1105,
220,
1987,
198,
220,
220,
220,
220,
... | 2.767877 | 2,671 |
## =========================== ## ## =========================== ##
## Package of collective motion models ##
## <NAME> ##
## Release Version 0.1.0 ##
## 29 / 05 / 2018 ##
## =======================... | [
2235,
36658,
2559,
855,
22492,
22492,
36658,
2559,
855,
22492,
198,
2235,
220,
197,
220,
220,
15717,
286,
10098,
6268,
4981,
197,
197,
197,
22492,
198,
2235,
197,
220,
220,
1279,
20608,
29,
220,
220,
220,
220,
220,
220,
220,
220,
220,... | 2.566616 | 653 |
<gh_stars>0
using Base.Test
using Surprise
using Persa
#Testing
ds = Persa.createdummydataset()
holdout = Persa.HoldOut(ds, 0.9)
(ds_train, ds_test) = Persa.get(holdout)
model = Surprise.IRSVD(ds_train)
Persa.train!(model, ds_train)
@assert Persa.aval(model, ds_test).mae >= 0.0
| [
27,
456,
62,
30783,
29,
15,
198,
3500,
7308,
13,
14402,
198,
198,
3500,
47893,
198,
3500,
9467,
64,
198,
198,
2,
44154,
198,
9310,
796,
9467,
64,
13,
25598,
13513,
19608,
292,
316,
3419,
198,
198,
2946,
448,
796,
9467,
64,
13,
268... | 2.288 | 125 |
using CSV, DataFrames
println("Hello SWUFE!") | [
3500,
44189,
11,
6060,
35439,
198,
198,
35235,
7203,
15496,
12672,
52,
15112,
2474,
8
] | 3.066667 | 15 |
<gh_stars>0
include("euler/euler.jl")
using .Primes: prime_sieve
using BenchmarkTools
BenchmarkTools.DEFAULT_PARAMETERS.samples = 100
function compute(max_a::Int, max_b::Int)::Int
prime = prime_sieve(max_a * max_b)
prime_numbers = findall(prime[1:max_b])
append!(prime_numbers, .-prime_numbers)
max_sequ... | [
27,
456,
62,
30783,
29,
15,
198,
17256,
7203,
68,
18173,
14,
68,
18173,
13,
20362,
4943,
198,
3500,
764,
6836,
999,
25,
6994,
62,
82,
12311,
198,
3500,
25187,
4102,
33637,
198,
44199,
4102,
33637,
13,
7206,
38865,
62,
27082,
2390,
2... | 2.023136 | 389 |
<filename>src/noise_models.jl
import Base: view
#########################################################
# Normal noise model
#########################################################
mutable struct NormalNoise end
# inverse link
function invlink(::NormalNoise, A::AbstractMatrix)
return A
end
function loss(... | [
27,
34345,
29,
10677,
14,
3919,
786,
62,
27530,
13,
20362,
628,
198,
11748,
7308,
25,
1570,
198,
198,
29113,
14468,
7804,
2,
198,
2,
14435,
7838,
2746,
198,
29113,
14468,
7804,
2,
198,
76,
18187,
2878,
14435,
2949,
786,
886,
198,
19... | 2.264945 | 5,420 |
import Test: @testset, @test
import Model_Household: Household,default_bu_allocation
import FRS_Household_Getter
import Example_Household_Getter
import DataUtils: MinMaxes, add_to!, print
using Definitions
@testset "Example Households" begin
@time names = Example_Household_Getter.initialise()
@time for name ... | [
11748,
6208,
25,
2488,
9288,
2617,
11,
2488,
9288,
198,
11748,
9104,
62,
18102,
2946,
25,
37306,
11,
12286,
62,
11110,
62,
439,
5040,
198,
11748,
376,
6998,
62,
18102,
2946,
62,
3855,
353,
198,
11748,
17934,
62,
18102,
2946,
62,
3855,... | 1.948859 | 1,271 |
<gh_stars>0
using SymbolicWedderburn
using PermutationGroups
using Cyclotomics
using DynamicPolynomials
using SumOfSquares
using SCS
@polyvar x[1:4]
let m = SOSModel(SCS.Optimizer)
@variable m t
@objective m Max t
@variable m sos SOSPoly([1; x])
@constraint m sum(x) + sum(x.^2) - t == sos
optimiz... | [
27,
456,
62,
30783,
29,
15,
198,
3500,
41327,
4160,
19864,
1082,
10899,
198,
3500,
2448,
76,
7094,
38,
14459,
198,
3500,
28007,
313,
31994,
198,
198,
3500,
26977,
34220,
26601,
8231,
198,
3500,
5060,
5189,
22266,
3565,
198,
3500,
6374,
... | 2.237705 | 1,220 |
<reponame>UnofficialJuliaMirror/Wallace.jl-cae8e8ee-2945-58eb-bb0d-8aa7cb85bad1
module initialiser
using population, _deme_, core, fitness, representation, individual
export Initialiser, initialise!
"""
The base type used by all initialisers.
"""
abstract Initialiser
"""
Initialises all members within a given populat... | [
27,
7856,
261,
480,
29,
3118,
16841,
16980,
544,
27453,
1472,
14,
22401,
558,
13,
20362,
12,
66,
3609,
23,
68,
23,
1453,
12,
1959,
2231,
12,
3365,
1765,
12,
11848,
15,
67,
12,
23,
7252,
22,
21101,
5332,
14774,
16,
198,
21412,
4238... | 3.050378 | 397 |
using Clang
using Test
include("cbasic.jl")
include("functions.jl")
include("wrap_c.jl")
include("wrap_struct_typedef.jl")
| [
3500,
1012,
648,
198,
3500,
6208,
198,
198,
17256,
7203,
66,
35487,
13,
20362,
4943,
198,
17256,
7203,
12543,
2733,
13,
20362,
4943,
198,
17256,
7203,
37150,
62,
66,
13,
20362,
4943,
198,
17256,
7203,
37150,
62,
7249,
62,
774,
9124,
8... | 2.695652 | 46 |
<reponame>JuliaOpt/MathOptInterface
# Copyright (c) 2017: <NAME> and contributors
# Copyright (c) 2017: Google Inc.
#
# Use of this source code is governed by an MIT-style license that can be found
# in the LICENSE.md file or at https://opensource.org/licenses/MIT.
module Issue980
import MathOptInterface
const MOI = ... | [
27,
7856,
261,
480,
29,
16980,
544,
27871,
14,
37372,
27871,
39317,
198,
2,
15069,
357,
66,
8,
2177,
25,
1279,
20608,
29,
290,
20420,
198,
2,
15069,
357,
66,
8,
2177,
25,
3012,
3457,
13,
198,
2,
198,
2,
5765,
286,
428,
2723,
243... | 2.887324 | 213 |
function delete_cvrp(filepath)
rm(filepath)
end
function write_cvrp(cvrp::CVRPLIB.CVRP)
if cvrp.name == ""
name = randstring(10)
else
name = cvrp.name
end
filepath = joinpath(pwd(), name * ".vrp")
if cvrp.dummy > cvrp.depot # dummy is added
org_weights = cvrp.weight... | [
8818,
12233,
62,
33967,
81,
79,
7,
7753,
6978,
8,
198,
220,
220,
220,
42721,
7,
7753,
6978,
8,
198,
437,
198,
198,
8818,
3551,
62,
33967,
81,
79,
7,
33967,
81,
79,
3712,
34,
13024,
6489,
9865,
13,
34,
13024,
47,
8,
628,
220,
2... | 1.772765 | 1,219 |
<reponame>cesmix-mit/MDP<filename>src/Julia/Potential/neightripletlist.jl
function makejk(n)
m = Int64((n-1)*n/2);
indj = zeros(Int64,m);
indk = zeros(Int64,m);
k1 = 1;
for i = 1:(n-1)
ind = k1:(k1+(n-i)-1);
indj[ind] .= i;
indk[ind] = (i+1):n;
k1 = k1 + (n-i);
end
return indj, indk
end
func... | [
27,
7856,
261,
480,
29,
728,
19816,
12,
2781,
14,
44,
6322,
27,
34345,
29,
10677,
14,
16980,
544,
14,
25396,
1843,
14,
710,
432,
380,
37069,
4868,
13,
20362,
198,
8818,
787,
73,
74,
7,
77,
8,
198,
220,
220,
220,
220,
198,
76,
... | 1.990494 | 526 |
<filename>examples/jump_hs035_options.jl
using KNITRO, JuMP, Base.Test
for m in [Model(solver=KnitroSolver()),
Model(solver=KnitroSolver(KTR_PARAM_ALG=5)),
Model(solver=KnitroSolver(hessopt=1)),
Model(solver=KnitroSolver(options_file=joinpath(dirname(@__FILE__),
... | [
27,
34345,
29,
1069,
12629,
14,
43327,
62,
11994,
44215,
62,
25811,
13,
20362,
198,
3500,
22466,
2043,
13252,
11,
12585,
7378,
11,
7308,
13,
14402,
198,
198,
1640,
285,
287,
685,
17633,
7,
82,
14375,
28,
25095,
270,
305,
50,
14375,
... | 1.610938 | 640 |
using LabelledGraphs
export
AbstractGibbsNetwork,
network_graph,
vertex_map,
local_energy,
interaction_energy,
connecting_tensor,
normalize_probability,
boundary_state,
local_state_for_node,
iteration_order,
fuse_projectors,
update_gauges!
# S: type of the vertex of net... | [
3500,
3498,
11978,
37065,
82,
198,
198,
39344,
198,
220,
220,
220,
27741,
38,
571,
1443,
26245,
11,
198,
220,
220,
220,
3127,
62,
34960,
11,
198,
220,
220,
220,
37423,
62,
8899,
11,
198,
220,
220,
220,
1957,
62,
22554,
11,
198,
22... | 2.17971 | 2,415 |
<filename>test/test_julia15.jl
module TestJulia15
using CompositionsBase
using Documenter: doctest
using Test
@testset "⨟" begin
@test tuple ∘ inv === inv ⨟ tuple
@test ⨟(tuple) === opcompose(tuple)
end
@testset "doctest" begin
doctest(CompositionsBase; manual = false)
end
end # module
| [
27,
34345,
29,
9288,
14,
9288,
62,
73,
43640,
1314,
13,
20362,
198,
21412,
6208,
16980,
544,
1314,
198,
198,
3500,
29936,
1756,
14881,
198,
3500,
16854,
263,
25,
10412,
395,
198,
3500,
6208,
198,
198,
31,
9288,
2617,
366,
158,
101,
... | 2.533333 | 120 |
<gh_stars>10-100
@testset "1553.minimum-number-of-days-to-eat-n-oranges.jl" begin
@test min_days_1553(159832501) == 28
@test min_days_1553(82129117) == 28
@test min_days_1553(1) == 1
@test min_days_1553(6) == 3
@test min_days_1553(10) == 4
end | [
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
31,
9288,
2617,
366,
1314,
4310,
13,
39504,
12,
17618,
12,
1659,
12,
12545,
12,
1462,
12,
4098,
12,
77,
12,
273,
6231,
13,
20362,
1,
2221,
198,
220,
220,
220,
2488,
9288,
949,
62,
1254... | 2.054688 | 128 |
function simulate_logit(J,T, beta, v)
# --------------------------------------------------%
# Simulate logit with outside option
# --------------------------------------------------%
# J = number of products
# T = number of markets
# beta = coefficient on delta
# v = standard deviation of market-product demand shock
z... | [
8818,
29308,
62,
6404,
270,
7,
41,
11,
51,
11,
12159,
11,
410,
8,
198,
2,
20368,
1783,
438,
4,
198,
2,
3184,
5039,
2604,
270,
351,
2354,
3038,
198,
2,
20368,
1783,
438,
4,
198,
2,
449,
796,
1271,
286,
3186,
198,
2,
309,
796,
... | 2.579167 | 240 |
<reponame>devmotion/Bijectors.jl
#######################################################
# Constrained to unconstrained distribution bijectors #
#######################################################
struct TruncatedBijector{T} <: Bijector{0}
lb::T
ub::T
end
function (b::TruncatedBijector)(x::Real)
a, b =... | [
27,
7856,
261,
480,
29,
7959,
38714,
14,
23286,
752,
669,
13,
20362,
198,
29113,
14468,
4242,
21017,
198,
2,
1482,
2536,
1328,
284,
21254,
2536,
1328,
6082,
3182,
752,
669,
1303,
198,
29113,
14468,
4242,
21017,
198,
7249,
833,
19524,
... | 2.227233 | 1,131 |
abstract type AbstractNFFTPlan{T,D,DIM} end
##################
# define interface
##################
# in-place NFFT
@mustimplement nfft!(p::AbstractNFFTPlan{D,DIM,T}, f::AbstractArray, fHat::AbstractArray) where {D,DIM,T}
# in-place adjoint NFFT
@mustimplement nfft_adjoint!(p::AbstractNFFTPlan{D,DIM,T}, fHat::Abstrac... | [
397,
8709,
2099,
27741,
45,
5777,
51,
20854,
90,
51,
11,
35,
11,
35,
3955,
92,
886,
198,
198,
14468,
2235,
198,
2,
8160,
7071,
198,
14468,
2235,
198,
2,
287,
12,
5372,
399,
5777,
51,
198,
31,
27238,
320,
26908,
299,
487,
83,
0,
... | 2.320035 | 1,128 |
function pisum()
sum = 0.0
for j = 1:500
sum = 0.0
for k = 1:10000
sum += 1.0/(k*k)
end
end
sum
end
start = time()
temp = pisum()
stop = time()
elapsed = (stop - start)
println(elapsed)
| [
8818,
279,
271,
388,
3419,
198,
197,
16345,
796,
657,
13,
15,
198,
197,
1640,
474,
796,
352,
25,
4059,
198,
197,
197,
16345,
796,
657,
13,
15,
198,
197,
197,
1640,
479,
796,
352,
25,
49388,
198,
197,
197,
197,
16345,
15853,
352,
... | 2.05102 | 98 |
using Distributions
import Random: rand!, rand
import Distributions: logpdf
"""
RandomWalk(ϵ::T, pos::S)
Defines a random walk on `|ϵ|`-dimensional space. ``ϵ` defines the maximal
one-sided range of a single step and `pos` is a vector of indicators for whether
a respective index is restricted to take only positiv... | [
3500,
46567,
507,
198,
11748,
14534,
25,
43720,
28265,
43720,
198,
11748,
46567,
507,
25,
2604,
12315,
198,
198,
37811,
198,
220,
220,
220,
14534,
35963,
7,
139,
113,
3712,
51,
11,
1426,
3712,
50,
8,
198,
198,
7469,
1127,
257,
4738,
... | 2.074106 | 1,147 |
module Serializer
import SearchLight
function serialize end
function deserialize end
function serializables(::T)::Vector{Symbol} where {T<:SearchLight.AbstractModel}
Symbol[]
end
function serializables(::Any)::Vector{Symbol}
Symbol[]
end
include("../serializers/JsonSerializer.jl")
end | [
21412,
23283,
7509,
198,
198,
11748,
11140,
15047,
198,
198,
8818,
11389,
1096,
886,
198,
198,
8818,
748,
48499,
1096,
886,
198,
198,
8818,
11389,
528,
2977,
7,
3712,
51,
2599,
25,
38469,
90,
13940,
23650,
92,
810,
1391,
51,
27,
25,
... | 3.148936 | 94 |
"""
AX2StageLeastSquares(y, D, instrument, control)
A simple two stage least squares implementation.
"""
struct AX2StageLeastSquares <: AXEstimator
β::Array{Float64} # coefficient
FS::Array{Float64} # first stage coefficients
y::Matrix{Float64} # response
Z::Matrix{Float64} # combined first stage variables... | [
37811,
198,
25922,
17,
29391,
3123,
459,
22266,
3565,
7,
88,
11,
360,
11,
8875,
11,
1630,
8,
198,
32,
2829,
734,
3800,
1551,
24438,
7822,
13,
198,
37811,
198,
7249,
43051,
17,
29391,
3123,
459,
22266,
3565,
1279,
25,
43051,
22362,
3... | 2.40101 | 990 |
import Base: *, sort
using Random, Statistics, DataFrames, CSV
using BioSequences
import BioSequences: iscompatible
################################################
#OligoRL Toolset
#################################################
# Overload the concatenation operator to combine a sequence and
# a single base, i.e... | [
11748,
7308,
25,
1635,
11,
3297,
198,
3500,
14534,
11,
14370,
11,
6060,
35439,
11,
44189,
198,
3500,
16024,
44015,
3007,
198,
11748,
16024,
44015,
3007,
25,
318,
38532,
198,
198,
29113,
14468,
198,
2,
46,
4604,
78,
7836,
16984,
2617,
... | 2.22867 | 20,077 |
<reponame>JuliaTagBot/XFloats.jl
for F in (:+, :-, :abs, :inv, :sqrt, :cbrt)
@eval begin
$F(x::XFloat16) = XFloat16($F(Float32(x)))
$F(x::XFloat32) = XFloat32($F(Float64(x)))
end
end
for F in (:+, :-, :*, :/, :\, :^)
@eval begin
$F(x::XFloat16, y::XFloat16) = XFloat16($F(Float32(x), Float32(y)))
... | [
27,
7856,
261,
480,
29,
16980,
544,
24835,
20630,
14,
55,
33574,
1381,
13,
20362,
198,
1640,
376,
287,
357,
25,
28200,
1058,
20995,
1058,
8937,
11,
1058,
16340,
11,
1058,
31166,
17034,
11,
1058,
66,
1671,
83,
8,
198,
220,
2488,
1820... | 1.941691 | 686 |
@testset "GPS L1" begin
gpsl1 = GPSL1(use_gpu = Val(true))
@test @inferred(get_center_frequency(gpsl1)) == 1.57542e9Hz
@test @inferred(get_code_length(gpsl1)) == 1023
@test @inferred(get_secondary_code_length(gpsl1)) == 1
CUDA.@allowscalar @test @inferred(get_code(gpsl1, 0, 1)) == 1
CUDA.@allow... | [
31,
9288,
2617,
366,
38,
3705,
406,
16,
1,
2221,
628,
220,
220,
220,
308,
862,
75,
16,
796,
15472,
43,
16,
7,
1904,
62,
46999,
796,
3254,
7,
7942,
4008,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
7,
1136,
62,
16159,
62,
... | 2.065359 | 306 |
<gh_stars>0
"""
showblockinterpretable(backend, encodings, block, data)
Decode `block` successively by applying `encodings` until a block is gotten
that can be shown by `backend`. Useful to visualize encoded data that
is not directly interpretable, for example an `Image{2}` representing an
encoded `Image`.
## E... | [
27,
456,
62,
30783,
29,
15,
628,
198,
37811,
198,
220,
220,
220,
905,
9967,
27381,
540,
7,
1891,
437,
11,
2207,
375,
654,
11,
2512,
11,
1366,
8,
198,
198,
10707,
1098,
4600,
9967,
63,
1943,
2280,
416,
11524,
4600,
12685,
375,
654,... | 2.568162 | 1,137 |
<gh_stars>10-100
struct Piecewise{T, B, VT<:AbstractVector{T}, VB<:AbstractVector{B}}
subfunctions::VT
breaks::VB
clamp::Bool
function Piecewise(subfunctions::VT, breaks::VB; clamp::Bool=true) where {T, B, VT<:AbstractVector{T}, VB<:AbstractVector{B}}
@assert issorted(breaks)
@assert le... | [
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
7249,
27053,
3083,
90,
51,
11,
347,
11,
32751,
27,
25,
23839,
38469,
90,
51,
5512,
569,
33,
27,
25,
23839,
38469,
90,
33,
11709,
198,
220,
220,
220,
850,
12543,
2733,
3712,
36392,
198,
... | 2.289294 | 439 |
<filename>benchmark/string.jl
# only need to be run once to install packages
#Pkg.clone("https://github.com/JuliaData/SplitApplyCombine.jl.git")
#Pkg.clone("https://github.com/xiaodaigh/FastGroupBy.jl.git")
using Revise, DataBench
using FastGroupBy
const M=100_000_000; const K=100
srand(1)
svec1 = rand(["i"*dec(k,7... | [
27,
34345,
29,
26968,
4102,
14,
8841,
13,
20362,
628,
198,
2,
691,
761,
284,
307,
1057,
1752,
284,
2721,
10392,
198,
2,
47,
10025,
13,
21018,
7203,
5450,
1378,
12567,
13,
785,
14,
16980,
544,
6601,
14,
41205,
44836,
20575,
500,
13,
... | 2.040018 | 2,199 |
<filename>src/schemes.jl
# -----------------------------------------------------
# This script gives the methods for maniupulating the
# Cartesian indices corresponding to multilevels that
# are either kept or cut in various schemes of
# "sparsification"
# -----------------------------------------------------
# Effici... | [
27,
34345,
29,
10677,
14,
1416,
4411,
274,
13,
20362,
198,
2,
20368,
19351,
12,
198,
2,
770,
4226,
3607,
262,
5050,
329,
582,
72,
929,
8306,
262,
198,
2,
13690,
35610,
36525,
11188,
284,
1963,
576,
626,
82,
326,
198,
2,
389,
2035,... | 2.849638 | 552 |
"""
add_metabolite!(model, metabolite)
Add a metabolite to the model
"""
function add_metabolite!(model::Model, metabolite::String; b::Number = 0, csense::String = "=")
add_metabolite!(model, metabolite, b, csense)
end
function add_metabolite!(model::Model, metabolite::String, b::Number = 0, csense::St... | [
37811,
201,
198,
220,
220,
220,
751,
62,
4164,
28426,
578,
0,
7,
19849,
11,
14623,
578,
8,
201,
198,
201,
198,
4550,
257,
14623,
578,
284,
262,
2746,
201,
198,
37811,
201,
198,
8818,
751,
62,
4164,
28426,
578,
0,
7,
19849,
3712,
... | 2.591816 | 9,873 |
values_type(::T) where {T} = values_type(T)
values_type(::Type{T}) where {T} = T
keys_type(::T) where {T<:AbstractVector} = LinearIndices{1,Tuple{Base.OneTo{Int64}}}
keys_type(x::T) where {T} = typeof(keys(x))
## TODO these should go in base if possible
struct BitAnd{F1<:Function,F2<:Function} <: Function
f1::F1
... | [
27160,
62,
4906,
7,
3712,
51,
8,
810,
1391,
51,
92,
796,
3815,
62,
4906,
7,
51,
8,
198,
27160,
62,
4906,
7,
3712,
6030,
90,
51,
30072,
810,
1391,
51,
92,
796,
309,
198,
198,
13083,
62,
4906,
7,
3712,
51,
8,
810,
1391,
51,
27... | 1.96817 | 377 |
### A Pluto.jl notebook ###
# v0.12.18
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
lo... | [
21017,
317,
32217,
13,
20362,
20922,
44386,
198,
2,
410,
15,
13,
1065,
13,
1507,
198,
198,
3500,
2940,
2902,
198,
3500,
21365,
18274,
4487,
198,
198,
2,
770,
32217,
20922,
3544,
2488,
21653,
329,
9427,
3458,
13,
1649,
2491,
428,
20922... | 1.819845 | 1,421 |
@testset "generate & specialcases methods" begin
for type ∈ types_with_generate
@test length(generate(type, 100)) == 100
@test !isempty(specialcases(type))
end
@test isempty(specialcases(Any))
end
| [
31,
9288,
2617,
366,
8612,
378,
1222,
2041,
33964,
5050,
1,
2221,
198,
220,
220,
220,
329,
2099,
18872,
230,
3858,
62,
4480,
62,
8612,
378,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
4129,
7,
8612,
378,
7,
4906,
11,
1802,... | 2.568182 | 88 |
using LinearAlgebra
using FermiCG
using Printf
using Test
using LinearMaps
using Arpack
using Profile
atoms = []
push!(atoms,Atom(1,"H",[0,0,0]))
push!(atoms,Atom(2,"H",[0,0,1]))
push!(atoms,Atom(3,"H",[0,0,2]))
push!(atoms,Atom(4,"H",[0,0,3]))
push!(atoms,Atom(5,"H",[0,0,4]))
push!(atoms,Atom(6,"H",[0,0,5]))
push!(... | [
3500,
44800,
2348,
29230,
198,
3500,
376,
7780,
72,
39816,
198,
3500,
12578,
69,
198,
3500,
6208,
198,
3500,
44800,
47010,
198,
3500,
943,
8002,
198,
198,
3500,
13118,
220,
198,
198,
265,
3150,
796,
17635,
198,
14689,
0,
7,
265,
3150,... | 1.787484 | 767 |
#The m-by-n Hilbert matrix has matrix elements
# H_{ij} = 1/(i+j-1)
export Hilbert, InverseHilbert
"""
[`Hilbert` matrix](http://en.wikipedia.org/wiki/Hilbert_matrix)
```julia
julia> A=Hilbert(5)
Hilbert{Rational{Int64}}(5,5)
julia> Matrix(A)
5x5 Array{Rational{Int64},2}:
1//1 1//2 1//3 1//4 1//5
1//2 1//3 1/... | [
2,
464,
285,
12,
1525,
12,
77,
47718,
17593,
468,
17593,
4847,
198,
2,
367,
23330,
2926,
92,
796,
352,
29006,
72,
10,
73,
12,
16,
8,
198,
39344,
47718,
11,
554,
4399,
39,
346,
4835,
198,
37811,
198,
58,
63,
39,
346,
4835,
63,
... | 2.03048 | 1,542 |
<reponame>UnofficialJuliaMirrorSnapshots/AndersonMoore.jl-cbbd4180-e2e7-58a0-b2fb-29c9dbd95a4e
"""
AndersonMooreAlg(h, qcols, neq)
Solve a linear perfect foresight model using the julia eig
function to find the invariant subspace associated with the big
roots. This procedure will fail if the companion matrix is
d... | [
27,
7856,
261,
480,
29,
3118,
16841,
16980,
544,
27453,
1472,
43826,
20910,
14,
42991,
40049,
13,
20362,
12,
66,
11848,
67,
19,
15259,
12,
68,
17,
68,
22,
12,
3365,
64,
15,
12,
65,
17,
21855,
12,
1959,
66,
24,
9945,
67,
3865,
64... | 2.171117 | 1,648 |
using NonLinearReactionAdvectionDiffusionWithFrontData;
using NonLinearReactionAdvectionDiffusionWithFrontData: shishkin_mesh;
using LinearAlgebra;
u_l(t) = -8; # ГУ
u_r(t) = 4; #
qf(x) = 4*sin(3 * π * x); # Коэффициент линейного усиления, который в обратной
# задаче необхо... | [
3500,
8504,
14993,
451,
3041,
2673,
2782,
303,
596,
28813,
4241,
3152,
25886,
6601,
26,
198,
3500,
8504,
14993,
451,
3041,
2673,
2782,
303,
596,
28813,
4241,
3152,
25886,
6601,
25,
427,
680,
5116,
62,
76,
5069,
26,
198,
3500,
44800,
2... | 1.193309 | 2,152 |
<filename>test/test_kmeans.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 li... | [
27,
34345,
29,
9288,
14,
9288,
62,
74,
1326,
504,
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,
... | 2.836257 | 855 |
<filename>src/clang/core/Basic/SourceManager.jl
"""
struct SourceManager <: Any
Hold a pointer to a `clang::SourceManager` object.
"""
struct SourceManager
ptr::CXSourceManager
end
Base.unsafe_convert(::Type{CXSourceManager}, x::SourceManager) = x.ptr
Base.cconvert(::Type{CXSourceManager}, x::SourceManager) = ... | [
27,
34345,
29,
10677,
14,
565,
648,
14,
7295,
14,
26416,
14,
7416,
13511,
13,
20362,
198,
37811,
198,
220,
220,
220,
2878,
8090,
13511,
1279,
25,
4377,
198,
26807,
257,
17562,
284,
257,
4600,
565,
648,
3712,
7416,
13511,
63,
2134,
1... | 2.900901 | 111 |
"""
module ArnoldiMethodTransformations
Provides convenience wrapper for interfacing with the package ArnoldiMethod.
Implements the shift-and-invert transformation detailed [here](https://haampie.github.io/ArnoldiMethod.jl/stable/).
The main functions are `partialschur(A,[B],σ; kwargs...)` and `partialeigen(A,σ;... | [
37811,
198,
220,
220,
220,
8265,
21418,
72,
17410,
41762,
602,
198,
198,
15946,
1460,
15607,
29908,
329,
9556,
4092,
351,
262,
5301,
21418,
72,
17410,
13,
198,
198,
3546,
1154,
902,
262,
6482,
12,
392,
12,
259,
1851,
13389,
6496,
685,... | 2.207983 | 4,635 |
using Nemo
using Distributions
using LinearAlgebra
using PolynomialRoots
struct CollocationFunction
a::Array{Float64}
b::Array{Float64}
c::Array{Float64}
x::Array{Float64}
leftSlope::Float64
rightSlope::Float64
end
function evaluate(self::CollocationFunction, z::Float64)
if z <= self.x[1]... | [
3500,
22547,
78,
198,
3500,
46567,
507,
198,
3500,
44800,
2348,
29230,
198,
3500,
12280,
26601,
498,
49,
13880,
628,
198,
7249,
7778,
5040,
22203,
198,
220,
220,
220,
257,
3712,
19182,
90,
43879,
2414,
92,
198,
220,
220,
220,
275,
371... | 1.625081 | 9,218 |
<reponame>UnofficialJuliaMirrorSnapshots/ExpressionPatterns.jl-df068d8e-6bdd-5cd0-b77b-69c5de8ae8a3
module Function
using ...Analyzer.Function
using ...PatternStructure.Trees
using ...PatternStructure.Checks
using ...PatternStructure.SlurpTypes
using ...PatternStructure.Special
using ...Matching.Environment
using... | [
27,
7856,
261,
480,
29,
3118,
16841,
16980,
544,
27453,
1472,
43826,
20910,
14,
16870,
2234,
47546,
82,
13,
20362,
12,
7568,
15,
3104,
67,
23,
68,
12,
21,
65,
1860,
12,
20,
10210,
15,
12,
65,
3324,
65,
12,
3388,
66,
20,
2934,
23... | 2.99523 | 2,306 |
<filename>examples/comparisons/acrobot/acrobot.jl
using Pkg
Pkg.activate(@__DIR__)
using MuJoCo
mj_activate("/home/taylor/.mujoco/bin/mjkey.txt") # set location to MuJoCo key path
using LyceumMuJoCo, LyceumMuJoCoViz
using FiniteDiff
using IterativeLQR
using LinearAlgebra
using Random
# ## load MuJoCo model
path =... | [
27,
34345,
29,
1069,
12629,
14,
785,
1845,
9886,
14,
330,
305,
13645,
14,
330,
305,
13645,
13,
20362,
198,
3500,
350,
10025,
220,
198,
47,
10025,
13,
39022,
7,
31,
834,
34720,
834,
8,
198,
198,
3500,
8252,
9908,
7222,
198,
76,
73,... | 1.953969 | 1,499 |
<filename>examples/ex02_convergence.jl
#!/usr/bin/env python
# coding: utf-8
# # Convergence on local interaction model
#
# ## Loading modules
using QSWalk
using LightGraphs # for graph functions
using GraphPlot # for ploting graphs
using LinearAlgebra # for linear algebra utilities
# ## Numerical proof of uniq... | [
27,
34345,
29,
1069,
12629,
14,
1069,
2999,
62,
1102,
332,
12745,
13,
20362,
198,
2,
48443,
14629,
14,
8800,
14,
24330,
21015,
198,
2,
19617,
25,
3384,
69,
12,
23,
198,
198,
2,
1303,
35602,
12745,
319,
1957,
10375,
2746,
198,
2,
2... | 3.242604 | 845 |
"""
importASCII(file::AbstractString [, outfile])
Imports an ESRI Ascii grid to a .grd file and returns a new VerySimpleRaster
object. Specify `outfile` to keep the newly created file.
"""
function importASCII(x::AbstractString, outfile = "")
file = open(x, "r")
nc = parse(Int, match(r"NCOLS (.+)", readlin... | [
37811,
198,
220,
220,
220,
1330,
42643,
3978,
7,
7753,
3712,
23839,
10100,
685,
11,
503,
7753,
12962,
198,
198,
3546,
3742,
281,
13380,
7112,
1081,
979,
72,
10706,
284,
257,
764,
2164,
67,
2393,
290,
5860,
257,
649,
9576,
26437,
49,
... | 2.290265 | 565 |
include("../load.jl")
using Test, SSE
@testset "Binning" begin
include("Binning.jl")
end
@testset "Lattice" begin
include("Lattice.jl")
end
| [
17256,
7203,
40720,
2220,
13,
20362,
4943,
198,
3500,
6208,
11,
311,
5188,
198,
198,
31,
9288,
2617,
366,
33,
23062,
1,
2221,
198,
220,
220,
220,
2291,
7203,
33,
23062,
13,
20362,
4943,
198,
437,
198,
198,
31,
9288,
2617,
366,
43,
... | 2.435484 | 62 |
<filename>src/Nihilist.jl
"""
Nihilist
Performs encryption, decryption, and chart generation based on the VIC Soviet cipher;
a straddling checkerboard of the nihilist family of ciphers.
"""
module Nihilist
using DataFrames
using CSV
#Type union for interpreting loading a chart from file in the encode/decode stage... | [
27,
34345,
29,
10677,
14,
45,
20898,
396,
13,
20362,
198,
37811,
198,
197,
45,
20898,
396,
198,
198,
5990,
23914,
15835,
11,
875,
13168,
11,
290,
8262,
5270,
1912,
319,
262,
569,
2149,
7570,
38012,
26,
220,
198,
64,
965,
2860,
1359,... | 2.559204 | 4,020 |
using Morton
using Test
using Random
@test cartesian2morton([5,2]) == 19
@test cartesian3morton([5,2,1]) == 67
@test morton2cartesian(19) == [5,2]
@test morton3cartesian(67) == [5,2,1]
@test tree2morton([2,1,3]) == 19
@test tree3morton([2,1,3]) == 67
@test morton2tree(19) == [2,1,3]
@test morton3tree(67) == [2,1,3]
@t... | [
3500,
35766,
198,
3500,
6208,
198,
3500,
14534,
198,
198,
31,
9288,
6383,
35610,
17,
30171,
261,
26933,
20,
11,
17,
12962,
6624,
678,
198,
31,
9288,
6383,
35610,
18,
30171,
261,
26933,
20,
11,
17,
11,
16,
12962,
6624,
8275,
198,
31,... | 2.0875 | 640 |
<gh_stars>1-10
using ..SearchProblem
using Random
puzzle_actions = Dict{String,Tuple{Int,Int}}(
"UP" => (-1, 0),
"DOWN" => (1, 0),
"LEFT" => (0, -1),
"RIGHT" => (0, 1))
mutable struct City
position::Tuple{Float32,Float32}
num_places::Int
np::Int
side::Float32
place... | [
27,
456,
62,
30783,
29,
16,
12,
940,
198,
3500,
11485,
18243,
40781,
198,
3500,
14534,
198,
198,
79,
9625,
62,
4658,
796,
360,
713,
90,
10100,
11,
51,
29291,
90,
5317,
11,
5317,
11709,
7,
198,
220,
220,
220,
220,
220,
220,
220,
... | 2.214591 | 2,810 |
using DFWannier
using Optim
function change_lsoc(model,indices,lambda)
for wfc in model.wfcs[indices[1] : indices[2]]
wfc.atom = PhysAtom(wfc.atom.center,lambda)
end
end
function optimize_l()
T = Float64
cell_param = 4.3392*T[ 0.8424444 -0.4863855 -3.7e-8;-1.5e-8 0.972771 6.0e-9;-5.7e-8 6.0e-9 1.522692... | [
3500,
360,
24160,
1236,
959,
198,
3500,
30011,
198,
198,
8818,
1487,
62,
7278,
420,
7,
19849,
11,
521,
1063,
11,
50033,
8,
198,
220,
329,
266,
16072,
287,
2746,
13,
86,
69,
6359,
58,
521,
1063,
58,
16,
60,
1058,
36525,
58,
17,
1... | 1.978933 | 712 |
# ---
# title: 1572. Matrix Diagonal Sum
# id: problem1572
# author: <NAME>
# date: 2020-10-31
# difficulty: Easy
# categories: Array
# link: <https://leetcode.com/problems/matrix-diagonal-sum/description/>
# hidden: true
# ---
#
# Given a square matrix `mat`, return the sum of the matrix diagonals.
#
# Only include ... | [
2,
11420,
198,
2,
3670,
25,
1315,
4761,
13,
24936,
6031,
27923,
5060,
198,
2,
4686,
25,
1917,
1314,
4761,
198,
2,
1772,
25,
1279,
20608,
29,
198,
2,
3128,
25,
12131,
12,
940,
12,
3132,
198,
2,
8722,
25,
16789,
198,
2,
9376,
25,
... | 2.023704 | 675 |
<gh_stars>1-10
using Printf, Test
include("../../hybmc/termstructures/YieldCurve.jl")
include("../../hybmc/models/HullWhiteModel.jl")
include("../../hybmc/simulations/McSimulation.jl")
include("../../hybmc/simulations/Payoffs.jl")
function setup()
curve = YieldCurve(0.03)
mean = 0.03
times = [ 1.0, 2... | [
27,
456,
62,
30783,
29,
16,
12,
940,
198,
198,
3500,
12578,
69,
11,
6208,
198,
198,
17256,
7203,
40720,
40720,
12114,
20475,
66,
14,
4354,
7249,
942,
14,
56,
1164,
26628,
303,
13,
20362,
4943,
198,
17256,
7203,
40720,
40720,
12114,
... | 1.993213 | 1,768 |
module AbstractSphericalHarmonics
using ComputedFieldTypes
using LinearAlgebra
using StaticArrays
################################################################################
# FastSphericalHarmonics requires julia >= 1.7
# SSHT requires julia >= 1.6
# using FastSphericalHarmonics
using SSHT
export ash_grid_si... | [
21412,
27741,
4561,
37910,
39,
1670,
38530,
198,
198,
3500,
955,
17128,
15878,
31431,
198,
3500,
44800,
2348,
29230,
198,
3500,
36125,
3163,
20477,
198,
198,
29113,
29113,
14468,
198,
198,
2,
12549,
4561,
37910,
39,
1670,
38530,
4433,
474... | 3.624473 | 237 |
<reponame>wangleiphy/VAN.jl<gh_stars>1-10
#some useful functions
glorot_uniform(dims...) = (rand(Float64, dims...) .- 0.5) .* sqrt(24.0/sum(dims))
relu(x::Real) = max(zero(x), x)
sigmoid(x::Real) = one(x) / (one(x) + exp(-x))
softplus(x::Real) = ifelse(x > 0, x + log1p(exp(-x)), log1p(exp(x)))
| [
27,
7856,
261,
480,
29,
86,
9248,
541,
12114,
14,
53,
1565,
13,
20362,
27,
456,
62,
30783,
29,
16,
12,
940,
198,
2,
11246,
4465,
5499,
198,
70,
4685,
313,
62,
403,
6933,
7,
67,
12078,
23029,
796,
357,
25192,
7,
43879,
2414,
11,
... | 2.02027 | 148 |
#=
Created on Tuesday 2 July 2019
Last update: Saturday 27 July 2019
@author: <NAME>
<EMAIL>
Benchmarking Kroncker.jl compated to native functions.
=#
using Kronecker, Plots, LinearAlgebra
using BenchmarkTools
sizes = [5, 10, 25, 50, 100, 250, 500, 1000, 5000]
tmax = 10
# inverse
times_kron = []
times_naive = [... | [
2,
28,
198,
41972,
319,
3431,
362,
2901,
13130,
198,
5956,
4296,
25,
3909,
2681,
2901,
13130,
198,
198,
31,
9800,
25,
1279,
20608,
29,
198,
27,
27630,
4146,
29,
198,
198,
44199,
4102,
278,
44732,
15280,
13,
20362,
552,
515,
284,
686... | 2.036859 | 1,248 |
<filename>examples/collapse_dry_implicit.jl<gh_stars>1-10
#=
# 3: Water collapse (implicit)
```@raw html
<img src='../assets/collapse_exp.png' width="50%" height="50%" alt='missing' /><br>
```
Simulation of a water column collapsing under its own weight onto dry bottom.
Here with strictly incompressible approach (P... | [
27,
34345,
29,
1069,
12629,
14,
26000,
7512,
62,
39140,
62,
23928,
3628,
13,
20362,
27,
456,
62,
30783,
29,
16,
12,
940,
198,
2,
28,
198,
198,
2,
513,
25,
5638,
9807,
357,
23928,
3628,
8,
198,
198,
15506,
63,
31,
1831,
27711,
19... | 2.375185 | 2,023 |
module CommonSolve
solve(args...; kwargs...) = solve!(init(args...; kwargs...))
function solve! end
function init end
end # module
| [
21412,
8070,
50,
6442,
198,
198,
82,
6442,
7,
22046,
986,
26,
479,
86,
22046,
23029,
796,
8494,
0,
7,
15003,
7,
22046,
986,
26,
479,
86,
22046,
986,
4008,
198,
8818,
8494,
0,
886,
198,
8818,
2315,
886,
198,
198,
437,
1303,
8265,
... | 2.955556 | 45 |
<filename>src/functions.jl
module DTWDTfunctions
export test, computeErrorFunction, accumulateErrorFunction, backtrackDistanceFunction, computeDTWerror
"""
USAGE: err = computeErrorFunction( u1, u0, nSample, lag )
INPUT:
u1 = trace that we want to warp; size = (nsamp,1)
u0 = reference trace to com... | [
27,
34345,
29,
10677,
14,
12543,
2733,
13,
20362,
198,
21412,
24311,
22332,
51,
12543,
2733,
198,
39344,
1332,
11,
24061,
12331,
22203,
11,
29915,
12331,
22203,
11,
736,
11659,
45767,
22203,
11,
24061,
24544,
54,
18224,
198,
198,
37811,
... | 2.301666 | 5,821 |
mutable struct ActionSelector{A}
k::Function
C::Array{Float64}
b0::Any
D::Dict
d::Union{Nothing, Function}
function ActionSelector{A}(k::Function, C::Array{Float64}, d::Union{Nothing, Function}=nothing) where {A} #, sz::Int)
b0 = nothing
D = Dict{POWTreeObsNode, Array{A}}()
... | [
198,
76,
18187,
2878,
7561,
17563,
273,
90,
32,
92,
198,
220,
220,
220,
479,
3712,
22203,
198,
220,
220,
220,
327,
3712,
19182,
90,
43879,
2414,
92,
198,
220,
220,
220,
275,
15,
3712,
7149,
198,
220,
220,
220,
360,
3712,
35,
713,
... | 2.237439 | 1,234 |
module Move_SolidFileMesh
using Modia3D
using Modia3D.StaticArrays
vmat1 = Modia3D.Material(color="LightBlue" , transparency=0.5) # material of SolidFileMesh
vmat2 = deepcopy(vmat1) # material of convex decomposition of SolidFileMesh
vmat2.transparency = 0.7
font = Modia... | [
21412,
10028,
62,
46933,
8979,
37031,
198,
198,
3500,
3401,
544,
18,
35,
198,
3500,
3401,
544,
18,
35,
13,
45442,
3163,
20477,
198,
198,
85,
6759,
16,
796,
3401,
544,
18,
35,
13,
17518,
7,
8043,
2625,
15047,
14573,
1,
837,
13902,
... | 2.282258 | 620 |
<filename>intro.jl<gh_stars>1-10
### A Pluto.jl notebook ###
# v0.12.20
using Markdown
using InteractiveUtils
# ╔═╡ 078beb8e-3003-11eb-2024-832e809585c7
md"The goal of this notebook is to simultaneously learn how to program with julia while learning the material for AP Calculus, AP Chemistry, and computer science. In... | [
27,
34345,
29,
600,
305,
13,
20362,
27,
456,
62,
30783,
29,
16,
12,
940,
198,
21017,
317,
32217,
13,
20362,
20922,
44386,
198,
2,
410,
15,
13,
1065,
13,
1238,
198,
198,
3500,
2940,
2902,
198,
3500,
21365,
18274,
4487,
198,
198,
2,... | 2.159844 | 513 |
<filename>UAVLanding.jl
"""
Problem Overview:
A UAV chases a moving ground platform (the target) and intends to finally land on it.
Assume full knowledge of the UAV state with the only uncertainty lying on the target state.
A camera installed on the UAV receives intermittent observations of the target to estimate its... | [
27,
34345,
29,
52,
10116,
22342,
278,
13,
20362,
628,
198,
37811,
198,
40781,
28578,
25,
198,
32,
471,
10116,
442,
1386,
257,
3867,
2323,
3859,
357,
1169,
2496,
8,
290,
19582,
284,
3443,
1956,
319,
340,
13,
198,
8021,
2454,
1336,
37... | 2.186047 | 4,859 |
<filename>src/ITensorLocalMPO.jl
module ITensorLocalMPO
using
ITensors,
LinearAlgebra
export
combine_and_transform,
inv_transform_and_uncombine,
scale_bases
include("scale_bases.jl")
end
| [
27,
34345,
29,
10677,
14,
2043,
22854,
14565,
7378,
46,
13,
20362,
198,
21412,
7283,
22854,
14565,
7378,
46,
198,
198,
3500,
198,
220,
7283,
641,
669,
11,
198,
220,
44800,
2348,
29230,
198,
198,
39344,
198,
220,
12082,
62,
392,
62,
... | 2.61039 | 77 |
using Clines, SimpleDrawing, Plots
function apollo_work(C1::Circle, C2::Circle, C3::Circle, min_radius)
S = soddy(C1, C2, C3)
if radius(S) < min_radius
return
end
draw(S, linewidth = 0.25)
apollo_work(C1, C2, S, min_radius)
apollo_work(C1, C3, S, min_radius)
apollo_work(C2, C3, S, m... | [
3500,
1012,
1127,
11,
17427,
25302,
278,
11,
1345,
1747,
198,
198,
8818,
2471,
15578,
62,
1818,
7,
34,
16,
3712,
31560,
293,
11,
327,
17,
3712,
31560,
293,
11,
327,
18,
3712,
31560,
293,
11,
949,
62,
42172,
8,
198,
220,
220,
220,
... | 2.038554 | 415 |
module MDToolbox
using Base.Threads: AtomicTypes
using FileIO
using NetCDF
#using NCDatasets
using NLsolve
using FFTW
#using Bio3DView
using CUDA
using ProgressMeter
using MetaGraphs, Graphs, GraphRecipes, Plots
using ChainRulesCore
import ChainRulesCore: rrule
# standard library
using Printf
using Statistics
using L... | [
21412,
10670,
25391,
3524,
198,
198,
3500,
7308,
13,
16818,
82,
25,
28976,
31431,
198,
3500,
9220,
9399,
198,
3500,
3433,
34,
8068,
198,
2,
3500,
399,
8610,
265,
292,
1039,
198,
3500,
22879,
82,
6442,
198,
3500,
376,
9792,
54,
198,
... | 2.888041 | 786 |
include("rendering.jl")
mutable struct Lightray
x::Float64
y::Float64
angle::Float64
end
mutable struct Tree
x::Float64
y::Float64
growth::Float64
end
function drawlightray(r, lightray)
drawsetcolor(r, 255, 255, 255)
x2 = lightray.x + cos(lightray.angle) * 20
y2 = lightray.y - sin... | [
17256,
7203,
13287,
278,
13,
20362,
4943,
198,
198,
76,
18187,
2878,
4401,
2433,
198,
220,
220,
220,
2124,
3712,
43879,
2414,
198,
220,
220,
220,
331,
3712,
43879,
2414,
198,
220,
220,
220,
9848,
3712,
43879,
2414,
198,
437,
198,
198,... | 1.938897 | 2,013 |
"""
Test two-stage shooting method
"""
using LinearAlgebra
using DifferentialEquations
using BenchmarkTools
using Plots
pyplot()
include("../../julia-R3BP/R3BP/src/R3BP.jl")
include("../src/ShootingStar.jl")
## Initialize ODE settings
reltol = 1.e-12
abstol = 1.e-12
method = Tsit5()
## define ... | [
37811,
201,
198,
14402,
734,
12,
14247,
4395,
2446,
201,
198,
37811,
201,
198,
201,
198,
3500,
44800,
2348,
29230,
201,
198,
3500,
20615,
498,
23588,
602,
201,
198,
3500,
25187,
4102,
33637,
201,
198,
3500,
1345,
1747,
201,
198,
201,
... | 2.026379 | 834 |
<gh_stars>1-10
include("TestFeature.jl")
function testInstance(outInstance::Ref, outGlfw::Ref)
# Create a Vulkan instance, tell it we need glfw and the validation as
# extension features
fs = Vector{features.IFeature}()
fsValid = features.create(features.Validation)
glfw = features.create(features.G... | [
27,
456,
62,
30783,
29,
16,
12,
940,
198,
17256,
7203,
14402,
38816,
13,
20362,
4943,
198,
8818,
1332,
33384,
7,
448,
33384,
3712,
8134,
11,
503,
38,
1652,
86,
3712,
8134,
8,
198,
220,
220,
220,
1303,
13610,
257,
35977,
4554,
11,
... | 2.628253 | 269 |
<reponame>JuliaTagBot/Visualize.jl
# using Visualize: vert_linesegments, frag_linesegments, geom_linesegments, LineSegments, Vertices, LineAttributes
#
#
# function Drawable(w::AbstractGLWindow, primitive::LineSegments)
# vbo = VertexArray(primitive[Vertices], face_type = Face{2, OffsetInteger{1, GLint}})
# uni... | [
27,
7856,
261,
480,
29,
16980,
544,
24835,
20630,
14,
36259,
1096,
13,
20362,
198,
2,
1262,
15612,
1096,
25,
9421,
62,
6615,
1533,
902,
11,
7956,
62,
6615,
1533,
902,
11,
4903,
296,
62,
6615,
1533,
902,
11,
6910,
41030,
902,
11,
2... | 2.487179 | 234 |
<gh_stars>0
#--------------------------------------------------------------------------------------------------
# Linear mapping tests
#--------------------------------------------------------------------------------------------------
using Test
using Hensel
#-----------------------------------------------------------... | [
27,
456,
62,
30783,
29,
15,
198,
2,
10097,
3880,
438,
198,
2,
44800,
16855,
5254,
198,
2,
10097,
3880,
438,
198,
3500,
6208,
198,
3500,
6752,
741,
198,
198,
2,
10097,
3880,
438,
198,
198,
31,
9288,
6752,
741,
13,
1462,
486,
7,
1... | 2.194805 | 693 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.