content stringlengths 6 1.03M | input_ids listlengths 4 535k | ratio_char_token float64 0.68 8.61 | token_count int64 4 535k |
|---|---|---|---|
<reponame>terasakisatoshi/juliaExer<filename>linearAlgebras/ginibre_ensemble.jl
using Distributions
using LinearAlgebra
using Plots
function gen_uniform_randmat(N,type)
if type == :complex
Re = rand(Uniform(-1, 1), N, N)
Im = rand(Uniform(-1, 1), N, N)im
A = Re + Im
elseif type==:real
... | [
27,
7856,
261,
480,
29,
353,
292,
27321,
265,
13704,
14,
73,
43640,
3109,
263,
27,
34345,
29,
29127,
2348,
469,
1671,
292,
14,
1655,
571,
260,
62,
1072,
11306,
13,
20362,
198,
3500,
46567,
507,
198,
3500,
44800,
2348,
29230,
198,
35... | 2.076336 | 393 |
<reponame>JuliaBinaryWrappers/Calcium_jll.jl<filename>src/wrappers/x86_64-w64-mingw32.jl<gh_stars>0
# Autogenerated wrapper script for Calcium_jll for x86_64-w64-mingw32
export libcalcium
using FLINT_jll
using Arb_jll
using Antic_jll
using GMP_jll
using MPFR_jll
JLLWrappers.@generate_wrapper_header("Calcium")
JLLWrapp... | [
27,
7856,
261,
480,
29,
16980,
544,
33,
3219,
36918,
11799,
14,
9771,
16910,
62,
73,
297,
13,
20362,
27,
34345,
29,
10677,
14,
29988,
11799,
14,
87,
4521,
62,
2414,
12,
86,
2414,
12,
2229,
86,
2624,
13,
20362,
27,
456,
62,
30783,
... | 2.182692 | 312 |
<filename>src/TestBaselines/IntervalScale.jl
""""""
function intervalscaled(Fₕ, Fₗ=zeros(size(Fₕ)))
scale = intervalscale(Fₗ, Fₕ, rampOn) # So, extrapolate if variance is greater than high dim.
return F -> F |> scale
end
export intervalscaled
| [
27,
34345,
29,
10677,
14,
14402,
15522,
20655,
14,
9492,
2100,
29990,
13,
20362,
198,
15931,
15931,
15931,
198,
8818,
20016,
66,
3021,
7,
37,
158,
224,
243,
11,
376,
158,
224,
245,
28,
9107,
418,
7,
7857,
7,
37,
158,
224,
243,
223... | 2.561224 | 98 |
<gh_stars>10-100
module LocalSearchSolvers
using Dictionaries: include
using CompositionalNetworks: include
using Constraints: include
using Base.Threads
using CompositionalNetworks
using ConstraintDomains
using Constraints
using Dictionaries
using Distributed
using JSON
using Lazy
# Exports internal
export constrain... | [
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
21412,
10714,
18243,
36949,
690,
198,
198,
3500,
360,
2867,
3166,
25,
2291,
198,
3500,
29936,
1859,
7934,
5225,
25,
2291,
198,
3500,
1482,
2536,
6003,
25,
2291,
198,
3500,
7308,
13,
16818,
... | 3.205279 | 682 |
# simple program to test the new k-means (not ready yet)
using Base.Test
using Clustering
srand(34568)
m = 3
n = 1000
k = 10
x = rand(m, n)
# non-weighted
r = kmeans(x, k; maxiter=50)
@test isa(r, KmeansResult{Float64})
@test size(r.centers) == (m, k)
@test length(r.assignments) == n
@test all(r.assignments .>= 1)... | [
2,
2829,
1430,
284,
1332,
262,
649,
479,
12,
1326,
504,
357,
1662,
3492,
1865,
8,
198,
198,
3500,
7308,
13,
14402,
198,
3500,
1012,
436,
1586,
198,
198,
82,
25192,
7,
27712,
3104,
8,
198,
198,
76,
796,
513,
198,
77,
796,
8576,
1... | 2.175355 | 633 |
<filename>benchmark/tensorkit_timers.jl
include("benchtools.jl")
module TensorKitTimers
using TensorKit
import ..Timers
function mpo_timer(f = randn, T = Float64; Vmpo, Vmps, Vphys)
A = Tensor(f, T, Vmps ⊗ Vphys ⊗ Vmps')
M = Tensor(f, T, Vmpo ⊗ Vphys ⊗ Vphys' ⊗ Vmpo')
FL = Tensor(f,... | [
27,
34345,
29,
26968,
4102,
14,
83,
641,
967,
270,
62,
16514,
364,
13,
20362,
198,
17256,
7203,
11722,
21474,
10141,
13,
20362,
4943,
198,
21412,
309,
22854,
20827,
14967,
364,
198,
220,
220,
220,
1262,
309,
22854,
20827,
198,
220,
22... | 1.503189 | 1,411 |
amean(A) = sum(A)/length(A)
gmean(A) = prod(A)^(1/length(A))
hmean(A) = length(A)/sum(1./A)
| [
480,
272,
7,
32,
8,
796,
2160,
7,
32,
20679,
13664,
7,
32,
8,
198,
198,
70,
32604,
7,
32,
8,
796,
40426,
7,
32,
8,
61,
7,
16,
14,
13664,
7,
32,
4008,
198,
198,
71,
32604,
7,
32,
8,
796,
4129,
7,
32,
20679,
16345,
7,
16,
... | 1.773585 | 53 |
<gh_stars>0
module CGMethod1D
using Reexport
@reexport using Ferrite
include("exports.jl")
include("interpolations.jl")
include("quadrature.jl")
include("utils.jl")
end #Module | [
27,
456,
62,
30783,
29,
15,
198,
21412,
29925,
17410,
16,
35,
198,
198,
3500,
797,
39344,
198,
31,
631,
87,
634,
1262,
12880,
6525,
628,
198,
17256,
7203,
1069,
3742,
13,
20362,
4943,
198,
17256,
7203,
3849,
16104,
602,
13,
20362,
4... | 2.828125 | 64 |
# starting to add exports here
global WORKERPOOL = WorkerPool()
"""
$SIGNATURES
For use with `multiproc`, nominal use is a worker pool of all processes available above and including 2..., but will return single process [1;] if only the first processes is available.
"""
function setWorkerPool!(pool::Vector{Int}... | [
198,
2,
3599,
284,
751,
15319,
994,
628,
198,
20541,
30936,
1137,
16402,
3535,
796,
35412,
27201,
3419,
198,
198,
37811,
198,
220,
220,
220,
720,
46224,
47471,
198,
198,
1890,
779,
351,
4600,
16680,
541,
12204,
47671,
26934,
779,
318,
... | 2.502823 | 3,188 |
<filename>src/RoadefRenaultBrazil.jl
module RoadefRenaultBrazil
using Random
include("parser.jl")
include("solution.jl")
include("functions.jl")
include("constants.jl")
include("greedy.jl")
include("ils_hprc.jl")
include("vns_lprc.jl")
include("repair.jl")
include("vns_pcc.jl")
end # module
| [
27,
34345,
29,
10677,
14,
15450,
671,
69,
26764,
1721,
39190,
13,
20362,
198,
21412,
5564,
671,
69,
26764,
1721,
39190,
198,
198,
3500,
14534,
198,
198,
17256,
7203,
48610,
13,
20362,
4943,
198,
17256,
7203,
82,
2122,
13,
20362,
4943,
... | 2.633929 | 112 |
#include("MCMCplot.jl"); traceplot("MCMC_samples_residual_variance.txt","plotly",4); savefig("plot.png");
using DelimitedFiles,Plots,Plots.PlotMeasures,StatsPlots
function traceplot(file,backend="plotly",nplots=4)
#catch errors when no backends are installed
if backend == "pyplot"
pyplot(size=(300*nplots,2... | [
2,
17256,
7203,
9655,
9655,
29487,
13,
20362,
15341,
12854,
29487,
7203,
9655,
9655,
62,
82,
12629,
62,
411,
312,
723,
62,
25641,
590,
13,
14116,
2430,
29487,
306,
1600,
19,
1776,
3613,
5647,
7203,
29487,
13,
11134,
15341,
198,
3500,
... | 2.263672 | 512 |
// Declaration of multiple variables of the same type in one statement:
int main () {
int x, y;
x = 45;
y = -36;
printInt(x);
printInt(y);
return 0 ;
} | [
1003,
24720,
286,
3294,
9633,
286,
262,
976,
2099,
287,
530,
2643,
25,
198,
198,
600,
1388,
7499,
1391,
198,
220,
493,
2124,
11,
331,
26,
198,
220,
2124,
796,
4153,
26,
198,
220,
331,
796,
532,
2623,
26,
198,
220,
3601,
5317,
7,
... | 2.704918 | 61 |
<gh_stars>0
include("../common.jl")
build_libcurl(ARGS, "LibCURL")
| [
27,
456,
62,
30783,
29,
15,
198,
17256,
7203,
40720,
11321,
13,
20362,
4943,
198,
198,
11249,
62,
8019,
66,
6371,
7,
1503,
14313,
11,
366,
25835,
34,
21886,
4943,
198
] | 2.193548 | 31 |
<reponame>aaronokano/TallSkinnyQR.jl
reload("gencond.jl")
function genba( kappa, m, n, kind )
kappa = log10(kappa)
sqrt_kappa = sqrt(kappa)
V = qr(randn(m,m))[1]
D = logspace(0, -kappa, m)
B = scale(V, D)*V'
W = qr(randn(n,n))[1]
if kind == 1
A = scale(V[:,m-n+1:m], logspace(0,-sqrt_kappa,n))*W'
el... | [
27,
7856,
261,
480,
29,
64,
8045,
482,
5733,
14,
51,
439,
42455,
3281,
48,
49,
13,
20362,
198,
260,
2220,
7203,
5235,
17561,
13,
20362,
4943,
198,
198,
8818,
2429,
7012,
7,
479,
20975,
11,
285,
11,
299,
11,
1611,
1267,
198,
220,
... | 1.753086 | 405 |
<reponame>BriceonWiley/NonlinearSolve.jl
struct Falsi <: AbstractBracketingAlgorithm
end
function alg_cache(alg::Falsi, left, right, p, ::Val{true})
nothing
end
function alg_cache(alg::Falsi, left, right, p, ::Val{false})
nothing
end
function perform_step(solver, alg::Falsi, cache)
@unpack f, p, left, right, f... | [
27,
7856,
261,
480,
29,
9414,
501,
261,
54,
9618,
14,
15419,
29127,
50,
6442,
13,
20362,
198,
7249,
376,
874,
72,
1279,
25,
27741,
9414,
8317,
278,
2348,
42289,
198,
437,
198,
198,
8818,
435,
70,
62,
23870,
7,
14016,
3712,
37,
874... | 2.491525 | 472 |
using Documenter
using EzXML: AttributeNode, ElementNode, HTMLDocumentNode, TextNode, link!, prettyprint
using Kelpie
using Suppressor
using Test
# Set up doctests
DocMeta.setdocmeta!(Kelpie, :DocTestSetup, :(using Kelpie); recursive=true)
prettystring(xml) = @capture_out prettyprint(xml)
# Set up the Bootstrap 5.1.... | [
3500,
16854,
263,
198,
3500,
21034,
55,
5805,
25,
3460,
4163,
19667,
11,
11703,
19667,
11,
11532,
24941,
19667,
11,
8255,
19667,
11,
2792,
28265,
2495,
4798,
198,
3500,
15150,
21749,
198,
3500,
8105,
44292,
198,
3500,
6208,
198,
198,
2,... | 2.073571 | 4,200 |
<reponame>qz-michael/QznbTestPackage<filename>docs/make.jl
using QznbTestPackage
using Documenter
DocMeta.setdocmeta!(QznbTestPackage, :DocTestSetup, :(using QznbTestPackage); recursive=true)
makedocs(;
modules=[QznbTestPackage],
authors="qz-michael <<EMAIL>> and contributors",
repo="https://github.com/qz... | [
27,
7856,
261,
480,
29,
80,
89,
12,
76,
40302,
14,
48,
89,
46803,
14402,
27813,
27,
34345,
29,
31628,
14,
15883,
13,
20362,
198,
3500,
1195,
89,
46803,
14402,
27813,
198,
3500,
16854,
263,
198,
198,
23579,
48526,
13,
2617,
15390,
28... | 2.295031 | 322 |
module NGram
using TextAnalysis
include("ngram.jl")
export NGramModel
end # module
| [
21412,
39058,
859,
198,
198,
3500,
8255,
32750,
198,
198,
17256,
7203,
782,
859,
13,
20362,
4943,
198,
198,
39344,
39058,
859,
17633,
198,
198,
437,
1303,
8265,
198
] | 3 | 29 |
"""
Object
Overarching type for objects displayable on `Axes`.
"""
abstract type Object end
"""
Object2D
Overarching type for objects displayable on `Axes2D`.
"""
abstract type Object2D <: Object end
"""
Text2D <: Object2D
Place text somewhere relative to current axes.
"""
mutable struct Text2D <: Ob... | [
37811,
198,
220,
220,
220,
9515,
198,
198,
5886,
38270,
2099,
329,
5563,
3359,
540,
319,
4600,
31554,
274,
44646,
198,
37811,
198,
397,
8709,
2099,
9515,
886,
628,
198,
37811,
198,
220,
220,
220,
9515,
17,
35,
198,
198,
5886,
38270,
... | 2.478313 | 830 |
# ============================
# Structs to define a zone
# ============================
"""
Zone
Struct that defines a zone.
### Notes
The `zone_id` is a unique identifier denoting the geographical planning area
into which the stop falls. The numeral before the dash denotes a high-level
planning zone. The text... | [
2,
36658,
2559,
18604,
198,
2,
32112,
82,
284,
8160,
257,
6516,
198,
2,
36658,
2559,
18604,
198,
198,
37811,
198,
220,
220,
220,
13035,
198,
198,
44909,
326,
15738,
257,
6516,
13,
198,
198,
21017,
11822,
198,
198,
464,
4600,
11340,
... | 2.691124 | 2,794 |
module TreeUtil
using ..PyUtils
using ..Core
export flatten, unflatten
const _tree_util = PyNULL()
function tree_flatten(tree)
vals, f = _tree_util.tree_flatten(tree)
vals = vals isa AbstractArray ? tuple(vals...) : vals
return vals, f
end
function _flatten end
... | [
21412,
12200,
18274,
346,
198,
220,
220,
220,
1262,
11485,
20519,
18274,
4487,
198,
220,
220,
220,
1262,
11485,
14055,
628,
220,
220,
220,
10784,
27172,
268,
11,
42880,
41769,
628,
220,
220,
220,
1500,
4808,
21048,
62,
22602,
796,
9485,... | 2.040691 | 811 |
<filename>src/IterationManagers.jl
"""
Handling convergence ciretron for iterative algorithms
@author : <NAME> <<EMAIL>>
@date : 2015-04-13 11:29:12
"""
module IterationManagers
abstract IterationManager
abstract IterationState{T}
export
# types
IterationManager, IterationState, IterTolManager, DefaultManager,... | [
27,
34345,
29,
10677,
14,
29993,
341,
5124,
10321,
13,
20362,
198,
37811,
198,
12885,
1359,
40826,
269,
557,
83,
1313,
329,
11629,
876,
16113,
198,
198,
31,
9800,
1058,
1279,
20608,
29,
9959,
27630,
4146,
4211,
198,
31,
4475,
1058,
18... | 2.851351 | 222 |
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# formats: ipynb,jl,md
# text_representation:
# extension: .jl
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.5.0
# kernelspec:
# display_name: Julia 1.4.0
# language: julia
# name: julia-1.4
# ---
... | [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
11420,
198,
2,
474,
929,
88,
353,
25,
198,
2,
220,
220,
474,
929,
88,
5239,
25,
198,
2,
220,
220,
220,
220,
17519,
25,
20966,
2047,
65,
11,
20362,
11,
9132,
1... | 1.688341 | 1,338 |
module ExtremeStats
include("anomalies.jl")
include("features.jl")
export get_anomalies, get_anomalies!, Extreme, load_X, label_Extremes, ExtremeList, Features, getFeatures, combineExtremes, sortby, writeExtremes, writeFeatures, writeTimeSeries
import Images.label_components
import NetCDF.ncread
type Extreme{T}
in... | [
21412,
18111,
29668,
198,
198,
17256,
7203,
272,
18048,
444,
13,
20362,
4943,
198,
17256,
7203,
40890,
13,
20362,
4943,
198,
198,
39344,
651,
62,
272,
18048,
444,
11,
651,
62,
272,
18048,
444,
28265,
18111,
11,
3440,
62,
55,
11,
6167,... | 1.892991 | 4,280 |
"""
"""
function QPointCellField(value::Number,cell_map::AbstractArray{<:Field},quad::CellQuadrature)
q = get_coordinates(quad)
v_q = [ fill(value,size(qi)) for qi in q ]
array = ArrayOfEvaluatedFields(v_q,q)
GenericCellField(array, cell_map)
end
"""
"""
function CellField(value::Number,cell_map::AbstractArra... | [
198,
37811,
198,
37811,
198,
8818,
1195,
12727,
28780,
15878,
7,
8367,
3712,
15057,
11,
3846,
62,
8899,
3712,
23839,
19182,
90,
27,
25,
15878,
5512,
47003,
3712,
28780,
4507,
41909,
1300,
8,
198,
220,
10662,
796,
651,
62,
37652,
17540,
... | 2.466138 | 1,388 |
<gh_stars>0
"""
rstar([rng ,] classif::Supervised, chains::Chains; kwargs...)
rstar([rng ,] classif::Supervised, x::AbstractMatrix, y::AbstractVector; kwargs...)
Compute the R* convergence diagnostic of MCMC.
This implementation is an adaption of Algorithm 1 & 2, described in [Lambert & Vehtari]. Note that th... | [
27,
456,
62,
30783,
29,
15,
198,
37811,
198,
220,
220,
220,
374,
7364,
26933,
81,
782,
837,
60,
1398,
361,
3712,
12442,
16149,
11,
14659,
3712,
1925,
1299,
26,
479,
86,
22046,
23029,
198,
220,
220,
220,
374,
7364,
26933,
81,
782,
... | 2.975965 | 1,373 |
<filename>app/test/models/GaussianMixture.jl
using Test
using MianalyzerBackend
const GaussianMixture = MianalyzerBackend.GaussianMixture
@testset "GaussianMixture" begin
@testset ".fit" begin
actual = GaussianMixture.fit([100.0, 200.0, 300.0], 1)
@test isapprox(actual.means_[:, 2][1], 200; atol=eps(Float32)... | [
27,
34345,
29,
1324,
14,
9288,
14,
27530,
14,
35389,
31562,
44,
9602,
13,
20362,
198,
3500,
6208,
198,
3500,
337,
666,
3400,
9107,
7282,
437,
198,
9979,
12822,
31562,
44,
9602,
796,
337,
666,
3400,
9107,
7282,
437,
13,
35389,
31562,
... | 2.372642 | 212 |
<gh_stars>100-1000
testglobal = 42
| [
27,
456,
62,
30783,
29,
3064,
12,
12825,
198,
9288,
20541,
796,
5433,
198
] | 2.5 | 14 |
<filename>src/algorithms/adaptive_threshold.jl<gh_stars>10-100
@doc raw"""
AdaptiveThreshold <: AbstractImageBinarizationAlgorithm
AdaptiveThreshold([img]; [window_size,] percentage = 15)
binarize([T,] img, f::AdaptiveThreshold)
binarize!([out,] img, f::AdaptiveThreshold)
Binarize `img` using a thresh... | [
27,
34345,
29,
10677,
14,
282,
7727,
907,
14,
42552,
425,
62,
400,
10126,
13,
20362,
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
31,
15390,
8246,
37811,
198,
220,
220,
220,
30019,
425,
817,
10126,
1279,
25,
27741,
5159,
33,
22050,
... | 2.749569 | 1,741 |
using Documenter, GeneralizedMetropolisHastings
makedocs(
modules = [GeneralizedMetropolisHastings],
format = :html,
clean = false,
sitename = "GeneralizedMetropolisHastings.jl",
authors = "<NAME>",
pages = Any[
"Home" => "index.md",
"Manual" => Any[
"Guide" => "man/... | [
3500,
16854,
263,
11,
3611,
1143,
9171,
25986,
39,
459,
654,
198,
198,
76,
4335,
420,
82,
7,
198,
220,
220,
220,
13103,
796,
685,
12218,
1143,
9171,
25986,
39,
459,
654,
4357,
198,
220,
220,
220,
5794,
796,
1058,
6494,
11,
198,
22... | 2.007426 | 404 |
<reponame>UnofficialJuliaMirror/Merlin.jl-80f3d04f-b880-5e6d-8e06-6a7e799169ac
module CIFAR100
import ..Datasets.unpack
function getdata(dir::String)
mkpath(dir)
url = "https://www.cs.toronto.edu/~kriz/cifar-100-binary.tar.gz"
println("Downloading $url...")
path = download(url)
run(unpack(path,dir... | [
27,
7856,
261,
480,
29,
3118,
16841,
16980,
544,
27453,
1472,
14,
13102,
2815,
13,
20362,
12,
1795,
69,
18,
67,
3023,
69,
12,
65,
41655,
12,
20,
68,
21,
67,
12,
23,
68,
3312,
12,
21,
64,
22,
68,
45455,
22172,
330,
198,
21412,
... | 2.076087 | 460 |
#http://en.wikipedia.org/wiki/Stochastic_matrix
I = zeros(4,4);
[I[i,i] = 1 for i in 1:4];
f = open("m3.txt","r")
T = readdlm(f,',');
close(f);
Ep = [0 1 0 0]*inv(I - T)*[1,1,1,1];
println("Expected lifetime for the mouse is $Ep")
| [
2,
4023,
1378,
268,
13,
31266,
13,
2398,
14,
15466,
14,
1273,
5374,
3477,
62,
6759,
8609,
201,
198,
201,
198,
40,
796,
1976,
27498,
7,
19,
11,
19,
1776,
201,
198,
58,
40,
58,
72,
11,
72,
60,
796,
352,
329,
1312,
287,
352,
25,
... | 1.944882 | 127 |
<reponame>NoFishLikeIan/CoordinationGames.jl<filename>src/utils.jl
function ∑(coll)
isempty(coll) ? 0. : sum(coll)
end
function propersubsets(coll)
(S for S in subsets(coll) if 0 < length(S) < length(coll))
end
| [
27,
7856,
261,
480,
29,
2949,
39428,
7594,
37776,
14,
7222,
585,
1883,
24474,
13,
20362,
27,
34345,
29,
10677,
14,
26791,
13,
20362,
198,
8818,
18872,
239,
7,
26000,
8,
198,
220,
220,
220,
318,
28920,
7,
26000,
8,
5633,
657,
13,
1... | 2.488636 | 88 |
<reponame>afternone/LabelPropagation.jl
function rankedge{V}(graph::AbstractGraph{V})
weights = zeros(num_edges(graph))
for e in edges(graph)
e_idx = edge_index(e, graph)
u = source(e, graph)
v = target(e, graph)
u_neighbors = Set{V}(out_neighbors(u, graph))
v_neighbors =... | [
27,
7856,
261,
480,
29,
8499,
23108,
14,
33986,
24331,
363,
341,
13,
20362,
198,
8818,
10307,
469,
90,
53,
92,
7,
34960,
3712,
23839,
37065,
90,
53,
30072,
198,
220,
220,
220,
19590,
796,
1976,
27498,
7,
22510,
62,
276,
3212,
7,
3... | 2.103448 | 1,218 |
<reponame>UnofficialJuliaMirrorSnapshots/Gasp.jl-3df1733e-8da1-5e0d-9c60-b33daa64fdfa
#!/usr/bin/env julia
using Gasp
using Base.Threads
cpu_hz = 0.0
@inline ntputs(tid, s...) = ccall(:puts, Cint, (Ptr{Int8},), string("[$(grank())]<$tid> ", s...))
function threadfun(dt, ni, ci, li, ilock, rundt, dura)
tid = thr... | [
27,
7856,
261,
480,
29,
3118,
16841,
16980,
544,
27453,
1472,
43826,
20910,
14,
38,
5126,
13,
20362,
12,
18,
7568,
1558,
2091,
68,
12,
23,
6814,
16,
12,
20,
68,
15,
67,
12,
24,
66,
1899,
12,
65,
2091,
6814,
64,
2414,
69,
7568,
... | 1.946396 | 1,623 |
function zeck(n)
n <= 0 && return 0
fib = [2,1]; while fib[1] < n unshift!(fib,sum(fib[1:2])) end
dig = Int[]; for f in fib f <= n ? (push!(dig,1); n = n-f;) : push!(dig,0) end
return dig[1] == 0 ? dig[2:end] : dig
end
| [
8818,
41271,
694,
7,
77,
8,
198,
220,
220,
220,
299,
19841,
657,
11405,
1441,
657,
198,
220,
220,
220,
12900,
796,
685,
17,
11,
16,
11208,
981,
12900,
58,
16,
60,
1279,
299,
555,
30846,
0,
7,
69,
571,
11,
16345,
7,
69,
571,
58... | 2.025862 | 116 |
<filename>src/StochasticVolatility.jl
module StochasticVolatility
using ArgCheck
using Distributions
using Parameters
using DynamicHMC
using StatsBase
using Base.Test
using ContinuousTransformations
export StochasticVolatility
"""
simulate_stochastic(ρ, σ_v, ϵs, νs)
Take in the parameter values (ρ, σ) for th... | [
27,
34345,
29,
10677,
14,
1273,
5374,
3477,
16598,
18486,
13,
20362,
198,
21412,
520,
5374,
3477,
16598,
18486,
198,
198,
3500,
20559,
9787,
198,
3500,
46567,
507,
198,
3500,
40117,
198,
3500,
26977,
39,
9655,
198,
3500,
20595,
14881,
1... | 2.231391 | 1,733 |
<gh_stars>0
using Omega
using UnicodePlots
weight = β(2.0,2.0)
beta_samples = rand(weight, 10000)
UnicodePlots.histogram(beta_samples)
nflips = 4
coinflips_ = [bernoulli(weight, Bool) for i = 1:nflips]
| [
27,
456,
62,
30783,
29,
15,
198,
3500,
19839,
201,
198,
3500,
34371,
3646,
1747,
201,
198,
201,
198,
6551,
796,
27169,
7,
17,
13,
15,
11,
17,
13,
15,
8,
201,
198,
31361,
62,
82,
12629,
796,
43720,
7,
6551,
11,
33028,
8,
201,
1... | 2.171717 | 99 |
# No regularization
# ------------------------------------------------------------
"""
NoRegularization
Empty functor object for running an L-shaped algorithm without regularization.
"""
struct NoRegularization <: AbstractRegularization end
function initialize_regularization!(::AbstractLShaped, ::NoRegularizatio... | [
2,
1400,
3218,
1634,
198,
2,
20368,
1783,
10541,
198,
37811,
198,
220,
220,
220,
1400,
40164,
1634,
198,
198,
40613,
1257,
2715,
2134,
329,
2491,
281,
406,
12,
16760,
11862,
1231,
3218,
1634,
13,
198,
198,
37811,
198,
7249,
1400,
4016... | 3.347737 | 486 |
<gh_stars>0
using Dates
function save_results(sp)
timestamp = string(now())
#filename = "optimization_results/results"*timestamp
filename = "results"*timestamp
s = scenarios(sp)
n = length(s)
n_recourse = length(optimal_recourse_decision(sp,1))
recourse_results = zeros(n, n_recourse+2)
... | [
27,
456,
62,
30783,
29,
15,
198,
3500,
44712,
198,
8818,
3613,
62,
43420,
7,
2777,
8,
198,
220,
220,
220,
41033,
796,
4731,
7,
2197,
28955,
198,
220,
220,
220,
1303,
34345,
796,
366,
40085,
1634,
62,
43420,
14,
43420,
1,
9,
16514,... | 2.134907 | 593 |
<reponame>JuliaAstrodynamics/Orekit.jl<gh_stars>1-10
function CssiSpaceWeatherDataLoader(arg0::TimeScale)
return CssiSpaceWeatherDataLoader((TimeScale,), arg0)
end
function get_data_set(obj::CssiSpaceWeatherDataLoader)
return jcall(obj, "getDataSet", SortedSet, ())
end
function get_last_daily_predicted_date(o... | [
27,
7856,
261,
480,
29,
16980,
544,
33751,
14892,
4989,
873,
14,
41543,
15813,
13,
20362,
27,
456,
62,
30783,
29,
16,
12,
940,
198,
8818,
327,
824,
72,
14106,
41865,
6601,
17401,
7,
853,
15,
3712,
7575,
29990,
8,
198,
220,
220,
22... | 2.831579 | 380 |
<filename>test/test_cas.jl
module TestCas
using ProjectiveGeometricAlgebra3d.CAS
using .CAS: BasisBlade, rev, dual, geomul, wedge, anti_wedge
using Accessors
using Test
function e(inds...;gendim, coeff=1)
mask = CAS.create_mask(1:gendim, inds...)
BasisBlade(coeff, mask)
end
@testset "BasisBlade" begin
@te... | [
27,
34345,
29,
9288,
14,
9288,
62,
34004,
13,
20362,
198,
21412,
6208,
35155,
198,
3500,
4935,
425,
10082,
16996,
2348,
29230,
18,
67,
13,
34,
1921,
198,
3500,
764,
34,
1921,
25,
6455,
271,
47520,
11,
2710,
11,
10668,
11,
4903,
296,... | 1.821152 | 1,806 |
using HTTP
using PyCall
using NPZ
# pikcleを扱うためのPythonのモジュールの読み込み
pickle = pyimport("pickle")
url_base = "https://raw.githubusercontent.com/tomsercu/lstm/master/data/"
key_file = Dict(
"train" => "ptb.train.txt",
"test" => "ptb.test.txt",
"valid" => "ptb.valid.txt"
)
save_file = Dict(
"train" => "ptb.t... | [
3500,
14626,
198,
3500,
9485,
14134,
198,
3500,
28498,
57,
198,
2,
279,
1134,
2375,
31758,
33699,
109,
29557,
25224,
1792,
223,
5641,
37906,
5641,
40361,
21091,
24440,
43353,
5641,
45739,
255,
2515,
123,
164,
122,
120,
2515,
123,
198,
2... | 2.027933 | 1,253 |
using MPIReco
# multi-gradient is a special case of multi-patch
@testset "multi-gradient in-memory reconstruction" begin
# low gradient with patch no 3
b = MultiMPIFile(["./data/MG_G1", "./data/MG_G2_03"])
bSFs = MultiMPIFile(["./data/SF_MG_G1", "./data/SF_MG_G2"])
names = names = (:color, :x, :y, :z, :time)
... | [
3500,
4904,
4663,
47704,
198,
198,
2,
5021,
12,
49607,
318,
257,
2041,
1339,
286,
5021,
12,
17147,
198,
31,
9288,
2617,
366,
41684,
12,
49607,
287,
12,
31673,
25056,
1,
2221,
198,
220,
1303,
1877,
31312,
351,
8529,
645,
513,
198,
22... | 2.087523 | 1,074 |
using Documenter
using NCTSSOS
makedocs(
sitename = "NCTSSOS",
pages = ["Home" => "index.md",
"Noncommutative Polynomial Optimization" => "ncpop.md"],
modules = [NCTSSOS],
format = Documenter.HTML(
prettyurls = get(ENV, "CI", nothing) == "true")
)
deploydocs(
repo = "github.com/wangj... | [
3500,
16854,
263,
201,
198,
3500,
40119,
5432,
2640,
201,
198,
201,
198,
76,
4335,
420,
82,
7,
201,
198,
48937,
12453,
796,
366,
45,
4177,
5432,
2640,
1600,
201,
198,
31126,
796,
14631,
16060,
1,
5218,
366,
9630,
13,
9132,
1600,
201... | 2.198718 | 156 |
@enum VaoKind SIMPLE ELEMENTS ELEMENTS_INSTANCED EMPTY
# buffers which are not instanced have divisor = -1
const GEOMETRY_DIVISOR = GLint(-1)
const UNIFORM_DIVISOR = GLint(1)
struct BufferAttachmentInfo{T}
name ::Symbol
location ::GLint
buffer ::Buffer{T}
divisor ::GLint
end
Base.eltype(b::Buffe... | [
198,
31,
44709,
569,
5488,
35854,
23749,
16437,
40342,
28957,
40342,
28957,
62,
38604,
20940,
1961,
38144,
9936,
198,
198,
2,
39334,
543,
389,
407,
916,
2903,
423,
2659,
271,
273,
796,
532,
16,
198,
9979,
22319,
2662,
2767,
18276,
62,
... | 2.2091 | 3,912 |
module CipherModes
import Base
importall BlockCiphers
importall Padding
importall Iteration
importall Rand
function make_output_array(padding, extra, key, in)
out = zeros(Uint8, extra + padded_size(block_size(key), in))
out[(1 + extra):(length(in) + extra)] = in
pad!(padding, block_size(key), out, length(... | [
21412,
44334,
44,
4147,
198,
198,
11748,
7308,
198,
11748,
439,
9726,
34,
541,
7084,
198,
11748,
439,
350,
26872,
198,
11748,
439,
40806,
341,
198,
11748,
439,
8790,
198,
198,
8818,
787,
62,
22915,
62,
18747,
7,
39231,
11,
3131,
11,
... | 2.173077 | 3,172 |
using DictIO
using Base.Test
# ASCIIString,Int64 dict
d = Dict{ASCIIString,Int64}()
d["a"] = 2
d["b"] = 6
d["g"] = 1
writedict("tmp.txt", d)
d2 = readdict("tmp.txt")
@test d2["a"] == 2
@test d2["b"] == 6
@test d2["g"] == 1
@test typeof(d2["g"]) == Int64
@test typeof(first(keys(d2))) == ASCIIString
# Float64,Any dict ... | [
3500,
360,
713,
9399,
198,
3500,
7308,
13,
14402,
198,
198,
2,
37101,
10100,
11,
5317,
2414,
8633,
198,
67,
796,
360,
713,
90,
42643,
3978,
10100,
11,
5317,
2414,
92,
3419,
198,
67,
14692,
64,
8973,
796,
362,
198,
67,
14692,
65,
8... | 2.12253 | 253 |
# prompt user for input and return it or the default
function user_input(prompt::String, default::String)
print(prompt)
response = readline(stdin)
if response == ""
return default
else
return response
end
end
# internal function that prompts user to select a deidentification metho... | [
198,
198,
2,
6152,
2836,
329,
5128,
290,
1441,
340,
393,
262,
4277,
198,
8818,
2836,
62,
15414,
7,
16963,
457,
3712,
10100,
11,
4277,
3712,
10100,
8,
198,
220,
220,
220,
3601,
7,
16963,
457,
8,
198,
220,
220,
220,
2882,
796,
1100,... | 2.429047 | 3,904 |
<filename>src/constraints/or.jl
function init_constraint!(
com::CS.CoM,
constraint::OrConstraint,
fct,
set::OrSet;
)
set_impl_functions!(com, constraint.lhs)
set_impl_functions!(com, constraint.rhs)
lhs_feasible = true
if constraint.lhs.impl.init
lhs_feasible = init_constrai... | [
27,
34345,
29,
10677,
14,
1102,
2536,
6003,
14,
273,
13,
20362,
198,
8818,
2315,
62,
1102,
2536,
2913,
0,
7,
198,
220,
220,
220,
401,
3712,
7902,
13,
7222,
44,
11,
198,
220,
220,
220,
32315,
3712,
5574,
3103,
2536,
2913,
11,
198,
... | 2.207745 | 1,911 |
module ExampleTests
include("test_nooptask.jl")
end # module Examples
| [
21412,
17934,
51,
3558,
198,
17256,
7203,
9288,
62,
3919,
8738,
2093,
13,
20362,
4943,
198,
437,
1303,
8265,
21066,
198
] | 3.333333 | 21 |
module NeuralNetwork
include("network.jl")
include("SGD.jl")
export Chain, Layer, DSGD!, SGD!, GD!, test
end # module | [
21412,
47986,
26245,
198,
198,
17256,
7203,
27349,
13,
20362,
4943,
198,
17256,
7203,
38475,
35,
13,
20362,
4943,
198,
198,
39344,
21853,
11,
34398,
11,
17400,
45113,
28265,
26147,
35,
28265,
27044,
28265,
1332,
198,
198,
437,
1303,
8265
... | 3 | 40 |
# In covariance adaptation we want to use cholesky factorization instead
# of a full eigendecomposition. Can we speed this up with sparse matrices in
# Julia?
# Objective function to be maximized.
function my_fun1(x)
exp(-(x-2).^2) + 0.8 * exp(-(x+2).^2)
end
Ns = [10, 100, 1000, 2000]
num_reps = 10
Ds = [0.01, 0.10... | [
2,
554,
44829,
590,
16711,
356,
765,
284,
779,
442,
4316,
2584,
5766,
1634,
2427,
198,
2,
286,
257,
1336,
304,
328,
437,
721,
296,
9150,
13,
1680,
356,
2866,
428,
510,
351,
29877,
2603,
45977,
287,
198,
2,
22300,
30,
198,
198,
2,
... | 2.092224 | 553 |
#=
chain:
- Julia version:
- Author: Dan
- Date: 2021-06-01
=#
import ..CONCEPT.getName
export
Chain
"Represents a Chain of Residues. See also [`AbstractComposite`](@ref)"
mutable struct Chain <: AbstractChain
id_ ::Union{Char, Nothing}
number_of_children_ ... | [
2,
28,
198,
7983,
25,
198,
12,
22300,
2196,
25,
220,
198,
12,
6434,
25,
6035,
198,
12,
7536,
25,
33448,
12,
3312,
12,
486,
198,
46249,
198,
198,
11748,
11485,
10943,
42006,
13,
1136,
5376,
198,
39344,
198,
220,
220,
220,
21853,
19... | 1.590417 | 2,400 |
<gh_stars>100-1000
"""
ExactReach
ExactReach performs exact reachability analysis to compute the output reachable set for a network.
# Problem requirement
1. Network: any depth, ReLU activation
2. Input: HPolytope
3. Output: AbstractPolytope
# Return
`ReachabilityResult`
# Method
Exact reachability analysis.
#... | [
27,
456,
62,
30783,
29,
3064,
12,
12825,
198,
37811,
198,
220,
220,
220,
1475,
529,
3041,
620,
198,
198,
3109,
529,
3041,
620,
17706,
2748,
3151,
1799,
3781,
284,
24061,
262,
5072,
3151,
540,
900,
329,
257,
3127,
13,
198,
198,
2,
... | 2.911232 | 552 |
using CUDA
using PaddedViews
function k_index_kernel_fft_2d(data, out,offx, offy)
dx = (blockIdx().x-1)*blockDim().x + threadIdx().x
dy = (blockIdx().y-1)*blockDim().y + threadIdx().y
#dz = (blockIdx().z-1)*blockDim().z + threadIdx().z
#sx,sy,sz = size(data)
# if dx > sx || dy > sy || dz > sz
... | [
3500,
29369,
5631,
198,
3500,
350,
29373,
7680,
82,
628,
198,
8818,
479,
62,
9630,
62,
33885,
62,
487,
83,
62,
17,
67,
7,
7890,
11,
503,
11,
2364,
87,
11,
572,
88,
8,
198,
220,
220,
220,
44332,
796,
357,
9967,
7390,
87,
22446,
... | 1.91321 | 1,567 |
#See Philippe, *Simulation of right and left truncated gamma
# distributions by mixtures* and Dagpunar *Sampling of variates from
# a truncated gamma distribution*
# for pdf, cdf and quantile only right truncation is supported, left bound is 0.0
# for rand both left and right truncation is supported
TruncatedGamma(α::... | [
2,
6214,
39393,
11,
1635,
8890,
1741,
286,
826,
290,
1364,
40122,
515,
34236,
198,
2,
24570,
416,
285,
25506,
9,
290,
32167,
35512,
283,
1635,
16305,
11347,
286,
5553,
689,
422,
198,
2,
257,
40122,
515,
34236,
6082,
9,
198,
2,
329,
... | 2.115764 | 2,842 |
export cg1
"""
`cg1(j1, m1, j2, m2, j3, m3, T=Float64)` : A reference implementation of
Clebsch-Gordon coefficients based on
https://hal.inria.fr/hal-01851097/document
Equation (4-6)
This heavily uses BigInt and BigFloat and should therefore not be employed
for performance critical tasks.
"""
function cg1(j1, m1, ... | [
198,
39344,
269,
70,
16,
628,
198,
37811,
198,
63,
66,
70,
16,
7,
73,
16,
11,
285,
16,
11,
474,
17,
11,
285,
17,
11,
474,
18,
11,
285,
18,
11,
309,
28,
43879,
2414,
8,
63,
1058,
317,
4941,
7822,
286,
198,
34349,
1443,
354,
... | 1.733427 | 709 |
<gh_stars>0
################################################################################
# back propagation.
hasbackpropagation{F, i, o, tf}(::Type{FullyConnectedLayer{F, i, o, tf}}) = true
#TODO - make all of the i/o value parameters to force recompilation for each
#value.
function reversematrixfma{F}(input_arr... | [
27,
456,
62,
30783,
29,
15,
198,
198,
29113,
29113,
14468,
198,
2,
736,
43594,
13,
198,
10134,
1891,
22930,
363,
341,
90,
37,
11,
1312,
11,
267,
11,
48700,
92,
7,
3712,
6030,
90,
37,
2132,
13313,
276,
49925,
90,
37,
11,
1312,
11... | 2.317073 | 943 |
module DisjunctiveProgramming
using JuMP, IntervalArithmetic, Symbolics
export add_disjunction
export @disjunction
include("reformulate.jl")
include("disjunction.jl")
include("macro.jl")
end # module
| [
21412,
3167,
29741,
14070,
15167,
2229,
198,
198,
3500,
12585,
7378,
11,
4225,
2100,
3163,
29848,
11,
41327,
19615,
198,
198,
39344,
751,
62,
6381,
73,
4575,
198,
39344,
2488,
6381,
73,
4575,
198,
198,
17256,
7203,
260,
687,
5039,
13,
... | 3.090909 | 66 |
<filename>doc/doc_illustrations.jl
# Illustrations for SolarIrradiance documentation
# Copyright (c) 2021 <NAME>
using SolarIrradiance
using PyPlot
#pygui(true) # for interactive plot windows
## Load GHI data ##
# 2012, day 136: sun & clouds
year = 2012
n = 136
GHI_day = [0.0, 0.0, 0.0, 0.0, 0.0, 39.18, 209.0, 374.0... | [
27,
34345,
29,
15390,
14,
15390,
62,
359,
436,
9143,
13,
20362,
198,
2,
23279,
9143,
329,
12347,
23820,
6335,
3610,
10314,
198,
2,
15069,
357,
66,
8,
33448,
1279,
20608,
29,
198,
198,
3500,
12347,
23820,
6335,
3610,
198,
3500,
9485,
... | 2.143076 | 5,878 |
function entropy(q::AbstractVector)
η = x -> x <= 0 ? zero(x) : -x * log2(x)
return sum(η, q)
end
entropy(ρ::AbstractMatrix) = entropy(eigvals(ρ))
renyi_entropy(α::Real) = r -> renyi_entropy(r, α)
function renyi_entropy(q::AbstractVector, α)
α == 1 && return entropy(q)
α == Inf && return -log2(maximu... | [
8818,
40709,
7,
80,
3712,
23839,
38469,
8,
198,
220,
220,
220,
7377,
115,
796,
2124,
4613,
2124,
19841,
657,
5633,
6632,
7,
87,
8,
1058,
532,
87,
1635,
2604,
17,
7,
87,
8,
198,
220,
220,
220,
1441,
2160,
7,
138,
115,
11,
10662,
... | 2.020202 | 792 |
_productions = Vector{Vector{Int64}}()
_width = nothing
_height = nothing
function serializeMoveSet(moves::Vector{Move})
returnString = ""
for move in moves
returnString *= string(move.loc.x) * " " * string(move.loc.y) * " " * string(move.direction) * " "
end
returnString
end
function deserializeMapSize(i... | [
62,
11167,
507,
796,
20650,
90,
38469,
90,
5317,
2414,
11709,
3419,
198,
62,
10394,
796,
2147,
198,
62,
17015,
796,
2147,
198,
198,
8818,
11389,
1096,
21774,
7248,
7,
76,
5241,
3712,
38469,
90,
21774,
30072,
198,
220,
1441,
10100,
796... | 2.621024 | 723 |
<gh_stars>10-100
#
# Get into the MGS reorthogonalization loop and see if it
# does its job.
#
function mgs_test(cond=1.e6)
(A, x0, b)=data_cook(cond)
V=zeros(3,20)
gout=kl_gmres(x0, b, matvec, V, 1.e-9; orth="mgs1",pdata=A)
gout2=kl_gmres(x0, b, matvec, V, 1.e-9; orth="mgs2",pdata=A)
del=gout.reshist-gout2.reshist
mgs... | [
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
2,
198,
2,
3497,
656,
262,
337,
14313,
302,
1506,
519,
20996,
1634,
9052,
290,
766,
611,
340,
198,
2,
857,
663,
1693,
13,
198,
2,
198,
8818,
10527,
82,
62,
9288,
7,
17561,
28,
16,
13... | 1.812658 | 395 |
# Solve the n-queens problem to test optional constraints.
"Creates the constraints matrix for the n-queens problem."
function make_queens_matrix(n)
slash_diagonal_for(row, column) = row + column - 1
backslash_diagonal_for(row, column) = n + row - column
constraints_for(row, column) = Set(Any[
(:row, row),
... | [
2,
4294,
303,
262,
299,
12,
4188,
641,
1917,
284,
1332,
11902,
17778,
13,
198,
198,
1,
16719,
274,
262,
17778,
17593,
329,
262,
299,
12,
4188,
641,
1917,
526,
198,
8818,
787,
62,
4188,
641,
62,
6759,
8609,
7,
77,
8,
198,
220,
24... | 2.432911 | 395 |
function Base.:^(a::UncertainIndexDataset, b::UncertainIndexDataset; n = 30000)
N = length(a)
n_vals_b = length(b)
if N != n_vals_b
throw(ArgumentError("Dataset lengths do not match ($N, $n_vals_b)"))
end
UncertainIndexDataset([a[i] ^ b[i] for i = 1:N])
end
function Base.:^(a::T, b::... | [
198,
198,
8818,
7308,
11207,
61,
7,
64,
3712,
3118,
39239,
15732,
27354,
292,
316,
11,
275,
3712,
3118,
39239,
15732,
27354,
292,
316,
26,
299,
796,
513,
2388,
8,
198,
220,
220,
220,
399,
796,
4129,
7,
64,
8,
198,
220,
220,
220,
... | 2.170863 | 556 |
<gh_stars>0
module List
export SinglyLinkedList, SinglyLinkedListNode
export DoublyLinkedList, DoublyLinkedListNode
export remove!, front, back
abstract AbstractList{T}
abstract AbstractNode{T}
#! Singly linked list node implementation
type SinglyLinkedListNode{T} <: AbstractNode{T}
next::Union{SinglyLinkedListNod... | [
27,
456,
62,
30783,
29,
15,
198,
21412,
7343,
198,
198,
39344,
311,
4420,
11280,
276,
8053,
11,
311,
4420,
11280,
276,
8053,
19667,
198,
39344,
5728,
36874,
11280,
276,
8053,
11,
5728,
36874,
11280,
276,
8053,
19667,
198,
39344,
4781,
... | 2.53266 | 4,057 |
PastaQ.state(optimizer, model::LPDO) =
optimizerstate(optimizer, getparameters(model))
PastaQ.state(optimizer, model::MPS) =
PastaQ.state(optimizer, LPDO(model))
PastaQ.state(optimizer, model::MPO) =
PastaQ.state(optimizer, LPDO(model))
"""
update!(model, grads, optimizer)
Update a tensor network model... | [
34533,
64,
48,
13,
5219,
7,
40085,
7509,
11,
2746,
3712,
43,
5760,
46,
8,
796,
220,
198,
220,
6436,
7509,
5219,
7,
40085,
7509,
11,
651,
17143,
7307,
7,
19849,
4008,
198,
198,
34533,
64,
48,
13,
5219,
7,
40085,
7509,
11,
2746,
3... | 2.07286 | 549 |
<reponame>JuliaComputing/Azure.jl<filename>src/Storage/StorageManagementClient/model_BlobRestoreParameters.jl
# This file was generated by the Julia Swagger Code Generator
# Do not modify this file directly. Modify the swagger specification instead.
mutable struct BlobRestoreParameters <: SwaggerModel
timeToResto... | [
27,
7856,
261,
480,
29,
16980,
544,
5377,
48074,
14,
26903,
495,
13,
20362,
27,
34345,
29,
10677,
14,
31425,
14,
31425,
48032,
11792,
14,
19849,
62,
3629,
672,
19452,
382,
48944,
13,
20362,
198,
2,
770,
2393,
373,
7560,
416,
262,
22... | 3.017214 | 639 |
<gh_stars>10-100
# Test cmap.jl
# Tests could be more comprehensive (of course). In some cases all
# that is done is to execute the function in some way just to make
# sure no exceptions are thrown as a result of something breaking with
# a new version of Julia.
println("testing cmap")
# cmap: Test cmap by calling ... | [
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
2,
6208,
269,
8899,
13,
20362,
198,
198,
2,
30307,
714,
307,
517,
9815,
357,
1659,
1781,
737,
220,
554,
617,
2663,
477,
198,
2,
326,
318,
1760,
318,
284,
12260,
262,
2163,
287,
617,
83... | 2.433071 | 762 |
<filename>src/stokes.jl
#md # !!! note
#
# This tutorial is under construction, but the code below is already functional.
#
# Driver that computes the lid-driven cavity benchmark at low Reynolds numbers
# when using a mixed FE Q(k)/Pdisc(k-1).
# Load Gridap library
using Gridap
# Discrete model
n = 100
domain = (... | [
27,
34345,
29,
10677,
14,
301,
3369,
13,
20362,
198,
2,
9132,
1303,
220,
10185,
3465,
198,
2,
198,
2,
220,
220,
220,
220,
770,
11808,
318,
739,
5103,
11,
475,
262,
2438,
2174,
318,
1541,
10345,
13,
198,
2,
198,
2,
12434,
326,
55... | 2.372392 | 623 |
<filename>src/types.jl<gh_stars>0
abstract type AbstractVsStrategy end
"""Abstract type for sources (e.g., a game)."""
abstract type AbstractVsSource end
"""Abstract type for scenes."""
abstract type AbstractVsScene end
"""Abstract type for streams. Should support the common functions."""
abstract type AbstractVsStr... | [
27,
34345,
29,
10677,
14,
19199,
13,
20362,
27,
456,
62,
30783,
29,
15,
198,
397,
8709,
2099,
27741,
23266,
13290,
4338,
886,
198,
198,
37811,
23839,
2099,
329,
4237,
357,
68,
13,
70,
1539,
257,
983,
21387,
15931,
198,
397,
8709,
20... | 2.745841 | 1,082 |
<filename>Julia/problem_697.jl
using Formatting
function prob(n, l)
x = BigFloat(l * log(10))
a = 1
s = 1
for k in 1:n-1
a *= x/k
s += a
end
s /= exp(x)
return s
end
function main(n)
l = Int(n * 0.4)
h = Int(n * 0.5)
e = 0.01
while h - l > e
if pr... | [
27,
34345,
29,
16980,
544,
14,
45573,
62,
40035,
13,
20362,
198,
3500,
18980,
889,
198,
198,
8818,
1861,
7,
77,
11,
300,
8,
198,
220,
220,
220,
2124,
796,
4403,
43879,
7,
75,
1635,
2604,
7,
940,
4008,
198,
220,
220,
220,
257,
79... | 1.75265 | 283 |
using Test
using FlightMechanics
@testset "atmosphere" begin include("atmosphere.jl") end
@testset "coordinates" begin include("coordinates.jl") end
@testset "anemometry" begin include("anemometry.jl") end
@testset "mechanics" begin include("mechanics.jl") end
@testset "flight mechanics" begin include("flight_mechani... | [
3500,
6208,
198,
3500,
13365,
28452,
272,
873,
628,
198,
31,
9288,
2617,
366,
265,
6384,
1456,
1,
2221,
2291,
7203,
265,
6384,
1456,
13,
20362,
4943,
886,
198,
31,
9288,
2617,
366,
37652,
17540,
1,
2221,
2291,
7203,
37652,
17540,
13,
... | 3.040346 | 347 |
<filename>test/test_linear_operators_calculus.jl
@printf("\nTesting linear operators calculus rules\n")
##########################
##### test Compose #######
##########################
m1, m2, m3 = 4, 7, 3
A1 = randn(m2, m1)
A2 = randn(m3, m2)
opA1 = MatrixOp(A1)
opA2 = MatrixOp(A2)
opC = Compose(opA2,opA1)
x = randn... | [
27,
34345,
29,
9288,
14,
9288,
62,
29127,
62,
3575,
2024,
62,
9948,
17576,
13,
20362,
198,
31,
37435,
7203,
59,
77,
44154,
14174,
12879,
41443,
3173,
59,
77,
4943,
198,
198,
14468,
7804,
2235,
198,
4242,
2,
1332,
3082,
577,
46424,
2... | 1.811335 | 15,069 |
@test [combinations([])...] == []
@test [combinations(['a', 'b', 'c'])...] == [['a'],['b'],['c'],['a','b'],['a','c'],['b','c'],['a','b','c']]
@test [combinations("abc",3)...] == [['a','b','c']]
@test [combinations("abc",2)...] == [['a','b'],['a','c'],['b','c']]
@test [combinations("abc",1)...] == [['a'],['b'],['c']]
@... | [
31,
9288,
685,
24011,
7352,
26933,
12962,
22345,
6624,
17635,
198,
31,
9288,
685,
24011,
7352,
7,
17816,
64,
3256,
705,
65,
3256,
705,
66,
6,
12962,
22345,
6624,
16410,
6,
64,
6,
4357,
17816,
65,
6,
4357,
17816,
66,
6,
4357,
17816,
... | 2.241993 | 1,405 |
<filename>src/basics/content.jl
@api list => List <: Tile begin
curry(tiles::AbstractArray)
kwarg(ordered::Bool=false)
end
render(l::List) =
Elem(l.ordered ? :ol : :ul,
map(x -> Elem(:li, render(x)), l.tiles))
@api img => Image <: Tile begin
arg(url::String)
kwarg(alt::String=nothing)
end... | [
27,
34345,
29,
10677,
14,
12093,
873,
14,
11299,
13,
20362,
198,
31,
15042,
1351,
5218,
7343,
1279,
25,
47870,
2221,
198,
220,
220,
220,
34611,
7,
83,
2915,
3712,
23839,
19182,
8,
198,
220,
220,
220,
479,
86,
853,
7,
24071,
3712,
... | 2.219409 | 237 |
# Input data
data = readlines("Day04.input");
steps = map(v -> parse(Int64, v), split(data[1], ","));
boards = map(
rows -> hcat(
map(
row -> map(v -> parse(Int64, v), filter(!isempty, split(row, " "))),
rows[2:end],
)...,
),
Iterators.partition(data[2:end], 6),
);
#... | [
2,
23412,
1366,
198,
7890,
796,
1100,
6615,
7203,
12393,
3023,
13,
15414,
15341,
198,
20214,
796,
3975,
7,
85,
4613,
21136,
7,
5317,
2414,
11,
410,
828,
6626,
7,
7890,
58,
16,
4357,
366,
553,
18125,
198,
12821,
796,
3975,
7,
198,
... | 2.021242 | 612 |
<gh_stars>0
# test simple solving
for i in 1:10
A = rand(20, 20)
sA = sparse(A)
b = rand(20)
@test fnnls(sA, b) ≈ fnnls(A, b)
@test nnls(sA, b) ≈ nnls(A, b)
@test pivot(sA, b) ≈ pivot(A, b)
@test nonneg_lsq(sA,b;alg=:pivot, variant=:cache) ≈ nonneg_lsq(A,b;alg=:pivot, variant=:cache)
end
| [
27,
456,
62,
30783,
29,
15,
198,
2,
1332,
2829,
18120,
198,
1640,
1312,
287,
352,
25,
940,
198,
220,
220,
220,
317,
796,
43720,
7,
1238,
11,
1160,
8,
198,
220,
220,
220,
264,
32,
796,
29877,
7,
32,
8,
198,
220,
220,
220,
275,
... | 1.806818 | 176 |
<filename>src/hydrogenic.jl
import AtomicLevels: spectroscopic_label
# * Plain hydrogenics
"""
hydrogenic!(atom[; find_lowest=false, find_lowest_ℓmax=Inf, kwargs...])
Initialize the radial orbitals of `atom` to their unscreened
hydrogenic values. This is done via simple diagonalization of the
one-body Hamiltonia... | [
27,
34345,
29,
10677,
14,
15511,
8648,
291,
13,
20362,
198,
11748,
28976,
4971,
82,
25,
5444,
45943,
16603,
62,
18242,
198,
198,
2,
1635,
28847,
17669,
873,
198,
198,
37811,
198,
220,
220,
220,
17669,
291,
0,
7,
37696,
58,
26,
1064,... | 1.896019 | 5,174 |
# SimLynx/src/SimLynx.jl
# Licensed under the MIT License. See LICENSE.md file in the project root for
# full license information.
__precompile__()
"A Hybrid Simulation Engine and Language in Julia"
module SimLynx
import Base: wait
using Plots; gr()
using Printf
using MacroTools
# Application Program Interface (AP... | [
2,
3184,
37207,
87,
14,
10677,
14,
8890,
37207,
87,
13,
20362,
198,
2,
49962,
739,
262,
17168,
13789,
13,
4091,
38559,
24290,
13,
9132,
2393,
287,
262,
1628,
6808,
329,
198,
2,
1336,
5964,
1321,
13,
198,
198,
834,
3866,
5589,
576,
... | 2.555465 | 1,226 |
<filename>src/bids.jl
"""
acquisition_duration(x) -> F64Sec
Duration (in seconds) of volume acquisition. This field is REQUIRED for
sequences that are described with the volume_timingfield and that do not have the
slice_timing field set to allowed for accurate calculation of "acquisition time".
This field is mutua... | [
27,
34345,
29,
10677,
14,
65,
2340,
13,
20362,
198,
37811,
198,
220,
220,
220,
12673,
62,
32257,
7,
87,
8,
4613,
376,
2414,
6558,
198,
198,
26054,
357,
259,
4201,
8,
286,
6115,
12673,
13,
770,
2214,
318,
4526,
10917,
37819,
329,
1... | 3.002127 | 12,225 |
<reponame>kalmarek/StarAlgebras.jl
@testset "Algebra and Elements" begin
A = [:a, :b, :c]
b = StarAlgebras.Basis{UInt8}(words(A, radius = 2))
l = length(b)
RG = StarAlgebra(one(first(b)), b, (4, 4))
a = rand(l)
@test AlgebraElement(a, RG) isa AlgebraElement
@test all(RG(g) isa AlgebraElem... | [
27,
7856,
261,
480,
29,
74,
282,
11449,
74,
14,
8248,
2348,
469,
1671,
292,
13,
20362,
198,
31,
9288,
2617,
366,
2348,
29230,
290,
26632,
1,
2221,
198,
220,
220,
220,
317,
796,
685,
25,
64,
11,
1058,
65,
11,
1058,
66,
60,
198,
... | 1.98532 | 1,158 |
# -----------------------------------------------------------------------------
# Scaled-diagonally-dominant matrices [JuMP]
# -----------------------------------------------------------------------------
# <NAME>., & <NAME>. (2017). Dsos and sdsos optimization: More
# tractable alternatives to sum of squares and semi... | [
2,
16529,
32501,
198,
2,
1446,
3021,
12,
10989,
1840,
453,
12,
3438,
42483,
2603,
45977,
685,
33018,
7378,
60,
198,
2,
16529,
32501,
198,
198,
2,
1279,
20608,
29,
1539,
1222,
1279,
20608,
28401,
357,
5539,
737,
360,
82,
418,
290,
26... | 2.381395 | 860 |
<filename>test/erkstep_nonlin.jl
#=
Test adapted from https://github.com/LLNL/sundials/blob/master/examples/arkode/C_serial/ark_analytic_nonlin.c
/*-----------------------------------------------------------------
* Programmer(s): <NAME> @ SMU
*---------------------------------------------------------------
* SUNDIA... | [
27,
34345,
29,
9288,
14,
9587,
9662,
62,
13159,
2815,
13,
20362,
198,
2,
28,
198,
14402,
16573,
422,
3740,
1378,
12567,
13,
785,
14,
3069,
32572,
14,
82,
917,
8231,
14,
2436,
672,
14,
9866,
14,
1069,
12629,
14,
668,
1098,
14,
34,
... | 2.742087 | 853 |
#= Finding the Greatest Common Divisor of 2 numbers using the Euclidean
Formula to lessen the time complexity.
=#
## Function
function GCD(a, b)
if (a == 0)
return b
end
if (b == 0)
return a
end
if (a < b)
a, b = b, a
end
ans = a % b
while (ans != 0)
a =... | [
2,
28,
27063,
262,
33575,
8070,
4777,
271,
273,
286,
362,
3146,
1262,
262,
48862,
485,
272,
198,
8479,
4712,
284,
40856,
262,
640,
13357,
13,
198,
46249,
198,
198,
2235,
15553,
198,
198,
8818,
402,
8610,
7,
64,
11,
275,
8,
198,
22... | 2.075085 | 293 |
using Test, YAAD, YAAD.TestUtils
using DiffRules, SpecialFunctions, NaNMath
@testset "broadcast math.jl" begin
# exclude function whose domain is not in [0, 1)
exclusion = Symbol[
:asec,
:acosh,
:acsc,
:acoth,
:asecd,
:acscd,
]
for (mod, name, nargs) in keys(DiffRules.DEFINED_DIFFRULES)
f... | [
3500,
6208,
11,
575,
32,
2885,
11,
575,
32,
2885,
13,
14402,
18274,
4487,
198,
3500,
10631,
37766,
11,
6093,
24629,
2733,
11,
11013,
32755,
776,
198,
198,
31,
9288,
2617,
366,
36654,
2701,
10688,
13,
20362,
1,
2221,
198,
198,
2,
196... | 2.360169 | 472 |
using LinearAlgebraicRepresentation
using Plasm
using SparseArrays
Lar = LinearAlgebraicRepresentation
Lara = Lar.Arrangement
# Data Reading
V = [
0.0 0.5 3.0 5.0 2.0 2.0 0.0 1.0 0.0 3.0;
1.0 1.0 1.0 1.0 2.0 0.0 3.0 1.5 0.0 1.5
];
EV = [[1, 4], [2, 3], [5, 6], [2, 5], [3, 6], [7, 10], [8, 10], [9, 10]];
## 1 - In... | [
3500,
44800,
2348,
29230,
291,
40171,
341,
198,
3500,
1345,
8597,
198,
3500,
1338,
17208,
3163,
20477,
198,
43,
283,
796,
44800,
2348,
29230,
291,
40171,
341,
198,
43,
3301,
796,
25577,
13,
3163,
36985,
972,
198,
198,
2,
6060,
11725,
... | 2.196102 | 821 |
@testset "Test Propagation of the Lorenz equation I" begin
u0 = [10.0; -5.0; 2.0]
t0 = 0.0
tf = 5.0
Δt = 1e-2
J = ceil(Int64, (tf-t0)/Δt)
h(u, t) = [sum(u)]
F = StateSpace(lorenz63!, h)
prob = ODEProblem(F.f,u0,(t0,tf))
sol = solve(prob, RK4(), dt = Δt, adaptive = false);
# ... | [
198,
31,
9288,
2617,
366,
14402,
8772,
363,
341,
286,
262,
15639,
27305,
16022,
314,
1,
2221,
198,
220,
220,
220,
334,
15,
796,
685,
940,
13,
15,
26,
532,
20,
13,
15,
26,
362,
13,
15,
60,
198,
220,
220,
220,
256,
15,
796,
657,... | 1.824584 | 781 |
#=
Code for simulating, visualizing and manipulating additive and
multiplicative functionals.
@authors: <NAME>
=#
using QuantEcon
using PyPlot
using Distributions
"""
This type transforms an additive (multipilcative)
functional into a QuantEcon linear state space system.
"""
struct AMF_LSS_VAR{TF<:Abstr... | [
2,
28,
201,
198,
10669,
329,
985,
8306,
11,
5874,
2890,
290,
29349,
38298,
290,
201,
198,
47945,
43058,
2163,
874,
13,
201,
198,
201,
198,
31,
41617,
25,
1279,
20608,
29,
201,
198,
46249,
201,
198,
3500,
16972,
36,
1102,
201,
198,
... | 1.778914 | 9,286 |
using Resonance
omni, tps = startup(; dfs = [:omni, :tps])
using CairoMakie
using AlgebraOfGraphics
hist(collect(skipmissing(tps.ageMonths)))
##
labels = [
"White",
"Black",
"Asian",
"Mixed",
"Other",
"Unknown"
]
counts = [
"White" => 1142,
"Black" => 290,
"Asian" => ... | [
3500,
44783,
590,
198,
296,
8461,
11,
256,
862,
796,
13693,
7,
26,
288,
9501,
796,
685,
25,
296,
8461,
11,
1058,
83,
862,
12962,
198,
198,
3500,
23732,
44,
461,
494,
198,
3500,
978,
29230,
5189,
18172,
198,
198,
10034,
7,
33327,
7... | 2.174389 | 1,187 |
<filename>calls/PaperCalls/DeepSimulator-Test.jl
using Plots
using Statistics
using DelimitedFiles
const data_dir = "/Users/jordiabante/OneDrive - Johns Hopkins/CpelNano/Data/DeepSimulator/"
###############################################################################################
function read_in_seq(seq, σs)
... | [
27,
34345,
29,
66,
5691,
14,
42950,
34,
5691,
14,
29744,
8890,
8927,
12,
14402,
13,
20362,
198,
3500,
1345,
1747,
198,
3500,
14370,
198,
3500,
4216,
320,
863,
25876,
198,
198,
9979,
1366,
62,
15908,
796,
12813,
14490,
14,
73,
585,
7... | 2.123757 | 2,012 |
<filename>src/common.jl
## Generic ##
Tracker.dual(x::Bool, p) = x
Base.prevfloat(r::TrackedReal) = track(prevfloat, r)
@grad function prevfloat(r::Real)
prevfloat(data(r)), Δ -> Δ
end
Base.nextfloat(r::TrackedReal) = track(nextfloat, r)
@grad function nextfloat(r::Real)
nextfloat(data(r)), Δ -> Δ
end
for f =... | [
27,
34345,
29,
10677,
14,
11321,
13,
20362,
198,
2235,
42044,
22492,
198,
198,
35694,
13,
646,
282,
7,
87,
3712,
33,
970,
11,
279,
8,
796,
2124,
198,
14881,
13,
47050,
22468,
7,
81,
3712,
2898,
6021,
15633,
8,
796,
2610,
7,
47050,... | 2.242232 | 3,315 |
@doc doc"""
Grassmann{n,k,F} <: Manifold
The Grassmann manifold $\operatorname{Gr}(n,k)$ consists of all subspaces spanned
by $k$ linear independent vectors $\mathbb F^n$, where
$\mathbb F \in \{\mathbb R, \mathbb C\}$ is either the real- (or complex-) valued vectors.
This yields all $k$-dimensional subspaces of $... | [
31,
15390,
2205,
37811,
198,
220,
220,
220,
19062,
9038,
90,
77,
11,
74,
11,
37,
92,
1279,
25,
1869,
361,
727,
198,
198,
464,
19062,
9038,
48048,
39280,
3575,
265,
1211,
480,
90,
8642,
92,
7,
77,
11,
74,
8,
3,
10874,
286,
477,
... | 2.325902 | 5,293 |
using Test
using QuantumOptics, CollectiveSpins
@testset "system" begin
# Make sure that the interface works as expected
spin1 = CollectiveSpins.Spin([0,0,0], delta=2)
spin2 = CollectiveSpins.Spin([1.2,0,0], delta=-1.)
S = SpinCollection([spin1, spin2], [0, 0, 1]; gammas=0.1)
S = SpinCollection(CollectiveSpins.geom... | [
3500,
6208,
198,
3500,
29082,
27871,
873,
11,
29128,
4561,
1040,
198,
198,
31,
9288,
2617,
366,
10057,
1,
2221,
198,
198,
2,
6889,
1654,
326,
262,
7071,
2499,
355,
2938,
198,
39706,
16,
796,
29128,
4561,
1040,
13,
4561,
259,
26933,
... | 2.418502 | 227 |
using MRC
using Documenter
makedocs(;
modules=[MRC],
authors="<NAME> <<EMAIL>> and contributors",
sitename="MRC.jl",
format=Documenter.HTML(;
prettyurls=get(ENV, "CI", "false") == "true",
canonical="https://sethaxen.github.io/MRC.jl",
assets=String[],
),
pages=["Home" =>... | [
3500,
337,
7397,
198,
3500,
16854,
263,
198,
198,
76,
4335,
420,
82,
7,
26,
198,
220,
220,
220,
13103,
41888,
44,
7397,
4357,
198,
220,
220,
220,
7035,
2625,
27,
20608,
29,
9959,
27630,
4146,
4211,
290,
20420,
1600,
198,
220,
220,
... | 2.183784 | 185 |
export LangevinNVT
abstract type Thermostat end
struct NoThermostat<:Thermostat end
struct LangevinNVT<:Thermostat
invdt::Float64
gamma::Float64
function LangevinNVT(;dt::Float64=0.0,gamma::Float64=0.0)
invdt=1.0/dt
new(invdt::Float64,
gamma::Float64)
end
end
function ini... | [
39344,
47579,
7114,
27159,
51,
198,
198,
397,
8709,
2099,
12634,
1712,
265,
886,
198,
198,
7249,
1400,
35048,
1712,
265,
27,
25,
35048,
1712,
265,
886,
198,
198,
7249,
47579,
7114,
27159,
51,
27,
25,
35048,
1712,
265,
198,
220,
220,
... | 2.096045 | 354 |
module GraphDatasets
import Base: getindex, length, eltype, iterate, show, firstindex, lastindex
import Graphs: loadgraphs, SimpleGraph
import SimpleValueGraphs:
nv, has_edge, is_directed,
get_vertexval, get_edgeval, get_graphval,
outedgevals, outneighbors,
ValGraph
export
list_datasets,
lo... | [
21412,
29681,
27354,
292,
1039,
198,
198,
11748,
7308,
25,
651,
9630,
11,
4129,
11,
1288,
4906,
11,
11629,
378,
11,
905,
11,
717,
9630,
11,
938,
9630,
198,
198,
11748,
29681,
82,
25,
3440,
34960,
82,
11,
17427,
37065,
198,
198,
1174... | 2.405099 | 353 |
module TrajOpt
using FixedSizeArrays
using Polynomials
export HermiteBasis, QuadratureRule, BCTypes
export compute_interpolation_matrices
export assemble_stiffness_matrix
export apply_bc!
immutable Block{T,N} <: MutableFixedMatrix{T,N,N}
end
"""
hb = HermiteBasis(degree=... | [
21412,
4759,
73,
27871,
628,
220,
220,
220,
1262,
10832,
10699,
3163,
20477,
198,
220,
220,
220,
1262,
12280,
26601,
8231,
628,
220,
220,
220,
10784,
18113,
578,
15522,
271,
11,
20648,
81,
1300,
31929,
11,
347,
4177,
9497,
198,
220,
2... | 2.23787 | 5,297 |
<filename>src/utils.jl
using StatsBase
"""
Compute `log(exp(a)+exp(b))`.
"""
function addExp(a::Float64, b::Float64)
if a > b
return a + log(1 + exp(b - a))
end
return b + log(1 + exp(a - b))
end
"""
quantileMeans(x::AbstractVector, n::Integer)
Compute the n-quantile means of a vector `x`, i.e. compute the... | [
27,
34345,
29,
10677,
14,
26791,
13,
20362,
198,
3500,
20595,
14881,
198,
198,
37811,
198,
7293,
1133,
4600,
6404,
7,
11201,
7,
64,
47762,
11201,
7,
65,
4008,
44646,
198,
37811,
198,
8818,
751,
16870,
7,
64,
3712,
43879,
2414,
11,
2... | 2.240385 | 520 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.