content stringlengths 6 1.03M | input_ids listlengths 4 535k | ratio_char_token float64 0.68 8.61 | token_count int64 4 535k |
|---|---|---|---|
using SparseArrays
using LinearAlgebra
using SparsityDetection
struct ParaboloidStruct{T, Tm <: AbstractArray{T,2},
Tv <: AbstractArray{T}} <: Any where T<:Number
mat::Tm
vec::Tv
xt::Tv
alpha::T
end
function quad(x::Vector, param)
mat = param.mat
xt = x-param.vec
... | [
3500,
1338,
17208,
3163,
20477,
198,
3500,
44800,
2348,
29230,
198,
3500,
1338,
45826,
11242,
3213,
198,
198,
7249,
2547,
28426,
1868,
44909,
90,
51,
11,
309,
76,
1279,
25,
27741,
19182,
90,
51,
11,
17,
5512,
198,
220,
220,
220,
220,
... | 1.969613 | 362 |
<filename>src/RolloutPolicies.jl
# implements a rollout policy
module RolloutPolicies
using DiscreteMDPs
export RolloutPolicy
export action
import DiscreteMDPs.Policy
import DiscreteMDPs.action
type RolloutPolicy <: Policy
d::Int64 # search depth
n::Int64 # number of iterations
... | [
27,
34345,
29,
10677,
14,
26869,
448,
47,
4160,
444,
13,
20362,
198,
2,
23986,
257,
38180,
2450,
198,
21412,
8299,
448,
47,
4160,
444,
198,
198,
3500,
8444,
8374,
44,
6322,
82,
198,
198,
39344,
8299,
448,
36727,
198,
39344,
2223,
19... | 2.225214 | 817 |
module Util
using AccurateArithmetic: dot_oro
using LinearAlgebra: norm, ⋅, ×, normalize
using StaticArrays: SVector
export
sec2rad, rad2sec, normalize_angle, angle,
dms2rad, rad2dms, sec2deg, deg2sec,
plane_section, point_on_limb
"""
sec2rad(sec)
Convert an angle in arcseconds to radians.
# Exampl... | [
21412,
7273,
346,
198,
198,
3500,
6366,
15537,
3163,
29848,
25,
16605,
62,
16522,
198,
3500,
44800,
2348,
29230,
25,
2593,
11,
2343,
233,
227,
11,
13958,
11,
3487,
1096,
198,
3500,
36125,
3163,
20477,
25,
20546,
9250,
198,
198,
39344,
... | 1.916041 | 2,799 |
<reponame>JackDunnNZ/uci-data
using DataDeps
register(DataDep(
"wall-following-robot-navigation-2",
"http://archive.ics.uci.edu/ml/datasets/Wall-Following+Robot+Navigation+Data",
"http://archive.ics.uci.edu/ml/machine-learning-databases/00194/sensor_readings_2.data",
"901f0027c108917e47ee4e67beda95d6e81b598646... | [
27,
7856,
261,
480,
29,
14295,
35,
20935,
37371,
14,
42008,
12,
7890,
198,
3500,
6060,
12156,
82,
198,
198,
30238,
7,
6601,
12156,
7,
198,
220,
366,
11930,
12,
27780,
278,
12,
305,
13645,
12,
28341,
7065,
12,
17,
1600,
198,
220,
3... | 2.220183 | 218 |
<reponame>andreasdominik/NNHelferlein.jl
# Attention mechanisms:
#
"""
abstract type AttentionMechanism
Attention mechanisms follow the same interface and common signatures.
If possible, the algorithm allows precomputing of the projections
of the context vector
generated by the encoder in a encoder-decoder-archit... | [
27,
7856,
261,
480,
29,
49078,
292,
3438,
259,
1134,
14,
6144,
12621,
2232,
33663,
13,
20362,
198,
2,
47406,
11701,
25,
198,
2,
198,
37811,
198,
220,
220,
220,
12531,
2099,
47406,
28452,
48162,
198,
198,
8086,
1463,
11701,
1061,
262,
... | 2.322392 | 4,783 |
##############################################################################
#
# Rayleigh distribution from Distributions Handbook
#
##############################################################################
immutable Rayleigh <: ContinuousUnivariateDistribution
scale::Float64
function Rayleigh(s::Real)
... | [
29113,
29113,
7804,
4242,
2235,
198,
2,
198,
2,
7760,
42342,
6082,
422,
46567,
507,
30579,
198,
2,
198,
29113,
29113,
7804,
4242,
2235,
198,
198,
8608,
18187,
7760,
42342,
1279,
25,
45012,
3118,
42524,
20344,
3890,
198,
220,
220,
220,
... | 2.355056 | 445 |
module ElectrodermalActivity
using CImGui
using CImGui.CSyntax
using CImGui.CSyntax.CStatic
using CImGui.GLFWBackend
using CImGui.OpenGLBackend
using CImGui.GLFWBackend.GLFW
using CImGui.OpenGLBackend.ModernGL
using Printf
using DataFrames
using CSV
include("filedialog.jl")
include("gui.jl")
export launch
end # mod... | [
21412,
38781,
1082,
7617,
16516,
198,
198,
3500,
327,
3546,
8205,
72,
198,
3500,
327,
3546,
8205,
72,
13,
7902,
33567,
897,
198,
3500,
327,
3546,
8205,
72,
13,
7902,
33567,
897,
13,
34,
45442,
198,
3500,
327,
3546,
8205,
72,
13,
876... | 2.612903 | 124 |
<reponame>jondeuce/FromFile.jl<filename>test/subchain/subchain4.jl
module D
export d
d = 4
end | [
27,
7856,
261,
480,
29,
73,
14378,
7234,
14,
4863,
8979,
13,
20362,
27,
34345,
29,
9288,
14,
7266,
7983,
14,
7266,
7983,
19,
13,
20362,
198,
21412,
360,
198,
39344,
288,
198,
67,
796,
604,
198,
437
] | 2.473684 | 38 |
<gh_stars>10-100
using NeuronBuilder, ModelingToolkit, OrdinaryDiffEq, Plots
# Using parameters from Prinz (2004) Similar network activity from disparate circuit parameters
# These are specifically Figure 3e (and Table 2 for current values)
# Membrane ion channels
AB1_channels = [NaV(100.), CaT(2.5), CaS(6.), Ka(50.)... | [
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
3500,
3169,
44372,
32875,
11,
9104,
278,
25391,
15813,
11,
14230,
3219,
28813,
36,
80,
11,
1345,
1747,
198,
198,
2,
8554,
10007,
422,
7489,
89,
357,
15724,
8,
11014,
3127,
3842,
422,
37433... | 2.121027 | 818 |
<reponame>vchuravy/AMDGPUnative.jl<filename>test/device/globals.jl<gh_stars>10-100
@testset "Globals" begin
function kernel(X)
ptr = AMDGPUnative.get_global_pointer(Val(:myglobal), Float32)
Base.unsafe_store!(ptr, 3f0)
nothing
end
hk = AMDGPUnative.rocfunction(kernel, Tuple{Int32})
gbl = HSARuntime.get_gl... | [
27,
7856,
261,
480,
29,
85,
354,
333,
2830,
14,
28075,
16960,
3118,
876,
13,
20362,
27,
34345,
29,
9288,
14,
25202,
14,
4743,
672,
874,
13,
20362,
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
31,
9288,
2617,
366,
9861,
672,
874,
... | 2.214815 | 270 |
push!(LOAD_PATH, "./")
using ExpSim
simulate(ARGS[1], 800, 480)
| [
14689,
0,
7,
35613,
62,
34219,
11,
366,
19571,
4943,
198,
198,
3500,
5518,
8890,
198,
198,
14323,
5039,
7,
1503,
14313,
58,
16,
4357,
10460,
11,
23487,
8,
220,
628
] | 2.193548 | 31 |
module BenchGCM
using SyncBarriers
using BenchmarkTools
function sim_seq!(xs, f::F, ϵ) where {F}
y = similar(xs, size(xs, 1))
for t in firstindex(xs, 2):lastindex(xs, 2)-1
@views begin
@. y = f(xs[:, t])
m = sum(y) / size(xs, 1)
@. xs[:, t+1] = (1 - ϵ) * y + ϵ * m
... | [
21412,
25187,
15916,
44,
198,
198,
3500,
35908,
10374,
8910,
198,
3500,
25187,
4102,
33637,
198,
198,
8818,
985,
62,
41068,
0,
7,
34223,
11,
277,
3712,
37,
11,
18074,
113,
8,
810,
1391,
37,
92,
198,
220,
220,
220,
331,
796,
2092,
... | 1.839636 | 2,195 |
#=
Set
=#
using SimpleDataStructures
ss = SimpleSet{Int}()
push!(ss, 1)
1 in ss
2 in ss
push!(ss, 2)
2 in ss
delete!(ss, 1)
delete!(ss, 2)
SimpleSet([1,2,3,1,2,3])
| [
2,
28,
198,
7248,
198,
46249,
198,
198,
3500,
17427,
6601,
44909,
942,
198,
198,
824,
796,
17427,
7248,
90,
5317,
92,
3419,
198,
14689,
0,
7,
824,
11,
352,
8,
198,
16,
287,
37786,
198,
17,
287,
37786,
198,
14689,
0,
7,
824,
11,
... | 1.953488 | 86 |
<gh_stars>1-10
module WaveformCommunications
using QuadGK, Statistics
export cosinepulse, halfsinepulse, rcpulse, srrcpulse, gaussianpulse,
Constellation, pam, qam, psk,
Pulse, pulseshaper, eyediag
include("pulses.jl")
include("constellations.jl")
include("utils.jl")
"""
pulseshaper(c, pulse, nsym... | [
27,
456,
62,
30783,
29,
16,
12,
940,
198,
21412,
17084,
687,
30813,
3736,
198,
198,
3500,
20648,
38,
42,
11,
14370,
198,
198,
39344,
8615,
500,
79,
9615,
11,
2063,
82,
500,
79,
9615,
11,
374,
13155,
9615,
11,
19677,
6015,
79,
9615... | 2.47929 | 338 |
# explore warping functions.
using FFTW
import PyPlot
import BSON
import Optim
import Random
using LinearAlgebra
import Interpolations
PyPlot.close("all")
fig_num = 1
PyPlot.matplotlib["rcParams"][:update](["font.size" => 22, "font.family" => "serif"])
Random.seed!(25)
a = [0.5; 5.0; 1/5] # higher makes sharper... | [
2,
7301,
1175,
13886,
5499,
13,
628,
198,
198,
3500,
376,
9792,
54,
198,
11748,
9485,
43328,
198,
11748,
347,
11782,
198,
11748,
30011,
198,
11748,
14534,
198,
3500,
44800,
2348,
29230,
198,
198,
11748,
4225,
16104,
602,
198,
198,
20519... | 2.084449 | 971 |
<reponame>danielzhaotongliu/MALTrendsWeb
{"score": 8.19, "score_count": 439527, "timestamp": 1573247514.0}
{"score": 8.2, "score_count": 423140, "timestamp": 1569225584.0}
{"score": 8.21, "score_count": 415319, "timestamp": 1565672334.0}
{"score": 8.21, "score_count": 413313, "timestamp": 1565469102.0}
{"score": 8.21, ... | [
27,
7856,
261,
480,
29,
67,
6321,
89,
3099,
313,
506,
4528,
84,
14,
44,
31429,
10920,
82,
13908,
198,
4895,
26675,
1298,
807,
13,
1129,
11,
366,
26675,
62,
9127,
1298,
604,
31010,
1983,
11,
366,
16514,
27823,
1298,
1315,
4790,
1731,... | 2.363039 | 16,439 |
<gh_stars>1-10
module DatesInGerman
using Dates
const MONTHS = ("januar", "februar", "märz", "april", "mai", "juni", "juli", "august", "september", "oktober", "november", "dezember")
function parsefrom(date::String; inwords::Bool=true)::Date
inwords ? date |> fromwords : date |> fromnumbers
end
function fromwor... | [
27,
456,
62,
30783,
29,
16,
12,
940,
198,
21412,
44712,
818,
16010,
198,
198,
3500,
44712,
198,
198,
9979,
25000,
4221,
50,
796,
5855,
13881,
84,
283,
1600,
366,
69,
1765,
622,
283,
1600,
366,
76,
11033,
81,
89,
1600,
366,
499,
22... | 2.224189 | 339 |
@testset "516.longest-palindromic-subsequence.jl" begin
@test longest_palindrome_subseq("bbbab") == 4
@test longest_palindrome_subseq("cbbd") == 2
@test longest_palindrome_subseq("<KEY>") == 60
end | [
31,
9288,
2617,
366,
47493,
13,
6511,
395,
12,
18596,
521,
398,
291,
12,
7266,
43167,
13,
20362,
1,
2221,
198,
220,
220,
220,
2488,
9288,
14069,
62,
18596,
521,
5998,
62,
7266,
41068,
7203,
11848,
65,
397,
4943,
6624,
604,
198,
220,... | 2.44186 | 86 |
# ---
# title: 819. Most Common Word
# id: problem819
# author: <NAME>
# date: 2020-10-31
# difficulty: Easy
# categories: String
# link: <https://leetcode.com/problems/most-common-word/description/>
# hidden: true
# ---
#
# Given a paragraph and a list of banned words, return the most frequent word
# that is not in t... | [
2,
11420,
198,
2,
3670,
25,
807,
1129,
13,
4042,
8070,
9678,
198,
2,
4686,
25,
1917,
23,
1129,
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,
10903,
19... | 2.986733 | 603 |
using ProximalAlgorithms
const ForwardBackwardSolver = Union{
ProximalAlgorithms.ForwardBackward,
ProximalAlgorithms.ZeroFPR,
ProximalAlgorithms.PANOC,
}
const default_solver = ProximalAlgorithms.PANOC
| [
3500,
1041,
87,
4402,
2348,
7727,
907,
198,
198,
9979,
19530,
7282,
904,
50,
14375,
796,
4479,
90,
198,
220,
220,
220,
1041,
87,
4402,
2348,
7727,
907,
13,
39746,
7282,
904,
11,
198,
220,
220,
220,
1041,
87,
4402,
2348,
7727,
907,
... | 2.571429 | 84 |
import Base.setprecision
################################################################################
#
# Show function
#
################################################################################
function AbstractAlgebra.expressify(a::LocalFieldElem; context = nothing)
return AbstractAlgebra.expressify(a... | [
11748,
7308,
13,
2617,
3866,
16005,
198,
29113,
29113,
14468,
198,
2,
198,
2,
220,
5438,
2163,
198,
2,
198,
29113,
29113,
14468,
198,
198,
8818,
27741,
2348,
29230,
13,
42712,
1958,
7,
64,
3712,
14565,
15878,
36,
10671,
26,
4732,
796,... | 2.766323 | 5,820 |
"""
boore_thompson_2014(m, r_ps::U, src::SourceParameters{S,T}) where {S<:Float64, T<:Real, U<:Real}
<NAME> (2014) excitation duration model.
"""
function boore_thompson_2014(m, r_ps::U, src::SourceParameters{S,T}) where {S<:Float64, T<:Real, U<:Real}
# source duration
fa, fb, ε = corner_frequency(m, src)
if ... | [
198,
37811,
198,
220,
1489,
382,
62,
400,
296,
8430,
62,
4967,
7,
76,
11,
374,
62,
862,
3712,
52,
11,
12351,
3712,
7416,
48944,
90,
50,
11,
51,
30072,
810,
1391,
50,
27,
25,
43879,
2414,
11,
309,
27,
25,
15633,
11,
471,
27,
25... | 2.173755 | 5,784 |
<gh_stars>0
using ESDL
using Test
@testset "Axis generation" begin
@test LonAxis(1.0:10.0)==RangeAxis{Float64,:Lon,StepRangeLen{Float64}}(1.0:10.0)
@test LatAxis(1.0:10.0)==RangeAxis{Float64,:Lat,StepRangeLen{Float64}}(1.0:10.0)
end
| [
27,
456,
62,
30783,
29,
15,
198,
3500,
412,
10305,
43,
198,
3500,
6208,
198,
198,
31,
9288,
2617,
366,
31554,
271,
5270,
1,
2221,
198,
31,
9288,
39295,
31554,
271,
7,
16,
13,
15,
25,
940,
13,
15,
8,
855,
17257,
31554,
271,
90,
... | 2.070796 | 113 |
"Summary of optimization using the NLopt package"
type OptSummary
initial::Vector{Float64}
final::Vector{Float64}
fmin::Float64
feval::Int
geval::Int
optimizer::Symbol
end
function OptSummary(initial::Vector{Float64},optimizer::Symbol)
OptSummary(initial,initial,Inf,-1,-1,optimizer)
end
typ... | [
1,
22093,
286,
23989,
1262,
262,
22879,
8738,
5301,
1,
198,
4906,
13123,
22093,
198,
220,
220,
220,
4238,
3712,
38469,
90,
43879,
2414,
92,
198,
220,
220,
220,
2457,
3712,
38469,
90,
43879,
2414,
92,
198,
220,
220,
220,
277,
1084,
3... | 1.921156 | 6,088 |
<gh_stars>0
using StructuresKit
#Ix Iy Ixy J Cw
section_properties = [(3.230E6,449530,-865760, 397.09, 3.4104E9)]
#E ν
material_properties = [(200,0.30)]
#kx kϕ
spring_stiffness = [(0.0,300/1000)]
#ay_kx
spring_location = [(101.6)]
#qx qy start end
loads = [(0.0001, 0.00002, 0.0, 7620.0)]
#ax ay
load_locations =... | [
27,
456,
62,
30783,
29,
15,
198,
3500,
32112,
942,
20827,
198,
198,
2,
40,
87,
314,
88,
314,
5431,
449,
327,
86,
198,
5458,
62,
48310,
796,
47527,
18,
13,
19214,
36,
21,
11,
2598,
3865,
1270,
12095,
23,
37680,
1899,
11,
5014,
22... | 2.18123 | 618 |
<gh_stars>10-100
module Libm
const FloatTypes=Union{Float32,Float64}
include("utils.jl")
include("erf.jl")
include("log/tang.jl")
end
| [
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
21412,
7980,
76,
198,
198,
9979,
48436,
31431,
28,
38176,
90,
43879,
2624,
11,
43879,
2414,
92,
198,
198,
17256,
7203,
26791,
13,
20362,
4943,
198,
17256,
7203,
263,
69,
13,
20362,
4943,
1... | 2.446429 | 56 |
<reponame>stjordanis/CombinatorialSpaces.jl
using Documenter
using CombinatorialSpaces
makedocs(
sitename = "CombinatorialSpaces.jl",
format = Documenter.HTML(),
modules = [CombinatorialSpaces],
checkdocs = :exports,
pages = [
"simplicial_sets.md",
"discrete_exterior_calculus.md",
"combinatorial_... | [
27,
7856,
261,
480,
29,
301,
73,
7350,
271,
14,
20575,
20900,
498,
4561,
2114,
13,
20362,
198,
3500,
16854,
263,
198,
3500,
955,
8800,
21592,
4561,
2114,
198,
198,
76,
4335,
420,
82,
7,
198,
220,
1650,
12453,
796,
366,
20575,
20900,... | 2.492462 | 199 |
using Test
using LogicCircuits
using ProbabilisticCircuits
@testset "Circuit saver test" begin
mktempdir() do tmp
circuit, vtree = load_struct_prob_circuit(
zoo_psdd_file("little_4var.psdd"), zoo_vtree_file("little_4var.vtree"))
# load, save, and load as .psdd
... | [
3500,
6208,
198,
3500,
30146,
31560,
15379,
198,
3500,
30873,
14991,
2569,
31560,
15379,
198,
198,
31,
9288,
2617,
366,
31560,
5013,
473,
332,
1332,
1,
2221,
198,
220,
220,
220,
33480,
29510,
15908,
3419,
466,
45218,
628,
220,
220,
220,... | 2.12037 | 324 |
<gh_stars>10-100
abstract SVM{TSpec <: SVMSpec} <: RegressionModel
# ==========================================================================
svmModel(spec::SVMSpec, solution::PrimalSolution, predmodel::Predictor, X::AbstractMatrix, Y::AbstractArray) =
primalSVMModel(spec, solution, predmodel, X, Y)
svmModel(spe... | [
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
397,
8709,
311,
15996,
90,
4694,
43106,
1279,
25,
311,
15996,
22882,
92,
1279,
25,
3310,
2234,
17633,
198,
198,
2,
38093,
2559,
28,
198,
198,
82,
14761,
17633,
7,
16684,
3712,
50,
15996,
... | 2.589504 | 7,184 |
<gh_stars>0
#################################################################################################
# AIM 5: two-sample comparison performance
#################################################################################################
## Deps
using StatsPlots
using Distributed
using Combinatorics
using ... | [
27,
456,
62,
30783,
29,
15,
198,
29113,
29113,
29113,
2,
198,
2,
317,
3955,
642,
25,
734,
12,
39873,
7208,
2854,
198,
29113,
29113,
29113,
2,
198,
2235,
2129,
82,
198,
3500,
20595,
3646,
1747,
198,
3500,
4307,
6169,
198,
3500,
955,
... | 3.013051 | 613 |
### mcvar and mcse stand for Monte Carlo variance and Monte Carlo error respectively
## Monte Carlo variance assuming IID samples
mcvar(v::AbstractArray, ::Type{Val{:iid}}) = var(v)/length(v)
mcvar(v::AbstractArray, ::Type{Val{:iid}}, region) = mapslices(x -> mcvar(x, Val{:iid}), v, region)
mcvar(s::VariableNState{... | [
21017,
36650,
7785,
290,
36650,
325,
1302,
329,
22489,
40089,
24198,
290,
22489,
40089,
4049,
8148,
198,
198,
2235,
22489,
40089,
24198,
13148,
314,
2389,
8405,
198,
198,
23209,
7785,
7,
85,
3712,
23839,
19182,
11,
7904,
6030,
90,
7762,
... | 2.472727 | 3,575 |
"""
Simple Tucker (HOSVD) type
# Data
- `core::Array{T, N}`
- `factors::NTuple{N, Matrix{T}}`
Tucker factors are stored as tall matrices
"""
struct Tucker{T, N}
core::Array{T, N}
factors::NTuple{N, Matrix{T}}
#props::Dict{Symbol, Any}
end
function Tucker_tot(A::Array{T,N}; thresh=-1, verbose=0) where {T... | [
37811,
198,
26437,
25951,
357,
39,
2640,
8898,
8,
2099,
198,
2,
6060,
198,
12,
4600,
7295,
3712,
19182,
90,
51,
11,
399,
92,
63,
198,
12,
4600,
22584,
669,
3712,
11251,
29291,
90,
45,
11,
24936,
90,
51,
11709,
63,
198,
198,
51,
... | 1.951339 | 6,309 |
include("include.jl")
data = createStructures()
fillInput!(data)
fillOptions!(data)
fillPreprocessor!(data)
if data.options.enumerate
explicityEnumeration!(data)
grapfOutputEnum!(data)
else
singleModel!(data)
grapfOutput!(data)
textOutput!(data)
end | [
17256,
7203,
17256,
13,
20362,
4943,
198,
198,
7890,
796,
2251,
44909,
942,
3419,
198,
198,
20797,
20560,
0,
7,
7890,
8,
198,
20797,
29046,
0,
7,
7890,
8,
198,
20797,
6719,
41341,
0,
7,
7890,
8,
198,
198,
361,
1366,
13,
25811,
13,... | 2.518519 | 108 |
# Autogenerated wrapper script for libCEED_jll for x86_64-apple-darwin
export libceed
JLLWrappers.@generate_wrapper_header("libCEED")
JLLWrappers.@declare_library_product(libceed, "@rpath/libceed.dylib")
function __init__()
JLLWrappers.@generate_init_header()
JLLWrappers.@init_library_product(
libceed,... | [
2,
5231,
519,
877,
515,
29908,
4226,
329,
9195,
5222,
1961,
62,
73,
297,
329,
2124,
4521,
62,
2414,
12,
18040,
12,
27455,
5404,
198,
39344,
9195,
2707,
198,
198,
41,
3069,
36918,
11799,
13,
31,
8612,
378,
62,
48553,
62,
25677,
7203,... | 2.319588 | 194 |
using CG1D
using Test
@testset "CG1D.jl" begin
# Write your tests here.
end
| [
3500,
29925,
16,
35,
198,
3500,
6208,
198,
198,
31,
9288,
2617,
366,
39816,
16,
35,
13,
20362,
1,
2221,
198,
220,
220,
220,
1303,
19430,
534,
5254,
994,
13,
198,
437,
198
] | 2.454545 | 33 |
# rewrite.jl - expression pattern matching and rewriting.
#
# The general idea behind functions in this file is to provide easy means
# of finding specific pieces of expressions and using them elsewhere.
# At the time of writing it is used in 2 parts of this package:
#
# * for applyging derivatives, e.g. `x^n` ==> `n*... | [
198,
2,
28183,
13,
20362,
532,
5408,
3912,
12336,
290,
49614,
13,
198,
2,
198,
2,
383,
2276,
2126,
2157,
5499,
287,
428,
2393,
318,
284,
2148,
2562,
1724,
198,
2,
286,
4917,
2176,
5207,
286,
14700,
290,
1262,
606,
8057,
13,
198,
2... | 2.21747 | 4,442 |
############################################################################################
############################################################################################
############################################################################################
# Diagnostics
@testset "Sampling - Diagno... | [
29113,
29113,
14468,
7804,
4242,
198,
29113,
29113,
14468,
7804,
4242,
198,
29113,
29113,
14468,
7804,
4242,
198,
2,
31549,
34558,
198,
31,
9288,
2617,
366,
16305,
11347,
532,
31549,
34558,
25,
366,
2221,
198,
220,
220,
220,
2566,
363,
... | 3.56795 | 1,273 |
<filename>src/functions/getindex.jl<gh_stars>100-1000
import Base.getindex
"""
getindex(x::Var, inds...)
```julia
x = Var(rand(Float32,10,5))
y = x[1:3]
y = x[2:2]
```
Note that `y = x[i]` throws an error since `y` is not a vector but a scholar.
Instead, use `y = x[i:i]`.
"""
function getindex(x::Var, I::Tuple)
... | [
27,
34345,
29,
10677,
14,
12543,
2733,
14,
1136,
9630,
13,
20362,
27,
456,
62,
30783,
29,
3064,
12,
12825,
198,
11748,
7308,
13,
1136,
9630,
198,
198,
37811,
198,
220,
220,
220,
651,
9630,
7,
87,
3712,
19852,
11,
773,
82,
23029,
1... | 2.191011 | 267 |
<gh_stars>0
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# Description
#
# Private functions and macros.
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
################################################################################
# ... | [
27,
456,
62,
30783,
29,
15,
198,
2,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
... | 2.238619 | 5,272 |
@defcomp vslvmorb begin
regions = Index()
vsl = Variable(index=[time,regions])
vmorb = Variable(index=[time,regions])
population = Parameter(index=[time,regions])
income = Parameter(index=[time,regions])
vslbm = Parameter(default = 4.99252262888626e6)
vslel = Parameter(default... | [
31,
4299,
5589,
3691,
6780,
4491,
65,
2221,
198,
220,
220,
220,
7652,
796,
12901,
3419,
628,
220,
220,
220,
3691,
75,
796,
35748,
7,
9630,
41888,
2435,
11,
2301,
507,
12962,
198,
220,
220,
220,
410,
4491,
65,
796,
35748,
7,
9630,
... | 1.931718 | 454 |
<filename>src/FileIO/wannier.jl
function readoutput(calculation::Calculation{Wannier90}, file; kwargs...)
return wan_read_output(file; kwargs...)
end
#THIS IS THE MOST HORRIBLE FUNCTION I HAVE EVER CREATED!!!
#extracts only atoms with projections
function extract_atoms(atoms_block, proj_block, cell::Mat3, spinors... | [
27,
34345,
29,
10677,
14,
8979,
9399,
14,
86,
1236,
959,
13,
20362,
198,
198,
8818,
1100,
22915,
7,
9948,
14902,
3712,
9771,
14902,
90,
54,
1236,
959,
3829,
5512,
2393,
26,
479,
86,
22046,
23029,
198,
220,
220,
220,
1441,
266,
272,
... | 1.833082 | 8,621 |
<filename>src/sim.jl
## generate data from a PH model with constant baseline hazard log(2)/12
## return object of type Ph.Data, PhSpline.Data or WeibullPh.Data
function ph_exp_1(par, fpar, data_type=WeibullPHData)
n = fpar.n
z = zeros(Float64, n, 1)
z[:,1] = rand(Binomial(1, 0.5), n) .- 0.5
## 10 pati... | [
27,
34345,
29,
10677,
14,
14323,
13,
20362,
198,
2235,
7716,
1366,
422,
257,
9370,
2746,
351,
6937,
14805,
15834,
2604,
7,
17,
20679,
1065,
198,
2235,
1441,
2134,
286,
2099,
1380,
13,
6601,
11,
1380,
26568,
500,
13,
6601,
393,
775,
... | 1.933003 | 5,657 |
<gh_stars>0
struct IntervalLabels <: AbstractData end
Base.@kwdef mutable struct LabelledInterval <: AbstractModel
label::String = ""
nested_interval::NestedInterval
end
Base.@kwdef mutable struct LabelledIntervals{T₁ <: Dict{String, LabelledInterval}} <: AbstractModel
description::String = ""
labell... | [
27,
456,
62,
30783,
29,
15,
198,
7249,
4225,
2100,
17822,
1424,
1279,
25,
27741,
6601,
886,
198,
198,
14881,
13,
31,
46265,
4299,
4517,
540,
2878,
3498,
11978,
9492,
2100,
1279,
25,
27741,
17633,
198,
220,
220,
220,
6167,
3712,
10100,... | 2.4658 | 2,924 |
using DemoPackageTEH
using Test
@testset "DemoPackageTEH.jl" begin
# Write your tests here.
end
| [
3500,
34588,
27813,
9328,
39,
198,
3500,
6208,
198,
198,
31,
9288,
2617,
366,
11522,
78,
27813,
9328,
39,
13,
20362,
1,
2221,
198,
220,
220,
220,
1303,
19430,
534,
5254,
994,
13,
198,
437,
198
] | 2.805556 | 36 |
<filename>test/optimizer/mutation.jl
# This file is part of Kpax3. License is MIT.
# Pr(B1 = [1; 1; 1]) = 4 / 5
# Pr(B1 = [2; 1; 1]) = 1 / 5
#
# Pr(B2 = [1; 1; 1]) = (4 / 5) * (4 / 5) = 16 / 25
# Pr(B2 = [1; 2; 1]) = (4 / 5) * (1 / 5) = 4 / 25
# Pr(B2 = [2; 1; 1]) = (1 / 5) * (4 / 5) = 4 / 25
# Pr(B2 = [2; 2; 1]) = (1... | [
27,
34345,
29,
9288,
14,
40085,
7509,
14,
76,
7094,
13,
20362,
198,
2,
770,
2393,
318,
636,
286,
509,
79,
897,
18,
13,
13789,
318,
17168,
13,
198,
198,
2,
1736,
7,
33,
16,
796,
685,
16,
26,
352,
26,
352,
12962,
796,
604,
1220,... | 1.707612 | 1,734 |
<reponame>JuliaDynamics/ChaosThroughBilliards<filename>scripts/two_initial.jl
using DrWatson
@quickactivate "ChaosThroughBilliards"
include(srcdir("style.jl"))
x = 1.0
y = 0.54
si = billiard_sinai(y/4, x, y)
ps = [Particle(4x/5, y/5, π/9), Particle(4x/5, y/5 + 1e-5, π/9)]
# interactive_billiard(re, ps;
# backgroun... | [
27,
7856,
261,
480,
29,
16980,
544,
35,
4989,
873,
14,
1925,
7495,
15046,
17798,
72,
1371,
27,
34345,
29,
46521,
14,
11545,
62,
36733,
13,
20362,
198,
3500,
1583,
54,
13506,
198,
31,
24209,
39022,
366,
1925,
7495,
15046,
17798,
72,
... | 2.319359 | 811 |
<reponame>nhz2/Rotations.jl<gh_stars>10-100
## log
# 2d
Base.log(R::Angle2d) = Angle2dGenerator(R.theta)
Base.log(R::RotMatrix{2}) = RotMatrixGenerator(log(Angle2d(R)))
#= We can define log for Rotation{2} like this,
but the subtypes of Rotation{2} are only Angle2d and RotMatrix{2},
so we don't need this defnition. =#
... | [
27,
7856,
261,
480,
29,
77,
32179,
17,
14,
24864,
602,
13,
20362,
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
2235,
2604,
198,
2,
362,
67,
198,
14881,
13,
6404,
7,
49,
3712,
13450,
293,
17,
67,
8,
796,
42375,
17,
67,
8645,
135... | 2.416079 | 709 |
<gh_stars>0
struct TikzPlotFormula <: AbstractTikzPlot
x::AbstractVector{Number}
y::AbstractVector{Number}
attributes::Dict{String, String}
end
# A fomula specifying only a function of the form y = f(x)
function formula(y::String, attributes::Dict{String,String}=Dict())
end
# A fomula with a range of x values an... | [
27,
456,
62,
30783,
29,
15,
198,
7249,
46338,
89,
43328,
8479,
4712,
1279,
25,
27741,
51,
1134,
89,
43328,
198,
197,
87,
3712,
23839,
38469,
90,
15057,
92,
198,
197,
88,
3712,
23839,
38469,
90,
15057,
92,
198,
197,
1078,
7657,
3712,... | 2.527273 | 330 |
<filename>test/basics_tests.jl
@testset "Basic Utilities Tests" begin
@testset "Utils" begin
ϵ = log(3); δ = 0.05
@test gaussianMechConstant(ϵ, δ) ≈ 1.7563398731147597 atol=1e-10
tmp = gaussianMechConstant2(ϵ, δ)
@test tmp[1] ≈ 1.7563398731147597 atol=1e-10
@test tmp[2] ≈ 2.3095249420840473 atol=... | [
27,
34345,
29,
9288,
14,
12093,
873,
62,
41989,
13,
20362,
198,
31,
9288,
2617,
366,
26416,
41086,
30307,
1,
2221,
198,
220,
2488,
9288,
2617,
366,
18274,
4487,
1,
2221,
198,
220,
220,
220,
18074,
113,
796,
2604,
7,
18,
1776,
7377,
... | 1.938272 | 567 |
abstract type AbstractIndexer end
struct Indexer{T, Ns<:NamedTuple} <: AbstractIndexer
__fields::Ns
end
Indexer{T}(x::NamedTuple) where T = Indexer{T, typeof(x)}(x)
IndexedType(::Indexer{T}) where T = T
function Base.getproperty(I::Indexer, x::Symbol)
fs = getfield(I, :__fields)
haskey(fs, x) && return ... | [
397,
8709,
2099,
27741,
15732,
263,
886,
198,
198,
7249,
12901,
263,
90,
51,
11,
399,
82,
27,
25,
45,
2434,
51,
29291,
92,
1279,
25,
27741,
15732,
263,
198,
220,
220,
220,
11593,
25747,
3712,
47503,
198,
437,
198,
198,
15732,
263,
... | 2.014311 | 559 |
@testset "Testing matching_tools.jl" begin
@testset "random_prefs for one-to-one" begin
nums = (8, 6)
prefs_arrays = random_prefs(nums..., allow_unmatched=false)
prefs_arrays_allowed = random_prefs(nums..., allow_unmatched=true)
prefs_arrays_all = tuple(prefs_arrays..., prefs_arrays... | [
31,
9288,
2617,
366,
44154,
12336,
62,
31391,
13,
20362,
1,
2221,
628,
220,
220,
220,
2488,
9288,
2617,
366,
25120,
62,
3866,
9501,
329,
530,
12,
1462,
12,
505,
1,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
997,
82,
796,
357,
... | 1.83869 | 1,649 |
<filename>test/show.jl
# Test string creation
@testset "String Creators" begin
# initialize model and attributes
m = InfiniteModel()
@infinite_parameter(m, par1 in [0, 1])
@infinite_parameter(m, pars[1:2] ~ MvNormal([1, 1], 1))
@infinite_parameter(m, pars2[1:2] in [0, 2])
@infinite_parameter(m, ... | [
27,
34345,
29,
9288,
14,
12860,
13,
20362,
198,
2,
6208,
4731,
6282,
198,
31,
9288,
2617,
366,
10100,
7921,
669,
1,
2221,
198,
220,
220,
220,
1303,
41216,
2746,
290,
12608,
198,
220,
220,
220,
285,
796,
22380,
17633,
3419,
198,
220,... | 2.1793 | 22,387 |
using MultiDimDictionaries
using Documenter
DocMeta.setdocmeta!(
MultiDimDictionaries, :DocTestSetup, :(using MultiDimDictionaries); recursive=true
)
makedocs(;
modules=[MultiDimDictionaries],
authors="<NAME> <<EMAIL>> and contributors",
repo="https://github.com/mtfishman/MultiDimDictionaries.jl/blob/{commit}... | [
3500,
15237,
29271,
35,
2867,
3166,
198,
3500,
16854,
263,
198,
198,
23579,
48526,
13,
2617,
15390,
28961,
0,
7,
198,
220,
15237,
29271,
35,
2867,
3166,
11,
1058,
23579,
14402,
40786,
11,
36147,
3500,
15237,
29271,
35,
2867,
3166,
1776,... | 2.747934 | 242 |
<gh_stars>0
module SyslogLogging
using Syslogs
using Logging
using Sockets
import Logging: shouldlog, min_enabled_level, catch_exceptions, handle_message
export SyslogLogger
const last_ident = String[""]
function open_syslog(ident::String, facility::Symbol)
Syslogs.openlog(ident, 0, Syslogs.FACILITIES[facility])... | [
27,
456,
62,
30783,
29,
15,
198,
21412,
311,
893,
6404,
11187,
2667,
198,
198,
3500,
311,
893,
6404,
82,
198,
3500,
5972,
2667,
198,
3500,
311,
11603,
198,
198,
11748,
5972,
2667,
25,
815,
6404,
11,
949,
62,
25616,
62,
5715,
11,
4... | 2.417029 | 1,151 |
using MLOPF
using Test
@testset "MLOPF.jl" begin
# Write your tests here.
end
| [
3500,
10373,
3185,
37,
198,
3500,
6208,
198,
198,
31,
9288,
2617,
366,
5805,
3185,
37,
13,
20362,
1,
2221,
198,
220,
220,
220,
1303,
19430,
534,
5254,
994,
13,
198,
437,
198
] | 2.515152 | 33 |
using ValidatedNumerics, SparseArrays
using ..DynamicDefinition, ..BasisDefinition
using LinearAlgebra
import ValidatedNumerics.IntervalArithmetic: mid
import Base: size, eltype
import LinearAlgebra: mul!
"""
Very generic assembler function
"""
function assemble(B::Basis, D::Dynamic, ϵ=2^(-40); T = Float64)
I = Int... | [
3500,
3254,
41475,
45,
6975,
873,
11,
1338,
17208,
3163,
20477,
198,
3500,
11485,
44090,
36621,
11,
11485,
15522,
271,
36621,
198,
198,
3500,
44800,
2348,
29230,
198,
198,
11748,
3254,
41475,
45,
6975,
873,
13,
9492,
2100,
3163,
29848,
... | 2.594993 | 1,358 |
#
# CartesianBoxes.jl -
#
# Extends CartesianIndices.
#
#-------------------------------------------------------------------------------
#
# This file is part of the `CartesianBoxes.jl` package which is licensed under
# the MIT "Expat" License.
#
# Copyright (c) 2017-2022 <NAME>.
#
__precompile__(true)
"""
`Cartesian... | [
2,
198,
2,
13690,
35610,
14253,
274,
13,
20362,
532,
198,
2,
198,
2,
5683,
2412,
13690,
35610,
5497,
1063,
13,
198,
2,
198,
2,
10097,
24305,
198,
2,
198,
2,
770,
2393,
318,
636,
286,
262,
4600,
43476,
35610,
14253,
274,
13,
20362,... | 2.424286 | 6,201 |
<reponame>eunjongkim/Touchstone.jl
abstract type CircuitParams{T<:Real} <: AbstractParams end
"""
Impedance{T<:Real} <: CircuitParams{T}
"""
mutable struct Impedance{T<:Real} <: CircuitParams{T}
data::Complex{T}
end
Impedance(z::T) where {T<:Real} = Impedance(complex(z))
Impedance(zd::AbstractVector{Complex{T... | [
27,
7856,
261,
480,
29,
68,
403,
32428,
74,
320,
14,
35211,
6440,
13,
20362,
198,
397,
8709,
2099,
13588,
10044,
4105,
90,
51,
27,
25,
15633,
92,
1279,
25,
27741,
10044,
4105,
886,
198,
198,
37811,
198,
220,
220,
220,
1846,
9124,
... | 2.30273 | 403 |
<gh_stars>1-10
module IsDef
export isdef, Out, NotApplicable, ∨, apply
using Compat
import InteractiveUtils
"""
just applies a given function to arguments and keyword arguments
This little helper is crucial if you want to typeinfer
when only knowing the function type instead of the function instance.
"""
apply(f, a... | [
27,
456,
62,
30783,
29,
16,
12,
940,
198,
21412,
1148,
7469,
198,
39344,
318,
4299,
11,
3806,
11,
1892,
33583,
540,
11,
18872,
101,
11,
4174,
198,
198,
3500,
3082,
265,
198,
11748,
21365,
18274,
4487,
628,
198,
37811,
198,
3137,
899... | 3.051978 | 4,348 |
module TestComposites
using Test
using MLJBase
using ..Models
using CategoricalArrays
import Random.seed!
seed!(1234)
@load KNNRegressor
N = 50
Xin = (a=rand(N), b=rand(N), c=rand(N))
yin = rand(N)
train, test = partition(eachindex(yin), 0.7);
Xtrain = MLJBase.selectrows(Xin, train)
ytrain = yin[train]
ridge_model... | [
21412,
6208,
5377,
1930,
2737,
198,
198,
3500,
6208,
198,
3500,
10373,
41,
14881,
198,
3500,
11485,
5841,
1424,
198,
3500,
327,
2397,
12409,
3163,
20477,
198,
11748,
14534,
13,
28826,
0,
198,
28826,
0,
7,
1065,
2682,
8,
198,
198,
31,
... | 2.148747 | 6,306 |
#==============================================================================
Code for solving the Hamiltonian Jacobi Bellman for
a Ramsey Model with a diffusion process for capital
Based on Matlab code from <NAME>:
http://www.princeton.edu/~moll/HACTproject.htm
Updated to julia 1.0.0
===... | [
2,
23926,
25609,
855,
198,
220,
220,
220,
6127,
329,
18120,
262,
11582,
666,
12806,
72,
7459,
805,
329,
198,
197,
220,
220,
257,
30552,
9104,
351,
257,
44258,
1429,
329,
3139,
628,
220,
197,
15001,
319,
220,
6550,
23912,
2438,
422,
... | 2.219033 | 4,424 |
using Documenter, SampleJuliaPackage
makedocs(;
modules=[SampleJuliaPackage],
format=Documenter.HTML(),
pages=[
"Home" => "index.md",
],
repo="https://github.com/kyungminlee/SampleJuliaPackage.jl/blob/{commit}{path}#L{line}",
sitename="SampleJuliaPackage.jl",
authors="<NAME>",
a... | [
3500,
16854,
263,
11,
27565,
16980,
544,
27813,
198,
198,
76,
4335,
420,
82,
7,
26,
198,
220,
220,
220,
13103,
41888,
36674,
16980,
544,
27813,
4357,
198,
220,
220,
220,
5794,
28,
24941,
263,
13,
28656,
22784,
198,
220,
220,
220,
54... | 2.403509 | 171 |
<gh_stars>100-1000
using LinearAlgebra, StatsBase, Random, LaTeXStrings, Plots; pyplot()
Random.seed!(0)
L = 10
p0, p1 = 1/2, 3/4
beta = 0.75
pExplore(t) = t^-0.2
alpha(t) = t^-0.2
T = 10^6
function QlearnSim(kappa)
P0 = diagm(1=>fill(p0,L-1)) + diagm(-1=>fill(1-p0,L-1))
P0[1,1], P0[L,L] = 1 - p0, p0
P1 ... | [
27,
456,
62,
30783,
29,
3064,
12,
12825,
198,
3500,
44800,
2348,
29230,
11,
20595,
14881,
11,
14534,
11,
4689,
49568,
13290,
654,
11,
1345,
1747,
26,
12972,
29487,
3419,
198,
29531,
13,
28826,
0,
7,
15,
8,
198,
198,
43,
796,
838,
... | 1.730563 | 746 |
export Binarize
"""
$(TYPEDEF)
Represents a Binarized Layer.
"""
struct Binarize <: Layer
end
function Base.show(io::IO, p::Binarize)
print(io, "Binarize()")
end
(p::Binarize)(x::Array{<:JuMPReal}) = binarize(x)
| [
39344,
20828,
283,
1096,
198,
198,
37811,
198,
3,
7,
9936,
47,
1961,
25425,
8,
198,
198,
6207,
6629,
257,
20828,
283,
1143,
34398,
13,
198,
37811,
198,
7249,
20828,
283,
1096,
1279,
25,
34398,
198,
437,
198,
198,
8818,
7308,
13,
128... | 2.244898 | 98 |
<filename>src/Pingo.jl
module PinGo
using Luxor
using ExprTools
using Luxor: preview
export Bingo, save, preview, generate
include("bingo.jl")
include("spells.jl")
end
| [
27,
34345,
29,
10677,
14,
47,
32735,
13,
20362,
198,
21412,
13727,
5247,
198,
198,
3500,
17145,
273,
198,
3500,
1475,
1050,
33637,
198,
3500,
17145,
273,
25,
12714,
198,
39344,
21631,
78,
11,
3613,
11,
12714,
11,
7716,
198,
198,
17256... | 2.85 | 60 |
<reponame>Fypsilonn/RedPitayaDAQServer<filename>src/examples/julia/slowDAC.jl
using RedPitayaDAQServer
using PyPlot
# obtain the URL of the RedPitaya
include("config.jl")
rp = RedPitayaCluster([URLs[1]])
dec = 64
modulus = 4800
base_frequency = 125000000
periods_per_step = 5
samples_per_period = div(modulus, dec)
pe... | [
27,
7856,
261,
480,
29,
37,
88,
862,
33576,
77,
14,
7738,
47,
270,
11729,
46640,
10697,
27,
34345,
29,
10677,
14,
1069,
12629,
14,
73,
43640,
14,
38246,
35,
2246,
13,
20362,
198,
3500,
2297,
47,
270,
11729,
46640,
10697,
198,
3500,
... | 2.310618 | 631 |
<reponame>Abhisheknishant/DistributedFactorGraphs.jl
using GraphPlot
using DistributedFactorGraphs
# using DistributedFactorGraphs.DFGPlots
using Test
struct TestInferenceVariable1 <: InferenceVariable end
# Now make a complex graph for connectivity tests
numNodes = 10
dfg = LightDFG{NoSolverParams}()
verts = map(n -... | [
27,
7856,
261,
480,
29,
4826,
14363,
258,
15418,
680,
415,
14,
20344,
6169,
41384,
37065,
82,
13,
20362,
198,
3500,
29681,
43328,
198,
3500,
4307,
6169,
41384,
37065,
82,
198,
2,
1262,
4307,
6169,
41384,
37065,
82,
13,
8068,
38,
3646,... | 2.70915 | 306 |
using HydroModels
using Base.Test
| [
3500,
32116,
5841,
1424,
198,
3500,
7308,
13,
14402,
198
] | 3.4 | 10 |
<gh_stars>100-1000
println("loading LowRankModels")
@time @everywhere using LowRankModels
function fit_pca(m,n,k)
# matrix to encode
Random.seed!(1)
A = randn(m,k)*randn(k,n)
X=randn(k,m)
Y=randn(k,n)
losses = fill(QuadLoss(),n)
r = QuadReg()
glrm = GLRM(A,losses,r,r,k, X=X, Y=Y)
glrm = share(glrm)
p = Param... | [
27,
456,
62,
30783,
29,
3064,
12,
12825,
198,
35235,
7203,
25138,
7754,
27520,
5841,
1424,
4943,
198,
31,
2435,
2488,
16833,
3003,
1262,
7754,
27520,
5841,
1424,
198,
198,
8818,
4197,
62,
79,
6888,
7,
76,
11,
77,
11,
74,
8,
198,
1... | 2.031373 | 255 |
# SCALING
#
# PART OF BAZINGA.jl
using LinearAlgebra
"""
objgradscaling()
returns a scaling factor `σ` for an objective function `f` at a given point `x`
such that the gradient of `F := σ f` at `x` does not exceed `scaling_grad_max` or,
if requested, is `scaling_grad_target`, whenever allowed by `scaling_min_valu... | [
2,
6374,
1847,
2751,
198,
2,
198,
2,
16652,
3963,
347,
22778,
2751,
32,
13,
20362,
198,
198,
3500,
44800,
2348,
29230,
198,
198,
37811,
198,
220,
220,
220,
26181,
9744,
1416,
4272,
3419,
198,
7783,
82,
257,
20796,
5766,
4600,
38392,
... | 2.257009 | 428 |
<filename>src/buffer.jl
# internal data for packed integers
type Buffer{w,T<:Unsigned}
data::Vector{T}
function Buffer(len::Integer, mmap::Bool=false)
@assert w ≤ bitsof(T)
buflen = cld(len * w, bitsof(T))
data = mmap ? Mmap.mmap(Vector{T}, buflen) : Vector{T}(buflen)
return new(... | [
27,
34345,
29,
10677,
14,
22252,
13,
20362,
198,
2,
5387,
1366,
329,
11856,
37014,
198,
4906,
47017,
90,
86,
11,
51,
27,
25,
3118,
32696,
92,
198,
220,
220,
220,
1366,
3712,
38469,
90,
51,
92,
198,
220,
220,
220,
2163,
47017,
7,
... | 1.837691 | 2,027 |
<filename>src/lcparray.jl
"""
lcparray
Kasai's algorithm for linear-time construction of LCP array from Suffix Array
"""
function lcparray(sa::Vector{Int}, data::Vector{T}) where T<:Integer
n = length(sa)
lcps = similar(sa)
rank = similar(sa)
for i = 1:n
rank[sa[i]] = i
end
lcp = 0... | [
27,
34345,
29,
10677,
14,
44601,
1845,
2433,
13,
20362,
198,
37811,
198,
220,
220,
220,
300,
66,
1845,
2433,
198,
198,
42,
292,
1872,
338,
11862,
329,
14174,
12,
2435,
5103,
286,
406,
8697,
7177,
422,
24974,
844,
15690,
198,
37811,
... | 1.915858 | 309 |
## input the tolerance for mismatch
tol = 1e-2
function check_difference(a,b,tol)
return abs((a-b)/(a+b+1e-7)) <= tol
end
## Parse the network data
network = _WM.parse_file("data/epanet/van_zyl.inp")
network_mn = _WM.make_multinetwork(network)
network_ids = sort([parse(Int, nw) for (nw, nw_data) in network_mn["nw"]]... | [
2235,
5128,
262,
15621,
329,
46318,
198,
83,
349,
796,
352,
68,
12,
17,
198,
8818,
2198,
62,
26069,
1945,
7,
64,
11,
65,
11,
83,
349,
8,
198,
197,
7783,
2352,
19510,
64,
12,
65,
20679,
7,
64,
10,
65,
10,
16,
68,
12,
22,
4008... | 2.39322 | 295 |
module clcircularplatecl_examples
using FinEtools
using FinEtoolsDeforLinear
using FinEtoolsDeforLinear.AlgoDeforLinearModule
using FinEtools.MeshExportModule
using Statistics: mean
# Clamped square plate with concentrated force
# Data listed in the Simo 1990 paper 'A class of... '
# Analytical solution for the vert... | [
21412,
537,
21170,
934,
6816,
565,
62,
1069,
12629,
198,
3500,
4463,
36,
31391,
198,
3500,
4463,
36,
31391,
7469,
273,
14993,
451,
198,
3500,
4463,
36,
31391,
7469,
273,
14993,
451,
13,
2348,
2188,
7469,
273,
14993,
451,
26796,
198,
3... | 2.018492 | 6,219 |
using FighterJets
using Test
@testset "FighterJets.jl" begin
# Write your tests here.
end
| [
3500,
15411,
41,
1039,
198,
3500,
6208,
198,
198,
31,
9288,
2617,
366,
37,
4799,
41,
1039,
13,
20362,
1,
2221,
198,
220,
220,
220,
1303,
19430,
534,
5254,
994,
13,
198,
437,
198
] | 2.794118 | 34 |
# This file was generated, do not modify it. # hide
unique(iris.Species) | [
2,
770,
2393,
373,
7560,
11,
466,
407,
13096,
340,
13,
1303,
7808,
198,
34642,
7,
29616,
13,
5248,
3171,
8
] | 3.428571 | 21 |
function pattern(n::Int)::String
output = IOBuffer()
for i = 1:n
str = string(i)
for j = 1:i write(output,str) end
if i<n println(output) end
end
return String(take!(output))
end | [
8818,
3912,
7,
77,
3712,
5317,
2599,
25,
10100,
198,
220,
220,
220,
5072,
796,
314,
9864,
13712,
3419,
198,
220,
220,
220,
329,
1312,
796,
352,
25,
77,
198,
220,
220,
220,
220,
220,
220,
220,
965,
796,
4731,
7,
72,
8,
198,
220,
... | 2.18 | 100 |
<filename>test/test_softmax.jl<gh_stars>1-10
using Word2Vec
using Base.Test
using Compat
data_dir = joinpath(Pkg.dir("Word2Vec"), "test", "data")
train_file = joinpath(data_dir, "mnist_train.csv")
test_file = joinpath(data_dir, "mnist_test.csv")
function test_softmax()
println("Testing the softmax classifier on t... | [
27,
34345,
29,
9288,
14,
9288,
62,
4215,
9806,
13,
20362,
27,
456,
62,
30783,
29,
16,
12,
940,
198,
3500,
9678,
17,
53,
721,
198,
3500,
7308,
13,
14402,
198,
3500,
3082,
265,
198,
198,
7890,
62,
15908,
796,
4654,
6978,
7,
47,
10... | 2.115044 | 565 |
<gh_stars>10-100
import Distributions: Dirichlet
# draw random stochastic matrix
rsm(dx::Int,dy::Int)=mapslices(x->rand(Dirichlet(x)),ones(dx,dy),2)
rsm(k::Int)=rsm(k,k)
# draw a sparse random stochastic matrix
function rssm(dim::Int,density=.2)
m=Array(Float64,(dim,dim))
for i=1:dim
m[i,:]=Base.sprand(1,dim,dens... | [
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
11748,
46567,
507,
25,
36202,
488,
1616,
198,
198,
2,
3197,
4738,
3995,
354,
3477,
17593,
198,
3808,
76,
7,
34350,
3712,
5317,
11,
9892,
3712,
5317,
47505,
31803,
677,
274,
7,
87,
3784,
... | 1.806342 | 883 |
<reponame>tetsugps/julia
module ViewHelper
using Genie, Genie.Helpers, SearchLight, Genie.Router
export output_flash, book_cover, book_form_uri
function output_flash(params::Dict{Symbol,Any}) :: String
! isempty( flash(params) ) ? """<div class="form-group alert alert-info">$(flash(params))</div>""" : ""
end
func... | [
27,
7856,
261,
480,
29,
83,
1039,
1018,
862,
14,
73,
43640,
198,
21412,
3582,
47429,
198,
198,
3500,
49405,
11,
49405,
13,
12621,
19276,
11,
11140,
15047,
11,
49405,
13,
49,
39605,
198,
198,
39344,
5072,
62,
34167,
11,
1492,
62,
963... | 2.725389 | 193 |
using Revise
using JuMP, EAGO
m = Model(optimizer_with_attributes(EAGO.Optimizer, "verbosity" => 1,
"output_iterations" => 1000,
"iteration_limit" => 100000,
"cp_... | [
3500,
5416,
786,
198,
3500,
12585,
7378,
11,
412,
4760,
46,
198,
198,
76,
796,
9104,
7,
40085,
7509,
62,
4480,
62,
1078,
7657,
7,
36,
4760,
46,
13,
27871,
320,
7509,
11,
366,
19011,
16579,
1,
5218,
352,
11,
198,
220,
220,
220,
2... | 1.442361 | 1,813 |
const CACHE_MODE = Symbol(uppercase(@load_preference("cache_mode", "DEFAULT")))
const CACHE_DIR = @load_preference(
"cache_dir", joinpath(DEPOT_PATH[1], "datadeps", "JuliaConSchedule")
)
const TIMEOUT = parse(Float64, @load_preference("timeout", "5.0"))
const TERMINAL_LINKS = parse(Bool, @load_preference("terminal_... | [
9979,
327,
2246,
13909,
62,
49058,
796,
38357,
7,
7211,
2798,
589,
7,
31,
2220,
62,
3866,
4288,
7203,
23870,
62,
14171,
1600,
366,
7206,
38865,
1,
22305,
198,
9979,
327,
2246,
13909,
62,
34720,
796,
2488,
2220,
62,
3866,
4288,
7,
19... | 2.610548 | 986 |
<filename>drawer_ex3.jl<gh_stars>0
#EXERCISE MADE BY <NAME> & <NAME>
# the packages we need
using Gtk, Graphics, Logging, Printf
include("affin_transformation.jl")
#File opening and reading matrix and vor together
A=readdlm("circle.txt", Float64)
#Reading and saving matrix size
s=size(A)
s1=s[1] #rows
s2=s[2] #column... | [
27,
34345,
29,
19334,
263,
62,
1069,
18,
13,
20362,
27,
456,
62,
30783,
29,
15,
198,
2,
6369,
47691,
24352,
337,
19266,
11050,
1279,
20608,
29,
1222,
1279,
20608,
29,
198,
2,
262,
10392,
356,
761,
198,
3500,
402,
30488,
11,
19840,
... | 1.997363 | 4,171 |
<gh_stars>1-10
using Base: Int64
using BioCCP
@testset "BioCCP" begin
n = 20
# Equal probabilities
p_uniform = ones(n)/n
# Probabilities following Zipf's law
ρ = 10
α = exp(log(ρ)/(n-1))
p_zipf = collect(α.^-(1:n))
p_zipf = p_zipf ./ sum(p_zipf)
@testset "Expectation" begin
... | [
27,
456,
62,
30783,
29,
16,
12,
940,
198,
3500,
7308,
25,
2558,
2414,
198,
3500,
16024,
4093,
47,
198,
31,
9288,
2617,
366,
42787,
4093,
47,
1,
2221,
198,
220,
220,
220,
220,
198,
220,
220,
220,
299,
796,
1160,
628,
220,
220,
22... | 2.178601 | 1,215 |
<reponame>wrs28/Iros.jl
module SelfEnergy1D
using ..BoundaryConditions
using ..Domains
using ..Points
using SparseArrays
import ..Symmetric, ..Unsymmetric
import LinearAlgebra: I
import ..SelfEnergy
function SelfEnergy{Symmetric}(domain::LatticeDomain{1,Symmetric}, α_half)
N = length(α_half)-1
a = domain.sh... | [
27,
7856,
261,
480,
29,
86,
3808,
2078,
14,
40,
4951,
13,
20362,
198,
21412,
12189,
28925,
16,
35,
198,
198,
3500,
11485,
49646,
560,
25559,
1756,
198,
3500,
11485,
24510,
1299,
198,
3500,
11485,
40710,
198,
3500,
1338,
17208,
3163,
2... | 1.615711 | 1,884 |
<filename>Basic/basicplot.jl
#!/usr/bin/env julia
using Plots, LaTeXStrings, Measures;
pyplot()
f(x, y) = x^2 + y^2
f0(x) = f(x, 0)
f2(x) = f(x, 2)
xVals, yVals = -5:0.1:5, -5:0.1:5
plot(
xVals,
[f0.(xVals), f2.(xVals)],
c = [:blue :red],
xlims = (-5, 5),
legend = :top,
ylims = (-5, 25),
ylabel = L"f(x,\... | [
27,
34345,
29,
26416,
14,
35487,
29487,
13,
20362,
198,
2,
48443,
14629,
14,
8800,
14,
24330,
474,
43640,
198,
3500,
1345,
1747,
11,
4689,
49568,
13290,
654,
11,
45040,
26,
198,
9078,
29487,
3419,
198,
69,
7,
87,
11,
331,
8,
796,
... | 1.815789 | 494 |
<reponame>KeitaNakamura/LazyCollections.jl
using LayeredArrays
using LayeredArrays: LazyLayeredArray
using Test
struct MyType{T} <: AbstractLayeredVector{1, T}
x::Vector{T}
end
Base.size(m::MyType) = size(m.x)
Base.getindex(m::MyType, i::Int) = getindex(m.x, i)
Base.setindex!(m::MyType, v, i::Int) = setindex!(m.x,... | [
27,
7856,
261,
480,
29,
8896,
5350,
45,
461,
37324,
14,
43,
12582,
5216,
26448,
13,
20362,
198,
3500,
18881,
1068,
3163,
20477,
198,
3500,
18881,
1068,
3163,
20477,
25,
406,
12582,
23763,
1068,
19182,
198,
3500,
6208,
198,
198,
7249,
... | 2.41954 | 174 |
module FooRouter
using HTTP
const r = HTTP.Router()
f = HTTP.Handlers.RequestHandlerFunction((req) -> HTTP.Response(200))
HTTP.@register(r, "/test", f)
end # module
| [
21412,
36080,
49,
39605,
198,
198,
3500,
14626,
198,
9979,
374,
796,
14626,
13,
49,
39605,
3419,
198,
69,
796,
14626,
13,
12885,
8116,
13,
18453,
25060,
22203,
19510,
42180,
8,
4613,
14626,
13,
31077,
7,
2167,
4008,
198,
40717,
13,
31... | 2.929825 | 57 |
<reponame>ashishdarekar/Modern-Wave-Propagation-Discontinuous-Galerkin-Julia<filename>src/equations.jl<gh_stars>0
"This abstract type needs to be implemented by all equations."
abstract type Equation end
"This abstract type needs to be implementred by all scenarios"
abstract type Scenario end
"""
This function initia... | [
27,
7856,
261,
480,
29,
1077,
680,
67,
533,
21070,
14,
31439,
12,
39709,
12,
24331,
363,
341,
12,
15642,
756,
259,
5623,
12,
26552,
263,
5116,
12,
16980,
544,
27,
34345,
29,
10677,
14,
4853,
602,
13,
20362,
27,
456,
62,
30783,
29,... | 2.666785 | 2,815 |
abstract type ProbabilisticFormula <: Formula end
struct ProbabilisticLiteral <: ProbabilisticFormula
prob::Float64
literal::Union{Literal,Proposition}
end
struct AnnotatedDisjunction <: ProbabilisticFormula
heads::Vector{ProbabilisticLiteral}
body::Union{Conj,Bool}
end
isprobabilisticfact(a::AnnotatedDis... | [
198,
397,
8709,
2099,
30873,
14991,
2569,
8479,
4712,
1279,
25,
19639,
886,
628,
198,
198,
7249,
30873,
14991,
2569,
43,
270,
1691,
1279,
25,
30873,
14991,
2569,
8479,
4712,
198,
197,
1676,
65,
3712,
43879,
2414,
198,
197,
18250,
1691,
... | 2.591489 | 235 |
include("learn_perceptron.jl")
using DataArrays
# create initial weight vector
w_init = randn(3,1);
# Create initial train data
train_data = @data([0.80857 0.83721;
0.35714 0.8505;
-0.75143 -0.7309;
-0.3 0.12625;
0.64286 -0.54485]);
tar... | [
17256,
7203,
35720,
62,
525,
984,
1313,
13,
20362,
4943,
198,
3500,
6060,
3163,
20477,
628,
198,
2,
2251,
4238,
3463,
15879,
198,
86,
62,
15003,
796,
43720,
77,
7,
18,
11,
16,
1776,
198,
198,
2,
13610,
4238,
4512,
1366,
198,
27432,
... | 2.214085 | 355 |
<reponame>hildebrandmw/Mapper2.jl<gh_stars>1-10
################################################################################
# NodeMap data structure.
################################################################################
# Keeps track of where nodes in the taskgraph are mapped to the architecture
# as we... | [
27,
7856,
261,
480,
29,
71,
44725,
17938,
76,
86,
14,
44,
11463,
17,
13,
20362,
27,
456,
62,
30783,
29,
16,
12,
940,
198,
29113,
29113,
14468,
198,
2,
19081,
13912,
1366,
4645,
13,
198,
29113,
29113,
14468,
198,
2,
9175,
82,
2610,... | 2.876296 | 1,447 |
export
get_matrix,
get_outcome_names,
set_definition,
set_number_of_outcomes,
is_nodetype_id
export DSL_DECISION, DSL_CHANCE, DSL_DETERMINISTIC, DSL_UTILITY, DSL_DISCRETE, DSL_CASTLOGIC,
DSL_DEMORGANLOGIC, DSL_NOISYMAXLOGIC, DSL_NOISYADDERLOGIC, DSL_PARENTSCONTIN,
DSL_SCC, DSL_DCHILDHPARENT, DSL_CONTI... | [
39344,
198,
197,
197,
1136,
62,
6759,
8609,
11,
198,
197,
197,
1136,
62,
448,
2958,
62,
14933,
11,
198,
197,
197,
2617,
62,
46758,
11,
198,
197,
197,
2617,
62,
17618,
62,
1659,
62,
448,
8988,
11,
198,
197,
197,
271,
62,
77,
375,... | 2.135955 | 2,111 |
# MIT license
# Copyright (c) Microsoft Corporation. All rights reserved.
# See LICENSE in the project root for full license information.
module Transforms
using StaticArrays: SVector, SMatrix
using LinearAlgebra: cross, normalize
# export Vec3,
# unitX3,
# unitY3,
# unitZ3,
# Vec4,
# unitX4,
# ... | [
2,
17168,
5964,
198,
2,
15069,
357,
66,
8,
5413,
10501,
13,
1439,
2489,
10395,
13,
198,
2,
4091,
38559,
24290,
287,
262,
1628,
6808,
329,
1336,
5964,
1321,
13,
198,
198,
21412,
3602,
23914,
198,
198,
3500,
36125,
3163,
20477,
25,
20... | 2.243811 | 9,614 |
<reponame>JuliaPackageMirrors/Luxor.jl
#!/usr/bin/env julia
using Luxor
function dot(pos)
gsave()
sethue("red")
circle(pos, 5, :fill)
grestore()
end
function showt(c, p, ha, va, n)
text(c, p, halign=ha, valign=va)
gsave()
setopacity(0.1)
text(string(n), p)
grestore()
end
function text_alig... | [
27,
7856,
261,
480,
29,
16980,
544,
27813,
27453,
5965,
14,
43,
2821,
273,
13,
20362,
198,
2,
48443,
14629,
14,
8800,
14,
24330,
474,
43640,
198,
198,
3500,
17145,
273,
198,
198,
8818,
16605,
7,
1930,
8,
198,
220,
220,
220,
308,
2... | 2.010169 | 590 |
<reponame>UnofficialJuliaMirror/PredictMD.jl-3e7d7328-36f8-4388-bd01-4613c92c7370
# function require_julia_version(varargs...)::VersionNumber
# current_julia_version = convert(VersionNumber, Base.VERSION)
# version_meets_requirements = does_given_version_meet_requirements(
# current_julia_version,
# ... | [
27,
7856,
261,
480,
29,
3118,
16841,
16980,
544,
27453,
1472,
14,
47,
17407,
12740,
13,
20362,
12,
18,
68,
22,
67,
4790,
2078,
12,
2623,
69,
23,
12,
19,
30460,
12,
17457,
486,
12,
3510,
1485,
66,
5892,
66,
4790,
2154,
198,
2,
21... | 1.968867 | 1,863 |
<filename>src/linalg/lazymul.jl
####
# This macro overrides mul! to call lazymul!
####
# support mul! by calling lazy mul
macro lazymul(Typ)
ret = quote
LinearAlgebra.mul!(dest::AbstractVector, A::$Typ, b::AbstractVector) =
copyto!(dest, LazyArrays.Mul(A,b))
LinearAlgebra.mul!(dest::A... | [
27,
34345,
29,
10677,
14,
75,
1292,
70,
14,
75,
1031,
4948,
377,
13,
20362,
198,
4242,
198,
2,
770,
15021,
23170,
1460,
35971,
0,
284,
869,
37296,
4948,
377,
0,
198,
4242,
628,
198,
2,
1104,
35971,
0,
416,
4585,
16931,
35971,
198,... | 1.934832 | 2,179 |
<filename>prof/permutedims.jl
using Knet, CUDA
pd_knet(y::KnetArray, x::KnetArray, perm) = permutedims!(y,x,perm)
pd_cpux(y::KnetArray, x::KnetArray, perm) = copyto!(y, permutedims(Array(x),perm))
pd_cuxx(y::KnetArray, x::KnetArray, perm) = (permutedims!(cu(y),cu(x),perm); y)
pd_kern(y::KnetArray, x::KnetArray, perm) ... | [
27,
34345,
29,
5577,
14,
16321,
7241,
12078,
13,
20362,
198,
3500,
509,
3262,
11,
29369,
5631,
198,
198,
30094,
62,
74,
3262,
7,
88,
3712,
42,
3262,
19182,
11,
2124,
3712,
42,
3262,
19182,
11,
9943,
8,
796,
9943,
7241,
12078,
0,
7... | 1.915838 | 1,307 |
# infinit
rstudy001,cstudy001=simpleprover("study/study001.cnf",12,3)
rstudy001n,cstudy001n=simpleprover("study/study001n.cnf",12,3)
rstudy001n2,cstudy001n2=simpleprover("study/study001n2.cnf",12,3)
rstudy001n3,cstudy001n3=simpleprover("study/study001n3.cnf",12,3)
# finite
rstudy002,cstudy002=simpleprover("study/study... | [
2,
1167,
15003,
198,
81,
44517,
8298,
11,
66,
44517,
8298,
28,
36439,
1676,
332,
7203,
44517,
14,
44517,
8298,
13,
31522,
69,
1600,
1065,
11,
18,
8,
198,
81,
44517,
8298,
77,
11,
66,
44517,
8298,
77,
28,
36439,
1676,
332,
7203,
44... | 2.293651 | 252 |
<filename>test/data_collector_test.jl
Random.seed!(223)
@testset "data_collector" begin
forest = model_initiation(f=0.05, d=0.8, p=0.01, griddims=(20, 20), seed=2);
agent_properties = [:status, :pos]
aggregators = [length, count]
steps_to_collect_data = collect(1:10);
data = step!(dummy_agent_step, fo... | [
27,
34345,
29,
9288,
14,
7890,
62,
33327,
273,
62,
9288,
13,
20362,
198,
29531,
13,
28826,
0,
7,
22047,
8,
201,
198,
201,
198,
31,
9288,
2617,
366,
7890,
62,
33327,
273,
1,
2221,
201,
198,
220,
8222,
796,
2746,
62,
15003,
3920,
... | 2.44586 | 314 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.