content stringlengths 6 1.03M | input_ids listlengths 4 535k | ratio_char_token float64 0.68 8.61 | token_count int64 4 535k |
|---|---|---|---|
using LinearAlgebra
# Define function and gradient
f(x) = x[1] + exp(x[2]-x[1]);
grad_f(z) = [1-exp(z[2]-z[1]), exp(z[2]-z[1])];
z = [1, 2];
f_hat(x) = f(z) + grad_f(z)'*(x-z);
# Compare f and f_hat for some specific x’s
f([1,2]), f_hat([1,2])
f([0.96,1.98]), f_hat([0.96,1.98])
f([0.96,1.98]), f_hat([0.96,1.98]... | [
3500,
44800,
2348,
29230,
198,
198,
2,
2896,
500,
2163,
290,
31312,
198,
69,
7,
87,
8,
796,
2124,
58,
16,
60,
1343,
1033,
7,
87,
58,
17,
45297,
87,
58,
16,
36563,
220,
198,
9744,
62,
69,
7,
89,
8,
796,
685,
16,
12,
11201,
7,... | 1.775956 | 183 |
<filename>src/primitives/testvalue.jl
using GeneralizedGenerated
using TupleVectors: chainvec
import MeasureTheory: testvalue
export testvalue
EmptyNTtype = NamedTuple{(),Tuple{}} where T<:Tuple
# function testvalue(d::ConditionalModel, N::Int)
# r = chainvec(testvalue(d), N)
# for j in 2:N
# @inbound... | [
27,
34345,
29,
10677,
14,
19795,
20288,
14,
9288,
8367,
13,
20362,
198,
3500,
3611,
1143,
8645,
515,
198,
3500,
309,
29291,
53,
478,
669,
25,
6333,
35138,
198,
11748,
24291,
464,
652,
25,
1332,
8367,
198,
198,
39344,
1332,
8367,
198,
... | 2.321809 | 752 |
<reponame>mjirik/LarSurf.jl
# include("../src/LarSurf.jl")
using LarSurf
import SparseArrays.spzeros
import SparseArrays.dropzeros!
using Plasm, SparseArrays
using LinearAlgebraicRepresentation
Lar = LinearAlgebraicRepresentation
# threshold = 4000
# pth = Pio3d.datasets_join_path("medical/orig/sample-data/nrn4.pk... | [
27,
7856,
261,
480,
29,
76,
73,
343,
1134,
14,
43,
283,
14214,
69,
13,
20362,
198,
198,
2,
2291,
7203,
40720,
10677,
14,
43,
283,
14214,
69,
13,
20362,
4943,
198,
198,
3500,
25577,
14214,
69,
198,
11748,
1338,
17208,
3163,
20477,
... | 2.33237 | 346 |
using BinningAnalysis
mutable struct Observables
energy::ErrorPropagator{Float64,32}
magnetization::LogBinner{Float64,32,BinningAnalysis.Variance{Float64}}
magnetizationVector::LogBinner{Vector{Float64},32,BinningAnalysis.Variance{Vector{Float64}}}
correlation::LogBinner{Vector{Float64},32,BinningAnaly... | [
3500,
20828,
768,
32750,
198,
198,
76,
18187,
2878,
19243,
2977,
198,
220,
220,
220,
2568,
3712,
12331,
24331,
363,
1352,
90,
43879,
2414,
11,
2624,
92,
198,
220,
220,
220,
19972,
1634,
3712,
11187,
33,
5083,
90,
43879,
2414,
11,
2624... | 2.860656 | 366 |
VERSION >= v"0.4.0-dev+6521" && __precompile__()
module Dierckx
using Compat
export Spline1D,
Spline2D,
evaluate,
derivative,
integrate,
roots,
evalgrid,
get_knots,
get_coeffs,
get_residual
import Base: show
unixpath = "../deps/src/ddierckx/libddierckx... | [
43717,
18189,
410,
1,
15,
13,
19,
13,
15,
12,
7959,
10,
2996,
2481,
1,
11405,
11593,
3866,
5589,
576,
834,
3419,
198,
198,
21412,
360,
959,
694,
87,
198,
198,
3500,
3082,
265,
198,
198,
39344,
13341,
500,
16,
35,
11,
198,
220,
2... | 2.011076 | 11,827 |
<filename>src/EasyStocks.jl
using Interpolations # To interpolate value function
using Expectations # To easily find expected values
using Distributions # To create normal stock returns =)
# Load files
include("model/Structs.jl")
include("model/Fundamentals.jl")
include("model/MainFunctions.jl")
| [
27,
34345,
29,
10677,
14,
28406,
1273,
3320,
13,
20362,
198,
198,
3500,
4225,
16104,
602,
1303,
1675,
39555,
378,
1988,
2163,
198,
3500,
23600,
602,
1303,
1675,
3538,
1064,
2938,
3815,
198,
3500,
46567,
507,
1303,
1675,
2251,
3487,
4283... | 3.614458 | 83 |
<filename>src/utilities/conveniencemethods.jl<gh_stars>0
##############################################################
### copying
##############################################################
import Base.copy
export copy, copy_estimate, GLRM
for T in :[Loss, Regularizer, AbstractGLRM].args
@eval function copy(r:... | [
27,
34345,
29,
10677,
14,
315,
2410,
14,
1102,
574,
1240,
24396,
82,
13,
20362,
27,
456,
62,
30783,
29,
15,
198,
29113,
14468,
7804,
4242,
2235,
198,
21017,
23345,
198,
29113,
14468,
7804,
4242,
2235,
198,
198,
11748,
7308,
13,
30073,... | 2.693376 | 936 |
@testset "SimpleCovariance" begin
v = simple()
@test sprint(show, v) == "Simple covariance estimator"
end
@testset "RobustCovariance" begin
v = robust()
@test sprint(show, v) == "Heteroskedasticity-robust covariance estimator"
end
@testset "ClusterCovariance" begin
@test_throws MethodError cluster... | [
31,
9288,
2617,
366,
26437,
34,
709,
2743,
590,
1,
2221,
198,
220,
220,
220,
410,
796,
2829,
3419,
198,
220,
220,
220,
2488,
9288,
18553,
7,
12860,
11,
410,
8,
6624,
366,
26437,
44829,
590,
3959,
1352,
1,
198,
437,
198,
198,
31,
... | 2.181604 | 424 |
<filename>test/testTotalCorrelation.jl<gh_stars>10-100
# Tests for the total correlation function
total_correlation = entropy1 + entropy2 + entropy3 - entropy123
# Test total correlation
@test get_total_correlation(arr1, arr2, arr3) ≈ total_correlation
println("Total correlation passed.")
# Test total correlation fo... | [
27,
34345,
29,
9288,
14,
9288,
14957,
10606,
49501,
13,
20362,
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
2,
30307,
329,
262,
2472,
16096,
2163,
198,
198,
23350,
62,
10215,
49501,
796,
40709,
16,
1343,
40709,
17,
1343,
40709,
18,
5... | 3.59542 | 131 |
<reponame>goedman/UnitfulOFU.jl<gh_stars>0
"""
```
macro ofu_str(unit)
```
String macro to easily recall oil-field units located in the `UnitfulOfu`
package. Although all unit symbols in that package are suffixed with `_ofu`,
the suffix should not be used when using this macro.
Note that what goes inside must be pars... | [
27,
7856,
261,
480,
29,
2188,
276,
805,
14,
26453,
913,
19238,
52,
13,
20362,
27,
456,
62,
30783,
29,
15,
198,
37811,
198,
15506,
63,
198,
20285,
305,
286,
84,
62,
2536,
7,
20850,
8,
198,
15506,
63,
198,
198,
10100,
15021,
284,
... | 2.211845 | 878 |
<gh_stars>0
sniffslope(df::DataFrameRate, σ::Quantity) = slope(smooth(df.sniff, σ; fs=df.fs))
function sniffgrams(sniff, tds::AbstractVector{TrialData}; fs=default_fs, sniffwindow=0s..2s, Δf=1/width(sniffwindow))
sgs = Matrix{eltype(sniff)}[]
freq = time = nothing
n = ceil(Int, convert(AbstractFloat, fs/Δf... | [
27,
456,
62,
30783,
29,
15,
198,
16184,
733,
6649,
3008,
7,
7568,
3712,
6601,
19778,
32184,
11,
18074,
225,
3712,
31208,
8,
796,
22638,
7,
5796,
5226,
7,
7568,
13,
16184,
733,
11,
18074,
225,
26,
43458,
28,
7568,
13,
9501,
4008,
1... | 2.162162 | 592 |
<gh_stars>100-1000
@testset "Find" begin
kmer = DNAMer("ACGAG")
bigkmer = BigDNAMer("ACGAG")
@test findnext(DNA_A, kmer, 1) == 1
@test findnext(DNA_C, kmer, 1) == 2
@test findnext(DNA_G, kmer, 1) == 3
@test findnext(DNA_T, kmer, 1) == nothing
@test findnext(DNA_A, kmer, 2) == 4
@te... | [
27,
456,
62,
30783,
29,
3064,
12,
12825,
198,
31,
9288,
2617,
366,
16742,
1,
2221,
198,
220,
220,
220,
479,
647,
796,
45080,
2390,
263,
7203,
2246,
38,
4760,
4943,
198,
220,
220,
220,
1263,
74,
647,
796,
4403,
35504,
2390,
263,
72... | 2.10241 | 830 |
<gh_stars>1-10
path = "/home/user/programming/GraphEvolve.jl/src/"
push!(LOAD_PATH, path)
using Documenter, GraphEvolve
makedocs(
sitename = "GraphEvolve.jl",
authors = "<NAME>",
pages = [
"Home" => "index.md"
"Manual" => Any[
"man/getting_started.md",
# "man/example... | [
27,
456,
62,
30783,
29,
16,
12,
940,
198,
6978,
796,
12813,
11195,
14,
7220,
14,
23065,
2229,
14,
37065,
15200,
6442,
13,
20362,
14,
10677,
30487,
198,
14689,
0,
7,
35613,
62,
34219,
11,
3108,
8,
198,
3500,
16854,
263,
11,
29681,
... | 1.877193 | 285 |
import Base:haslength
import Serialization
import Knet
import Photon.Layers: Layer
import Photon.Losses: Loss
export Workout, saveworkout, loadworkout, predict, train!, hasmetric,
freeze!, unfreeze!, validate, gradients, stop
# Callback niceties from Flux.jl
call_fn(f, xs...) = f(xs...)
runall(f) = f
runal... | [
11748,
7308,
25,
10134,
13664,
198,
11748,
23283,
1634,
198,
11748,
509,
3262,
198,
198,
11748,
5919,
261,
13,
43,
6962,
25,
34398,
198,
11748,
5919,
261,
13,
43,
793,
274,
25,
22014,
628,
198,
39344,
5521,
448,
11,
3613,
1818,
448,
... | 2.778166 | 3,151 |
<reponame>WaveProp/WaveProp
using Test
using WaveProp.Nystrom
using StaticArrays
@testset "Kernels" begin
pde = Helmholtz(;dim=3,k=1)
G = SingleLayerKernel(pde)
dG = DoubleLayerKernel(pde)
@test Nystrom.kernel_type(G) == Nystrom.SingleLayer()
@test Nystrom.kernel_type(dG) == Nystrom.DoubleLa... | [
27,
7856,
261,
480,
29,
39709,
24331,
14,
39709,
24331,
198,
3500,
6208,
198,
3500,
17084,
24331,
13,
45,
88,
20282,
198,
3500,
36125,
3163,
20477,
198,
198,
31,
9288,
2617,
366,
42,
44930,
1,
2221,
198,
220,
220,
220,
279,
2934,
22... | 2.21937 | 857 |
<filename>test/dw/Data_GAP_2.jl
# Dantzig-Wolfe Reformulation and Column Generation
# Data for General Assignment Problem 1
# <NAME>
# 2019.5.1
function getData()
vec_c = [#=
=# 9 9 1 4 6 4 2 3 5 1 9 9 7 6 3 #=
=# 9 1 8 6 7 8 2 6 6 5 3 4 7 5 3 #=
=# 4 8 1 8 1 4 1 4 2 6 2 1 2 5 1 #=
... | [
27,
34345,
29,
9288,
14,
67,
86,
14,
6601,
62,
38,
2969,
62,
17,
13,
20362,
198,
2,
360,
415,
38262,
12,
32069,
68,
17893,
1741,
290,
29201,
16588,
198,
2,
6060,
329,
3611,
50144,
20647,
352,
198,
2,
1279,
20608,
29,
198,
2,
131... | 1.95288 | 573 |
using XmlToDict
using Base.Test, DataStructures
# write your own tests here
@test 1 == 1
xmltest = """
<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
<book category="COOKING" tag="first">
<title lang="en">Everyday Italian</title>
<author><NAME></author>
<year>2005</year>
<price>30.00</price>
<... | [
3500,
1395,
4029,
2514,
35,
713,
198,
3500,
7308,
13,
14402,
11,
6060,
44909,
942,
198,
198,
2,
3551,
534,
898,
5254,
994,
198,
31,
9288,
352,
6624,
352,
198,
198,
87,
76,
2528,
395,
796,
37227,
198,
47934,
19875,
2196,
2625,
16,
... | 2.239008 | 887 |
<reponame>zyedidia/AnimatedPlots.jl
type Axis
axis::RectangleShape
marks::Array{RectangleShape}
numbers::Array{RenderText}
xaxis::Bool
number::RenderText
tic::RectangleShape
tic_period::Real
end
| [
27,
7856,
261,
480,
29,
7357,
276,
38513,
14,
2025,
15655,
3646,
1747,
13,
20362,
198,
4906,
38349,
198,
197,
22704,
3712,
45474,
9248,
33383,
198,
197,
14306,
3712,
19182,
90,
45474,
9248,
33383,
92,
198,
197,
77,
17024,
3712,
19182,
... | 2.706667 | 75 |
module MessyOutput
using OnlineStats, Base.Test, Distributions
x = randn(500)
x1 = randn(500)
x2 = randn(501)
xs = hcat(x1, x)
@testset "show methods" begin
display(Mean(x))
display(Means(xs))
display(Variance(x))
display(Variances(xs))
display(CovMatrix(xs))
display(Extrema(x))
display(Qu... | [
21412,
10626,
88,
26410,
198,
3500,
7467,
29668,
11,
7308,
13,
14402,
11,
46567,
507,
198,
198,
87,
796,
43720,
77,
7,
4059,
8,
198,
87,
16,
796,
43720,
77,
7,
4059,
8,
198,
87,
17,
796,
43720,
77,
7,
33548,
8,
198,
34223,
796,
... | 2.069668 | 933 |
<reponame>UnofficialJuliaMirror/TensorNetworkAD.jl-6b36f460-1d4e-5459-a8c4-3ab8f40f7d47
# using OMEinsum
using BackwardsLinalg
@doc raw"
trg(a, χ, niter)
return the partition-function of a two-dimensional system of size `2^niter`
described by the tensor `a` calculated via the tensor renormalization group
algorith... | [
27,
7856,
261,
480,
29,
3118,
16841,
16980,
544,
27453,
1472,
14,
51,
22854,
26245,
2885,
13,
20362,
12,
21,
65,
2623,
69,
34716,
12,
16,
67,
19,
68,
12,
20,
33459,
12,
64,
23,
66,
19,
12,
18,
397,
23,
69,
1821,
69,
22,
67,
... | 1.868644 | 708 |
<reponame>jmmshn/LeetCode.jl
# ---
# title: 720. Longest Word in Dictionary
# id: problem720
# author: <NAME>
# date: 2020-10-31
# difficulty: Easy
# categories: Hash Table, Trie
# link: <https://leetcode.com/problems/longest-word-in-dictionary/description/>
# hidden: true
# ---
#
# Given a list of strings `words` rep... | [
27,
7856,
261,
480,
29,
73,
76,
907,
21116,
14,
3123,
316,
10669,
13,
20362,
198,
2,
11420,
198,
2,
3670,
25,
26250,
13,
5882,
395,
9678,
287,
28261,
198,
2,
4686,
25,
1917,
23906,
198,
2,
1772,
25,
1279,
20608,
29,
198,
2,
3128... | 2.64557 | 553 |
<reponame>tylerjthomas9/NNlib.jl<gh_stars>0
"""
sparsemax(x; dims = 1)
[Sparsemax](https://arxiv.org/abs/1602.02068) turns input array `x`
into sparse probability distributions that sum to 1 along the dimensions specified by `dims`.
Similar to softmax, each dimension is considered independent. For a matrix input ... | [
27,
7856,
261,
480,
29,
774,
1754,
73,
400,
16911,
24,
14,
6144,
8019,
13,
20362,
27,
456,
62,
30783,
29,
15,
198,
37811,
198,
220,
220,
220,
29877,
9806,
7,
87,
26,
5391,
82,
796,
352,
8,
198,
198,
58,
50,
29572,
9806,
16151,
... | 2.117181 | 1,263 |
"""
Develop automatic differentiation (AD) support in Kinetic.jl
"""
using KitBase, ForwardDiff, ReverseDiff, BenchmarkTools, Plots
prim = [1.0, 0.0, 1.0]
vs = VSpace1D(-5, 5, 100)
# We build a unary Maxwellian function for testing.
Mu(u) = maxwellian(u, prim)
@btime fd = ForwardDiff.jacobian(Mu, vs.u)
@btime rd = ... | [
37811,
198,
19246,
11353,
32488,
357,
2885,
8,
1104,
287,
16645,
5139,
13,
20362,
198,
37811,
198,
198,
3500,
10897,
14881,
11,
19530,
28813,
11,
31849,
28813,
11,
25187,
4102,
33637,
11,
1345,
1747,
198,
198,
19795,
796,
685,
16,
13,
... | 2.549915 | 591 |
print("Hello world")
| [
4798,
7203,
15496,
995,
4943,
628,
198
] | 3.285714 | 7 |
<reponame>UnofficialJuliaMirror/SOFA.jl-ad3d3fd0-b5f2-51ee-b274-8cdbe62317e2<filename>src/tpors.jl
export iauTpors
"""
In the tangent plane projection, given the rectangular coordinates
of a star and its spherical coordinates, determine the spherical
coordinates of the tangent point.
This function is part of the Inter... | [
27,
7856,
261,
480,
29,
3118,
16841,
16980,
544,
27453,
1472,
14,
15821,
7708,
13,
20362,
12,
324,
18,
67,
18,
16344,
15,
12,
65,
20,
69,
17,
12,
4349,
1453,
12,
65,
28857,
12,
23,
10210,
1350,
46872,
1558,
68,
17,
27,
34345,
29... | 2.671419 | 1,543 |
<filename>src/projective.jl<gh_stars>0
#=--------------------------------------------------------------------
projective - Functions supporting projective geometry for computer vision.
Part of the ImageProjectiveGeometry Module
Copyright (c) 2016 <NAME>
<EMAIL>
Permission is hereby granted, free of charge, to any p... | [
27,
34345,
29,
10677,
14,
16302,
425,
13,
20362,
27,
456,
62,
30783,
29,
15,
198,
2,
28,
10097,
650,
198,
198,
16302,
425,
532,
40480,
6493,
1628,
425,
22939,
329,
3644,
5761,
13,
198,
198,
7841,
286,
262,
7412,
16775,
425,
10082,
... | 2.32608 | 21,599 |
# Script to transform data
using DataFrames, XLSX
# ---------- Load data --------------------------------------------------------------------------------------------------------
# File in ".xlsb" format, hence, need to transform manually into ".csv" first (download from http://www.wiod.org/database/wiots16)
url = "h... | [
2,
12327,
284,
6121,
1366,
198,
198,
3500,
6060,
35439,
11,
1395,
6561,
55,
198,
198,
2,
24200,
438,
8778,
1366,
16529,
3880,
982,
198,
198,
2,
9220,
287,
27071,
87,
7278,
65,
1,
5794,
11,
12891,
11,
761,
284,
6121,
14500,
656,
27... | 2.877265 | 1,214 |
<gh_stars>0
using ExprRules
using AbstractTrees
using BenchmarkTools
using Random
include("cas_theory.jl")
include("cas_simplify.jl")
grammar = @grammar begin
Real = x | y | z | a | b | c # symbol
Real = -Real
Real = Real * Real | Real + Real | Real - Real | Real / Real # julia expression
... | [
27,
456,
62,
30783,
29,
15,
198,
3500,
1475,
1050,
37766,
198,
3500,
27741,
51,
6037,
198,
198,
3500,
25187,
4102,
33637,
198,
3500,
14534,
198,
198,
17256,
7203,
34004,
62,
1169,
652,
13,
20362,
4943,
198,
17256,
7203,
34004,
62,
143... | 2.064039 | 812 |
<reponame>lkapelevich/RegressionBenchmarks.jl
# This file was copied from https://github.com/jeanpauphilet/SubsetSelectionCIO.jl
# as at commit a21d34652e0349a6b6f33e9c926ffad659d05e26
struct UnsetSolver <: MathProgBase.AbstractMathProgSolver end
function getsolver(s::Type{S}, tl::Float64) where {S <: MathProgBase.Abs... | [
27,
7856,
261,
480,
29,
75,
74,
1758,
2768,
488,
14,
8081,
2234,
44199,
14306,
13,
20362,
198,
2,
770,
2393,
373,
18984,
422,
3740,
1378,
12567,
13,
785,
14,
73,
11025,
79,
559,
746,
41550,
14,
7004,
2617,
4653,
1564,
34,
9399,
13... | 2.350334 | 1,647 |
t#
# Benchmark example
#
using DirectConvolution
using DSP, BenchmarkTools,LinearAlgebra
# function bench_directconv(filter,signal)
# wrapped_filter = LinearFilter(filter,0)
# convolved = directConv(wrapped_filter,signal)
# convolved
# end
function bench_directconv(filter,signal)
convolved = similar(s... | [
83,
2,
198,
2,
25187,
4102,
1672,
198,
2,
198,
3500,
4128,
3103,
85,
2122,
198,
3500,
360,
4303,
11,
25187,
4102,
33637,
11,
14993,
451,
2348,
29230,
198,
198,
2,
2163,
7624,
62,
12942,
42946,
7,
24455,
11,
12683,
282,
8,
198,
2,
... | 2.40367 | 654 |
<reponame>fukumaru0710/JuliaMBD.jl
"""
ArithmeticBlocks
"""
export ProductBlock
mutable struct ProductBlock <: AbstractArithmeticBlock
inport::Vector{InPort}
outport::Vector{OutPort}
function ProductBlock()
@createblock new(Vector{InPort}(), Vector{OutPort}()) 2 1
end
end
"""
IO
"""
functi... | [
27,
7856,
261,
480,
29,
69,
2724,
388,
11493,
2998,
940,
14,
16980,
544,
10744,
35,
13,
20362,
198,
37811,
198,
3163,
29848,
45356,
198,
37811,
198,
198,
39344,
8721,
12235,
198,
198,
76,
18187,
2878,
8721,
12235,
1279,
25,
27741,
316... | 2.495238 | 210 |
<reponame>UnofficialJuliaMirror/Ant.jl-fc2879f5-75d7-582e-8603-c64deb99b744
#!/usr/bin/env julia
#=
Common struct
del2z <<EMAIL>>
=#
module Data
include("loader.jl")
end
| [
27,
7856,
261,
480,
29,
3118,
16841,
16980,
544,
27453,
1472,
14,
13217,
13,
20362,
12,
16072,
2078,
3720,
69,
20,
12,
2425,
67,
22,
12,
46044,
68,
12,
23,
35642,
12,
66,
2414,
11275,
2079,
65,
22,
2598,
198,
2,
48443,
14629,
14,
... | 2.15 | 80 |
"""
GraphEdge
# Examples
```julia
function draw(;position_1, position_2, line_width=5)
setline(line_width)
line(position_1, position_2, action=:stroke)
return O
end
function e(g, node1, node2, attr)
return g[node1][node2]
end
# g mimics an adjacency list with edge weights
g = [Dict(2=>5),
Dic... | [
37811,
198,
220,
220,
220,
29681,
37021,
198,
198,
2,
21066,
198,
15506,
63,
73,
43640,
198,
8818,
3197,
7,
26,
9150,
62,
16,
11,
2292,
62,
17,
11,
1627,
62,
10394,
28,
20,
8,
198,
220,
220,
220,
900,
1370,
7,
1370,
62,
10394,
... | 2.348837 | 2,064 |
<gh_stars>0
@doc raw"""
device_range(psi_container::PSIContainer,
range_data::Vector{DeviceRange},
cons_name::Symbol,
var_name::Symbol)
Constructs min/max range constraint from device variable.
# Constraints
If min and max within an epsilon width:
``` variable[n... | [
27,
456,
62,
30783,
29,
15,
198,
31,
15390,
8246,
37811,
198,
220,
220,
220,
3335,
62,
9521,
7,
862,
72,
62,
34924,
3712,
3705,
2149,
756,
10613,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220... | 2.184251 | 3,924 |
<filename>build_tarballs.jl<gh_stars>0
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder
name = "Clipper"
version = v"1.0.0"
# Collection of sources required to build Clipper
sources = [
"https://github.com/Si... | [
27,
34345,
29,
11249,
62,
18870,
21591,
13,
20362,
27,
456,
62,
30783,
29,
15,
198,
2,
5740,
326,
428,
4226,
460,
2453,
617,
3614,
3141,
12,
1370,
7159,
11,
1057,
198,
2,
4600,
73,
43640,
1382,
62,
18870,
21591,
13,
20362,
1377,
1... | 2.551181 | 635 |
<reponame>chengchingwen/Raylib.jl
using Raylib_jll
struct RayColor
r::Cuchar
g::Cuchar
b::Cuchar
a::Cuchar
end
const RAYWHITE = RayColor(245, 245, 245, 255)
const LIGHTGRAY = RayColor(200, 200, 200, 255)
const DARKGRAY = RayColor(80, 80, 80, 255)
const MAROON = RayColor(190, 33, 55, 255)
const RED = R... | [
27,
7856,
261,
480,
29,
2395,
782,
10813,
21006,
14,
19591,
8019,
13,
20362,
198,
3500,
7760,
8019,
62,
73,
297,
198,
198,
7249,
7760,
10258,
198,
220,
220,
220,
374,
3712,
34,
794,
283,
198,
220,
220,
220,
308,
3712,
34,
794,
283... | 2.06019 | 947 |
"""
OGRStyleMgr factory.
### Parameters
* `styletable`: OGRStyleTable or NULL if not working with a style table.
### Returns
an handle to the new style manager object.
"""
unsafe_createstylemanager(styletable = GDALStyleTable(C_NULL)) =
StyleManager(GDAL.sm_create(styletable))
"""
Destroy Style Manager.
### Par... | [
37811,
198,
7730,
6998,
774,
293,
44,
2164,
8860,
13,
198,
198,
21017,
40117,
198,
9,
4600,
34365,
1616,
540,
63,
25,
34498,
6998,
774,
293,
10962,
393,
15697,
611,
407,
1762,
351,
257,
3918,
3084,
13,
198,
198,
21017,
16409,
198,
2... | 2.940617 | 3,890 |
<filename>test/hrbf_2d.jl
using SpatialFields
using Base.Test
function hrbf_2d()
points = SVector{2, Float64}[[1; 0], [0; 1], [-1; 0], [0; -1]]
normals = SVector{2, Float64}[[1; 1], [0; 1], [-1; 1], [0; -1]]
field = HermiteRadialField(points, normals)
X = linspace(-2, 2)
Y = linspace(-2, 2)
Z = zeros(length(X)... | [
27,
34345,
29,
9288,
14,
11840,
19881,
62,
17,
67,
13,
20362,
198,
3500,
1338,
34961,
15878,
82,
198,
3500,
7308,
13,
14402,
198,
198,
8818,
39436,
19881,
62,
17,
67,
3419,
198,
197,
13033,
796,
20546,
9250,
90,
17,
11,
48436,
2414,... | 2.062016 | 387 |
<gh_stars>0
function shapeobject(box::Box)
x,y,z = Tuple(box.xyz)
return GeometryTypes.HyperRectangle(Vec(-x/2,-y/2,-z/2),Vec(x,y,z))
end
function shapeobject(cylinder::Cylinder)
r,h = Tuple(cylinder.rh)
return GeometryTypes.Cylinder(Point(0.0,0.0,-h/2),Point(0.0,0.0,h/2), r)
end
function shapeobject(... | [
27,
456,
62,
30783,
29,
15,
198,
8818,
5485,
15252,
7,
3524,
3712,
14253,
8,
198,
220,
220,
220,
2124,
11,
88,
11,
89,
796,
309,
29291,
7,
3524,
13,
5431,
89,
8,
198,
220,
220,
220,
1441,
2269,
15748,
31431,
13,
38197,
45474,
92... | 2.09003 | 1,344 |
<filename>examples/parallel/simulation3d.jl
if !isdefined(:runtests)
addprocs(1)
end
srand(888)
description = """
Example showing off how to run GLVisualize in a different process
and visualize objects created on the main process.
"""
const workerid = workers()[]
using Images, GeometryTypes, GLVisualize, Reacti... | [
27,
34345,
29,
1069,
12629,
14,
1845,
29363,
14,
14323,
1741,
18,
67,
13,
20362,
198,
361,
5145,
271,
23211,
7,
25,
81,
2797,
3558,
8,
198,
220,
220,
220,
751,
1676,
6359,
7,
16,
8,
198,
437,
198,
82,
25192,
7,
28011,
8,
198,
... | 2.467058 | 2,216 |
<reponame>GiggleLiu/LLLplus.jl
"""
Main module for `LLLplus.jl` -- lattice reduction and related tools for Julia.
As an example of the functions in the package, see [`lll`](@ref), which does
Lenstra–Lenstra–Lovász lattice reduction of a matrix.
"""
module LLLplus
using LinearAlgebra
using Printf
export
lll,
... | [
27,
7856,
261,
480,
29,
38,
24082,
43,
16115,
14,
3069,
43,
9541,
13,
20362,
198,
37811,
198,
13383,
8265,
329,
4600,
3069,
43,
9541,
13,
20362,
63,
1377,
47240,
501,
7741,
290,
3519,
4899,
329,
22300,
13,
198,
198,
1722,
281,
1672,... | 2.384298 | 484 |
<filename>X3_empirical.jl<gh_stars>0
using StatsBase
using Distributions
using StatPlots,Plots
using LaTeXStrings
include("self_confidence.jl")
# https://github.com/joshday/AverageShiftedHistograms.jl
# might be useful at some point
function hist_diff(h1::Histogram,h2::Histogram)
@assert length(h1.weights) == len... | [
27,
34345,
29,
55,
18,
62,
368,
4063,
605,
13,
20362,
27,
456,
62,
30783,
29,
15,
198,
3500,
20595,
14881,
198,
3500,
46567,
507,
198,
3500,
5133,
3646,
1747,
11,
3646,
1747,
198,
3500,
4689,
49568,
13290,
654,
198,
17256,
7203,
944... | 2.113176 | 3,013 |
module FluxModels
using DocStringExtensions
using Flux
using Flux: @functor
using Parameters
using ModelUtils
abstract type ModuleSpec end
include("./OutputSizes.jl")
using .OutputSizes
include("./activations.jl")
include("./layers.jl")
include("./blocks.jl")
include("./heads.jl")
include("./efficientnet.jl")
incl... | [
21412,
1610,
2821,
5841,
1424,
198,
198,
3500,
14432,
10100,
11627,
5736,
198,
3500,
1610,
2821,
198,
3500,
1610,
2821,
25,
2488,
12543,
2715,
198,
3500,
40117,
198,
3500,
9104,
18274,
4487,
198,
198,
397,
8709,
2099,
19937,
22882,
886,
... | 2.506912 | 217 |
<gh_stars>0
function MixtureModel(hmm::HMM)
sdists = hmm.A[1, :]
MixtureModel([hmm.B...], sdists)
end
function HMM(m::MixtureModel)
K = ncomponents(m)
a = probs(m)
A = repeat(permutedims(m.prior.p), K, 1)
B = m.components
HMM(a, A, B)
end
#
# function PeriodicHMM(vec_mix::Vector{MixtureMod... | [
27,
456,
62,
30783,
29,
15,
198,
198,
8818,
337,
9602,
17633,
7,
71,
3020,
3712,
39,
12038,
8,
198,
220,
220,
220,
45647,
1023,
796,
289,
3020,
13,
32,
58,
16,
11,
1058,
60,
198,
220,
220,
220,
337,
9602,
17633,
26933,
71,
3020,... | 1.998737 | 13,459 |
<filename>src/computations/transform.jl
#####################
# Generic transforms
#####################
# A function set can have several associated transforms. The default transform is
# associated with the grid of the set, e.g. the FFT and the DCTII for Chebyshev expansions
# which convert between coefficient spac... | [
27,
34345,
29,
10677,
14,
785,
1996,
602,
14,
35636,
13,
20362,
198,
198,
14468,
4242,
2,
198,
2,
42044,
31408,
198,
14468,
4242,
2,
198,
198,
2,
317,
2163,
900,
460,
423,
1811,
3917,
31408,
13,
383,
4277,
6121,
318,
198,
2,
3917,... | 3.482112 | 587 |
using Plots
using StaticArrays
# include("gp.jl")
# include("errors.jl")
function train_validate_test(𝒟_train, 𝒟_validate, 𝒟_test, problem; log_γs=-1.0:0.1:1.0, distances=[euclidean_distance, derivative_distance, antiderivative_distance],descriptor="")
# Train GP on the filenames in train;
# Optimize hyper... | [
3500,
1345,
1747,
198,
3500,
36125,
3163,
20477,
198,
198,
2,
2291,
7203,
31197,
13,
20362,
4943,
198,
2,
2291,
7203,
48277,
13,
20362,
4943,
198,
198,
8818,
4512,
62,
12102,
378,
62,
9288,
7,
47728,
240,
253,
62,
27432,
11,
220,
47... | 2.190083 | 3,872 |
using SearchLight, Chirps
### Your tests here
@test 1 == 1
@show "foo bar"
| [
3500,
11140,
15047,
11,
609,
343,
862,
198,
198,
21017,
3406,
5254,
994,
198,
31,
9288,
352,
6624,
352,
198,
198,
31,
12860,
366,
21943,
2318,
1,
198
] | 2.75 | 28 |
CachedOperator(::Type{Matrix},op::Operator;padding::Bool=false) =
CachedOperator(op,Array{eltype(op)}(0,0),padding)
# Grow cached operator
function resizedata!(B::CachedOperator{T,Matrix{T}},n::Integer,m::Integer) where T<:Number
if n > size(B,1) || m > size(B,2)
throw(ArgumentError("Cannot resize be... | [
34,
2317,
18843,
1352,
7,
3712,
6030,
90,
46912,
5512,
404,
3712,
18843,
1352,
26,
39231,
3712,
33,
970,
28,
9562,
8,
796,
198,
220,
220,
220,
327,
2317,
18843,
1352,
7,
404,
11,
19182,
90,
417,
4906,
7,
404,
38165,
7,
15,
11,
1... | 1.719106 | 2,104 |
<filename>test/runtests.jl<gh_stars>0
using PSMV
@static if VERSION < v"0.7.0-DEV.2005"
using Base.Test
else
using Test
end
# write your own tests here
n = 2*10^5
A = sprand(n, n, 0.0005)
x = rand(n)
C = PSMV.MultithreadedTransMatVec(A, A')
@show @test norm(A*x - C*x) < 1e-10
C = PSMV.MultithreadedMatVec(A,... | [
27,
34345,
29,
9288,
14,
81,
2797,
3558,
13,
20362,
27,
456,
62,
30783,
29,
15,
198,
3500,
6599,
44,
53,
198,
31,
12708,
611,
44156,
2849,
1279,
410,
1,
15,
13,
22,
13,
15,
12,
39345,
13,
14315,
1,
198,
220,
220,
220,
1262,
73... | 2.01676 | 179 |
<gh_stars>0
check_list = [
:h,
:hbar,
:ħ,
:sigmao,
:sigmax,
:sigmay,
:sigmaz,
:σ₀,
:σ₁,
:σ₂,
:σ₃
]
for each_symbol in check_list
@test isdefined(each_symbol)
end | [
27,
456,
62,
30783,
29,
15,
198,
9122,
62,
4868,
796,
685,
198,
220,
220,
220,
1058,
71,
11,
198,
220,
220,
220,
1058,
71,
5657,
11,
198,
220,
220,
220,
1058,
128,
100,
11,
198,
220,
220,
220,
1058,
82,
13495,
78,
11,
198,
220... | 1.510791 | 139 |
#=
Filename: aiyagari_household.jl
Author: <NAME>
Date: 8/29/2016
This file defines the Household type (and its constructor)
for setting up an Aiyagari household problem.
=#
using QuantEcon
"""
Stores all the parameters that define the household's
problem.
##### Fields
- `r::Real` : interest rate
- `w::Real` : wag... | [
2,
28,
198,
35063,
25,
257,
7745,
363,
2743,
62,
4803,
2946,
13,
20362,
198,
13838,
25,
1279,
20608,
29,
198,
10430,
25,
807,
14,
1959,
14,
5304,
198,
198,
1212,
2393,
15738,
262,
37306,
2099,
357,
392,
663,
23772,
8,
198,
1640,
4... | 1.975835 | 1,945 |
<reponame>ArjunNarayanan/PolynomialBasis.jl
using Test
# using Revise
using PolynomialBasis
PB = PolynomialBasis
function allequal(v1, v2)
return all(v1 .≈ v2)
end
function f(v)
x = v[1]
y = v[2]
return x^3 + 3y^3 + 2x^2*y + 8x * y
end
function fx(v)
x = v[1]
y = v[2]
... | [
27,
7856,
261,
480,
29,
3163,
29741,
40059,
22931,
272,
14,
34220,
26601,
498,
15522,
271,
13,
20362,
198,
3500,
6208,
201,
198,
2,
1262,
5416,
786,
201,
198,
3500,
12280,
26601,
498,
15522,
271,
201,
198,
201,
198,
49079,
796,
12280,... | 1.780242 | 992 |
"""-----------------------------------------------------------------------------
This routine is the example in ImageFeatures.jl modified to use the HOFASM
method and diplay the matchings between the points. This method is primarily
included to provide a template for a visual interface for future
experimenta... | [
37811,
10097,
32501,
198,
220,
770,
8027,
318,
262,
1672,
287,
7412,
23595,
13,
20362,
9518,
284,
779,
262,
367,
19238,
1921,
44,
220,
198,
220,
2446,
290,
2566,
1759,
262,
2872,
654,
1022,
262,
2173,
13,
770,
2446,
318,
7525,
220,
... | 2.412707 | 7,051 |
<filename>test/solver/ldl.jl
@testset "Solver: LDL" begin
Random.seed!(100)
n = 50
d = 0.7
# Generate diffrent matrices with the same sparsity pattern
A0_ = sprand(n, n, d)
A1_ = deepcopy(A0_)
A1_.nzval[1:10] .+= 1.0
A0 = A0_ + A0_'
A1 = A1_ + A1_'
@test rank(A0) == n
@test ... | [
27,
34345,
29,
9288,
14,
82,
14375,
14,
335,
75,
13,
20362,
198,
31,
9288,
2617,
366,
50,
14375,
25,
37654,
1,
2221,
198,
220,
220,
220,
14534,
13,
28826,
0,
7,
3064,
8,
198,
220,
220,
220,
299,
796,
2026,
198,
220,
220,
220,
... | 1.914077 | 547 |
using CompScienceMeshes
using BEAST
m = CompScienceMeshes.tetmeshsphere(1.0, 0.45)
bnd_m = boundary(m)
m1 = skeleton(m,1)
X = BEAST.nedelecc3d(m,m1)
Y = BEAST.ttrace(X,bnd_m)
@assert length(geometry(Y)) == length(bnd_m)
| [
3500,
3082,
26959,
44,
274,
956,
198,
3500,
9348,
11262,
198,
198,
76,
796,
3082,
26959,
44,
274,
956,
13,
83,
316,
76,
5069,
2777,
1456,
7,
16,
13,
15,
11,
657,
13,
2231,
8,
198,
65,
358,
62,
76,
796,
18645,
7,
76,
8,
198,
... | 2.045872 | 109 |
<filename>src/flapreponse.jl
# This file solve the flap reponses of blades
function sflapre(ψ,λ_α,θ_cp,θ_lat,θ_lon) #staticflapre
# 其中θ应当输入平均值,例如mean(θ_cp)
γ_ = (ρ*8.2*(0.06)*R^4)/Iβ
μ = μ_air
F0 = 1+μ^2/2
F_B1 = μ
F_λ = 1
A0 = 2*μ
A_B1 = 1+3*μ^2/4
A_λ = μ
A_a1 = 1-μ^2/4
B_β0 = μ
B_... | [
27,
34345,
29,
10677,
14,
2704,
499,
7856,
2591,
13,
20362,
198,
2,
770,
2393,
8494,
262,
37699,
1128,
684,
274,
286,
20784,
201,
198,
8818,
264,
2704,
499,
260,
7,
139,
230,
11,
39377,
62,
17394,
11,
138,
116,
62,
13155,
11,
138,... | 1.318818 | 1,286 |
using Test
# choose what to test with Pkg.test("BetaML", test_args=["Trees","Clustering","all"])
nArgs = length(ARGS)
if "all" in ARGS
println("Running ALL tests available")
else
println("Running normal testing")
end
if "all" in ARGS || "Utils" in ARGS || nArgs == 0
include("Utils_tests.jl")
end
if "a... | [
3500,
6208,
198,
198,
2,
3853,
644,
284,
1332,
351,
220,
350,
10025,
13,
9288,
7203,
43303,
5805,
1600,
1332,
62,
22046,
28,
14692,
51,
6037,
2430,
2601,
436,
1586,
2430,
439,
8973,
8,
198,
198,
77,
42035,
796,
4129,
7,
1503,
14313,... | 2.533875 | 369 |
<reponame>PacktPublishing/Julia-for-data-science
Pkg.update()
Pkg.add("StatsBase")
using StatsBase
using RDatasets
iris_dataframe = dataset("datasets", "iris")
sample(iris_dataframe[:SepalLength], 5)
| [
27,
7856,
261,
480,
29,
11869,
83,
14876,
20020,
14,
16980,
544,
12,
1640,
12,
7890,
12,
16801,
198,
47,
10025,
13,
19119,
3419,
198,
47,
10025,
13,
2860,
7203,
29668,
14881,
4943,
198,
3500,
20595,
14881,
198,
3500,
371,
27354,
292,
... | 2.702703 | 74 |
using .CUDA
change_vector_eltype(S0::Type{<:CUDA.CuVector}, T) = S0.name.wrapper{T, 1, CUDA.Mem.DeviceBuffer}
convert_mat(M::CUDA.CUSPARSE.CuSparseMatrixCSC, T) = CUDA.CUSPARSE.CuSparseMatrixCSC(
convert(CUDA.CuArray{Int, 1, CUDA.Mem.DeviceBuffer}, M.colPtr),
convert(CUDA.CuArray{Int, 1, CUDA.Mem.DeviceBuffer}, M... | [
3500,
764,
43633,
5631,
198,
198,
3803,
62,
31364,
62,
417,
4906,
7,
50,
15,
3712,
6030,
90,
27,
25,
43633,
5631,
13,
46141,
38469,
5512,
309,
8,
796,
311,
15,
13,
3672,
13,
48553,
90,
51,
11,
352,
11,
29369,
5631,
13,
13579,
13... | 2.062381 | 2,100 |
import AutoryBroadcastMacros
AutoryBroadcastMacros.runtests() | [
11748,
5231,
652,
30507,
2701,
14155,
4951,
198,
16541,
652,
30507,
2701,
14155,
4951,
13,
81,
2797,
3558,
3419
] | 3.210526 | 19 |
<filename>src/code_instead.jl
# All code is attached to its underlying database source
struct SourceCode{Source}
source::Source
code::Expr
end
# Every time `SourceCode` objects are combined, check to see whether they all come from the same source
function pop_source!(sources, something)
something
end
funct... | [
27,
34345,
29,
10677,
14,
8189,
62,
38070,
13,
20362,
198,
2,
1439,
2438,
318,
7223,
284,
663,
10238,
6831,
2723,
198,
7249,
8090,
10669,
90,
7416,
92,
198,
220,
220,
220,
2723,
3712,
7416,
198,
220,
220,
220,
2438,
3712,
3109,
1050... | 3.026538 | 1,658 |
function normalize_theta!(scales::AbstractArray, θ::AbstractArray)
@assert length(scales) == size(θ, 1)
@inbounds for (i, ti) in enumerate(eachrow(θ))
scales[i] = norm(ti, 2)
normalize!(ti, 2)
end
return
end
function rescale_xi!(Ξ::AbstractArray, scales::AbstractArray)
@assert lengt... | [
8818,
3487,
1096,
62,
1169,
8326,
0,
7,
1416,
2040,
3712,
23839,
19182,
11,
7377,
116,
3712,
23839,
19182,
8,
198,
220,
220,
220,
2488,
30493,
4129,
7,
1416,
2040,
8,
6624,
2546,
7,
138,
116,
11,
352,
8,
198,
220,
220,
220,
2488,
... | 2.595578 | 3,573 |
<filename>test/runtests.jl
using LinearAlgebra: Matrix
using CompressingSolvers
using LinearAlgebra
using Test
using Plots
@testset "CompressingSolvers.jl" begin
# Write your tests here.
# Testing domain.jl
@testset "domain.jl" begin
include("test_domains.jl")
end
# Testing creating_problem... | [
27,
34345,
29,
9288,
14,
81,
2797,
3558,
13,
20362,
198,
3500,
44800,
2348,
29230,
25,
24936,
198,
3500,
3082,
11697,
36949,
690,
198,
3500,
44800,
2348,
29230,
198,
3500,
6208,
198,
3500,
1345,
1747,
198,
198,
31,
9288,
2617,
366,
72... | 2.572864 | 199 |
<gh_stars>10-100
@testset "L-BFGS ($T)" for T in [Float32, Float64, Complex{Float32}, Complex{Float64}]
using LinearAlgebra
using ProximalAlgorithms: LBFGS, update!
using RecursiveArrayTools: ArrayPartition, unpack
Q = T[
32.0000 13.1000 -4.9000 -3.0000 6.0000 2.2000 2.6000 3.4000 -1.9000 -7.50... | [
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
31,
9288,
2617,
366,
43,
12,
29499,
14313,
7198,
51,
16725,
329,
309,
287,
685,
43879,
2624,
11,
48436,
2414,
11,
19157,
90,
43879,
2624,
5512,
19157,
90,
43879,
2414,
92,
60,
198,
220,
... | 1.587259 | 3,014 |
"""
topofile, topotype, ntopo = topodata("simlation/path/_output"::AbstractString)
topofile, topotype, ntopo = topodata("simlation/path/_output/topo.data"::AbstractString)
read topo.data
"""
function topodata(outdir::AbstractString)
# filename
filename = occursin("topo.data", basename(outdir)) ? outdir... | [
37811,
198,
220,
220,
220,
1353,
1659,
576,
11,
1353,
8690,
11,
299,
4852,
78,
796,
1353,
375,
1045,
7203,
14323,
7592,
14,
6978,
47835,
22915,
1298,
25,
23839,
10100,
8,
198,
220,
220,
220,
1353,
1659,
576,
11,
1353,
8690,
11,
299,... | 2.253464 | 3,969 |
module DiffusionDefinition
using Random, Trajectories
using LinearAlgebra, StaticArrays, SparseArrays
using MacroTools
using RecipesBase
using RecursiveArrayTools
using ForwardDiff
import ForwardDiff: Dual, Tag
const ℝ{N} = SVector{N,Float64}
include("types.jl")
include("stand... | [
21412,
10631,
4241,
36621,
628,
220,
220,
220,
1262,
14534,
11,
4759,
752,
1749,
198,
220,
220,
220,
1262,
44800,
2348,
29230,
11,
36125,
3163,
20477,
11,
1338,
17208,
3163,
20477,
198,
220,
220,
220,
1262,
42755,
33637,
198,
220,
220,
... | 2.845714 | 350 |
using CLArrays, GLVisualize, GeometryTypes, GLAbstraction, StaticArrays
TY = Float32
N = 1024
const h = TY(2*π/N)
const epsn = TY(h * .5)
const C = TY(2/epsn)
const tau = TY(epsn * h)
Tfinal = 50.
S(x,y) = exp(-x^2/0.1f0)*exp(-y^2/0.1f0)
ArrayType = CLArray
# real-space and reciprocal-space grids
# the real-s... | [
3500,
7852,
3163,
20477,
11,
10188,
36259,
1096,
11,
2269,
15748,
31431,
11,
10188,
4826,
301,
7861,
11,
36125,
3163,
20477,
198,
198,
9936,
796,
48436,
2624,
198,
45,
796,
28119,
198,
9979,
289,
220,
220,
220,
796,
24412,
7,
17,
9,
... | 2.254113 | 1,094 |
@testset "IArrays" begin
A = rand(5,4,3)
Aoneto = IArray(A);
r1 = range(.1, stop = .2, length=5)
r2 = ["a", "b", "c", "d"]
r3 = 2:4
ind1 = Index(r1)
ind2 = Index(r2)
ind3 = Index(r3)
Aindices = IArray(A, (r1, r2, r3));
Anamed = IArray(Aindices, (:a, :b, :c));
# TODO ensur... | [
31,
9288,
2617,
366,
40,
3163,
20477,
1,
2221,
628,
220,
220,
220,
317,
796,
43720,
7,
20,
11,
19,
11,
18,
8,
198,
220,
220,
220,
317,
261,
27206,
796,
314,
19182,
7,
32,
1776,
628,
220,
220,
220,
374,
16,
796,
2837,
7,
13,
... | 1.955232 | 1,921 |
"""Nice, but slower than the ForwardDiff approach"""
function _get_init_derivatives_mtk(prob, order)
# Output of size order+1
u0 = prob.u0
d = length(u0)
q = order
out = fill(zero(u0[1]), d*(q+1))
sys = modelingtoolkitize(prob)
t = sys.iv()
@derivatives D'~t
u = [s(t) for s in sys.s... | [
37811,
35284,
11,
475,
13611,
621,
262,
19530,
28813,
3164,
37811,
198,
8818,
4808,
1136,
62,
15003,
62,
1082,
452,
2929,
62,
16762,
74,
7,
1676,
65,
11,
1502,
8,
198,
220,
220,
220,
1303,
25235,
286,
2546,
1502,
10,
16,
198,
220,
... | 1.886329 | 1,302 |
<filename>test/DivTests.jl
@test simplify(:x/:x,Div)==1
@test simplify(@equ a=c*c/c).rhs==:c
@test simplify(@equ a=c^2/c).rhs==:c
@test simplify(:a^3.5/:a)==:a^2.5
E=@equ E=sqrt(p^2*c^2+m^2*c^4)
vars=@equs p=sqrt(2)*1e6/c m=0.5e6/c^2
r=E&vars[2]
@test r.rhs==Equations.Sqrt(:p*:p*:c*:c+2.5e11)
| [
27,
34345,
29,
9288,
14,
24095,
51,
3558,
13,
20362,
198,
31,
9288,
30276,
7,
25,
87,
14,
25,
87,
11,
24095,
8,
855,
16,
198,
198,
31,
9288,
30276,
7,
31,
4853,
257,
28,
66,
9,
66,
14,
66,
737,
81,
11994,
855,
25,
66,
198,
... | 1.591398 | 186 |
<gh_stars>10-100
@testset "trailer.jl" begin
@testset "StateObject{Int}()" begin
trailer = SeaPearl.Trailer()
reversibleInt = SeaPearl.StateObject{Int}(3, trailer)
@test reversibleInt.value == 3
@test reversibleInt.trailer == trailer
end
@testset "StateObject{Boo... | [
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
31,
9288,
2617,
366,
9535,
5329,
13,
20362,
1,
2221,
201,
198,
201,
198,
220,
220,
220,
2488,
9288,
2617,
366,
9012,
10267,
90,
5317,
92,
3419,
1,
2221,
201,
198,
220,
220,
220,
220,
2... | 2.107881 | 1,548 |
function f()
x = 10
while x > 0
print(x)
x = x - 1
end
end
f()
println()
| [
198,
8818,
277,
3419,
198,
220,
220,
220,
2124,
796,
838,
198,
220,
220,
220,
981,
2124,
1875,
657,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
796,
2124,
532,
352,
198,
... | 1.762712 | 59 |
module _Series
using Brainstorm
using Base.Test
include("reciprocal.jl")
include("sqrt.jl")
include("arctan.jl")
include("pi.jl")
include("euler.jl")
include("ln2.jl")
function test_all()
test_reciprocal_all()
test_sqrt_all()
test_arctan_all()
test_pi_all()
test_euler_all()
test_ln2_all()
end... | [
21412,
4808,
27996,
198,
198,
3500,
14842,
12135,
198,
3500,
7308,
13,
14402,
198,
198,
17256,
7203,
8344,
541,
43270,
13,
20362,
4943,
198,
17256,
7203,
31166,
17034,
13,
20362,
4943,
198,
17256,
7203,
283,
310,
272,
13,
20362,
4943,
1... | 2.27972 | 143 |
<filename>src/th-jit.jl<gh_stars>10-100
module ThJIT
using ..ThArrays
@static if Sys.islinux()
using LibTorchCAPI_jll
elseif Sys.isapple()
const libtorch_capi = :libtorch_capi
end
mutable struct CompilationUnit
mod::Ptr{Nothing}
owner::Ptr{Nothing}
function CompilationUnit(m::Ptr{Nothing}, o::Pt... | [
27,
34345,
29,
10677,
14,
400,
12,
45051,
13,
20362,
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
21412,
536,
41,
2043,
198,
198,
3500,
11485,
817,
3163,
20477,
198,
198,
31,
12708,
611,
311,
893,
13,
271,
23289,
3419,
198,
220,
22... | 2.262548 | 777 |
<reponame>JuliaTagBot/DMF.jl
# <NAME>
# 2019 January
# DMF Package
# Generates a realization of an ARMA process
"""
gen_arma_sequence(n = 100, ar_comp = [], ma_comp = [], arma_std = 1.0)
Generates a realization of an ARMA process
# Arguments
- `n`: Length of process
- `ar_comp`: List of AR Coefficients; one of this... | [
27,
7856,
261,
480,
29,
16980,
544,
24835,
20630,
14,
23127,
37,
13,
20362,
198,
2,
1279,
20608,
29,
198,
2,
13130,
3269,
198,
2,
14848,
37,
15717,
198,
2,
2980,
689,
257,
23258,
286,
281,
5923,
5673,
1429,
198,
198,
37811,
198,
1... | 2.454545 | 407 |
<filename>abstractTN.jl
# Author: <NAME>
# Feb 2022
using TensorOperations
using KrylovKit
using LinearAlgebra
using Random
using RandomMatrices
using JLD2, FileIO
using NPZ
abstract type AbstractTN end
"""
length(::MPS/MPO)
The number of sites of an MPS/MPO.
"""
Base.:length(m::AbstractTN) = m.N
data(m::Ab... | [
27,
34345,
29,
397,
8709,
46559,
13,
20362,
198,
2,
220,
220,
6434,
25,
1279,
20608,
29,
198,
2,
220,
220,
3158,
33160,
198,
198,
3500,
309,
22854,
18843,
602,
198,
3500,
41662,
27086,
20827,
198,
3500,
44800,
2348,
29230,
198,
3500,
... | 2.191843 | 662 |
using Test
using ProgressMeter
using LinearAlgebra
using Statistics
using SparseGaussianProcesses
# Random.seed!(0)
onfail(f, _::Test.Pass) = nothing
onfail(f, _::Tuple{Test.Fail,<:Any}) = f()
@testset "SparseGaussianProcesses" begin
@testset "hyperprior" begin
mean = [0.0,1.0]
stddev = [1.0,1.0]
hp = ... | [
3500,
6208,
198,
3500,
18387,
44,
2357,
198,
3500,
44800,
2348,
29230,
198,
3500,
14370,
198,
3500,
1338,
17208,
35389,
31562,
18709,
274,
198,
2,
14534,
13,
28826,
0,
7,
15,
8,
198,
198,
261,
32165,
7,
69,
11,
4808,
3712,
14402,
13... | 1.731784 | 3,829 |
using Pkg
Pkg.instantiate()
using PkgDev
try
version_arg = ARGS[3]
new_version = nothing
if version_arg=="Next"
new_version = nothing
elseif version_arg=="Major"
new_version = :major
elseif version_arg=="Minor"
new_version = :minor
elseif version_arg=="Patch"
... | [
3500,
350,
10025,
198,
198,
47,
10025,
13,
8625,
415,
9386,
3419,
198,
198,
3500,
350,
10025,
13603,
198,
198,
28311,
198,
220,
220,
220,
2196,
62,
853,
796,
5923,
14313,
58,
18,
60,
198,
220,
220,
220,
649,
62,
9641,
796,
2147,
6... | 2.351351 | 259 |
<filename>Solutions/problem46_findlongestpalindrome.jl<gh_stars>0
#=
Given a string, find the longest palindromic contiguous substring. If there are more than one with the maximum length, return any one.
For example, the longest palindromic substring of "aabcdcb" is "bcdcb". The longest palindromic substring of "banan... | [
27,
34345,
29,
50,
14191,
14,
45573,
3510,
62,
19796,
6511,
395,
18596,
521,
5998,
13,
20362,
27,
456,
62,
30783,
29,
15,
198,
2,
28,
198,
15056,
257,
4731,
11,
1064,
262,
14069,
6340,
521,
398,
291,
48627,
3293,
1806,
13,
1002,
6... | 2.268698 | 722 |
using ComplexMixtures
using PDBTools
using Plots
using LaTeXStrings
using EasyFit
function fig() # to simplify globals
# Plot defaults
plot_font = "Computer Modern"
default(
fontfamily=plot_font,
linewidth=2.5,
framestyle=:box,
label=nothing,
grid=false,
palette=:tab10
)
scalefontsizes(); s... | [
3500,
19157,
44,
25506,
198,
3500,
350,
11012,
33637,
198,
3500,
1345,
1747,
198,
3500,
4689,
49568,
13290,
654,
198,
3500,
16789,
31805,
198,
198,
8818,
2336,
3419,
1303,
284,
30276,
15095,
874,
198,
198,
2,
28114,
26235,
198,
29487,
6... | 2.041447 | 4,560 |
<reponame>dcjones/GatedLinearNetworks.jl
"""
Aitchison GLN layer with arbitrary number of units.
"""
struct AGLNLayer{
MF <: AbstractMatrix{<:Real},
VF <: AbstractVector{<:Real},
VI <: AbstractVector{Int32}}
input_dim::Int
output_dim::Int
context_dim::Int
predictor_dim::Int
... | [
27,
7856,
261,
480,
29,
17896,
73,
1952,
14,
38,
515,
14993,
451,
7934,
5225,
13,
20362,
198,
198,
37811,
198,
32,
2007,
1653,
10188,
45,
7679,
351,
14977,
1271,
286,
4991,
13,
198,
37811,
198,
7249,
317,
8763,
32572,
2794,
90,
198,... | 2.398426 | 3,938 |
using sbl
using Test
@testset "sbl.jl" begin
# Write your tests here.
end
| [
3500,
264,
2436,
198,
3500,
6208,
198,
198,
31,
9288,
2617,
366,
82,
2436,
13,
20362,
1,
2221,
198,
220,
220,
220,
1303,
19430,
534,
5254,
994,
13,
198,
437,
198
] | 2.548387 | 31 |
<filename>abc161-170/abc165/a.jl
function solve()
k = parse(Int, readline())
a, b = [parse(Int, x) for x in split(readline())]
if (a ÷ k == b ÷ k) && a % k != 0
"NG"
else
"OK"
end
end
println(solve())
| [
27,
34345,
29,
39305,
25948,
12,
17279,
14,
39305,
20986,
14,
64,
13,
20362,
198,
8818,
8494,
3419,
198,
220,
220,
220,
479,
796,
21136,
7,
5317,
11,
1100,
1370,
28955,
198,
220,
220,
220,
257,
11,
275,
796,
685,
29572,
7,
5317,
1... | 2.008403 | 119 |
# Contains the configuration module, holding global settings for the package
"Configuration options"
module config
# Data directories
"The directory in which .jld data files are stored"
const datadir = normpath(joinpath(dirname(@__FILE__), "..", "data"))
"The directory in which raw data are stored in text format"
con... | [
2,
49850,
262,
8398,
8265,
11,
4769,
3298,
6460,
329,
262,
5301,
628,
198,
1,
38149,
3689,
1,
198,
21412,
4566,
198,
2,
6060,
29196,
198,
1,
464,
8619,
287,
543,
764,
73,
335,
1366,
3696,
389,
8574,
1,
198,
9979,
4818,
324,
343,
... | 3.585271 | 258 |
export initDropWav
export dropWav
"""
y = dropWav(wav::Array, fs::Real=16000.0; ratio::Real=0.05)
droping frames to simulate network packet loss.
"""
function dropWav(wav::Array, fs::Real=16000.0; ratio::Real=0.05)
ZERO = eltype(wav)(0.0)
winlen = floor(Int, 0.016 * fs) # 0.016毫秒一帧
fram... | [
39344,
2315,
26932,
54,
615,
198,
39344,
4268,
54,
615,
628,
198,
37811,
198,
220,
220,
220,
331,
796,
4268,
54,
615,
7,
45137,
3712,
19182,
11,
43458,
3712,
15633,
28,
1433,
830,
13,
15,
26,
8064,
3712,
15633,
28,
15,
13,
2713,
8... | 2.001859 | 538 |
<reponame>mcx/Dojo.jl<gh_stars>10-100
# ## Ghost
set_camera!(vis, cam_pos=[-1,1,0], zoom=1)
z_sim = get_maximal_state(storage)
timesteps = [5, 10, 15]# .+ 150
for t in timesteps
name = Symbol("robot_$t")
build_robot(mech, vis=vis, name=name, color= magenta_light)
z = z_sim[t]
set_robot(vis, mech, z, n... | [
27,
7856,
261,
480,
29,
23209,
87,
14,
5211,
7639,
13,
20362,
27,
456,
62,
30783,
29,
940,
12,
3064,
198,
2,
22492,
9897,
198,
2617,
62,
25695,
0,
7,
4703,
11,
12172,
62,
1930,
41888,
12,
16,
11,
16,
11,
15,
4357,
19792,
28,
1... | 1.992032 | 251 |
@testset "AlgAss" begin
include("AlgAss/AlgAss.jl")
include("AlgAss/AlgGrp.jl")
include("AlgAss/Elem.jl")
end
| [
31,
9288,
2617,
366,
2348,
70,
8021,
1,
2221,
198,
220,
2291,
7203,
2348,
70,
8021,
14,
2348,
70,
8021,
13,
20362,
4943,
198,
220,
2291,
7203,
2348,
70,
8021,
14,
2348,
70,
8642,
79,
13,
20362,
4943,
198,
220,
2291,
7203,
2348,
70... | 2.148148 | 54 |
<reponame>musm/Estrin.jl
module ParPoly
export @estrin, @horner_split, @horner_split_simd
using SIMD
include("estrin.jl")
macro horner_split_simd(t,p...)
x1 = gensym("x1")
x2 = gensym("x2")
x1x2 = gensym("x1x2")
x2x2 = gensym("x2x2")
blk = quote
T = typeof($(esc(t)))
$x1 = $... | [
27,
7856,
261,
480,
29,
14664,
76,
14,
36,
2536,
259,
13,
20362,
198,
21412,
2547,
34220,
198,
198,
39344,
2488,
395,
12769,
11,
2488,
17899,
1008,
62,
35312,
11,
2488,
17899,
1008,
62,
35312,
62,
14323,
67,
198,
3500,
23749,
35,
19... | 1.591241 | 1,233 |
# ops.jl - overloaded operators for constucting symbolic expressions.
#
# A couple of examples:
#
# :x ⊕ :y ==> :(x + y)
# 2 ⊗ :(x ⊕ y) ==> :(2 * (x + y))
# import Base: +, -, *, /, .+, .-, .*, ./
# ⊕(ex::Symbolic, v::Numeric) = :($ex + $v)
# ⊕(v::Numeric, ex::Symbolic) = :($v + $ex)
# ⊕(ex1::Symbolic, ... | [
198,
2,
39628,
13,
20362,
532,
50068,
12879,
329,
1500,
4782,
278,
18975,
14700,
13,
198,
2,
198,
2,
317,
3155,
286,
6096,
25,
198,
2,
198,
2,
220,
220,
220,
1058,
87,
2343,
232,
243,
1058,
88,
220,
220,
220,
220,
220,
6624,
29,... | 1.854167 | 1,008 |
<filename>src/charged_particle_3d/tokamak_small_cylindrical.jl
module TokamakSmallCylindrical
import ElectromagneticFields.AxisymmetricTokamakCylindrical
export charged_particle_3d_pode, charged_particle_3d_iode,
hamiltonian, toroidal_momentum
AxisymmetricTokamakCylindrical.@code() # inject ma... | [
27,
34345,
29,
10677,
14,
17200,
62,
3911,
1548,
62,
18,
67,
14,
83,
482,
321,
461,
62,
17470,
62,
38801,
521,
8143,
13,
20362,
198,
21412,
9453,
321,
461,
18712,
34,
2645,
521,
8143,
628,
220,
220,
220,
1330,
5903,
398,
25145,
15... | 2.129771 | 262 |
# TODO: writeup documentation
# Holder type for forward and backward plans, region, scalars etc..
# =================================================================
# Tf ≡ T_forward_arg
# Ti ≡ T_inverse_arg
struct FFTplan{Tf<:FFTN, d, Ti<:FFTN, Tsf<:Number, Tsi<:Number, FT<:Plan, IT<:Plan}
unscaled_forward_transf... | [
198,
2,
16926,
46,
25,
3551,
929,
10314,
198,
198,
2,
24210,
2099,
329,
2651,
290,
19528,
3352,
11,
3814,
11,
16578,
945,
3503,
492,
198,
2,
38093,
198,
2,
309,
69,
38243,
309,
62,
11813,
62,
853,
198,
2,
16953,
38243,
309,
62,
... | 2.143693 | 2,394 |
<gh_stars>0
if !isdefined(Main, :GenerateData)
function GenerateData(kappa,omega,Nsubj,Ntrials)
data = fill(0,Nsubj*Ntrials)
SubjIdx = similar(data)
cnt = 0
for subj in 1:Nsubj
alpha = kappa*omega
beta = (1-kappa)*omega
theta = rand(Beta(alpha,beta))
for trial in 1:Ntrials
... | [
27,
456,
62,
30783,
29,
15,
198,
361,
5145,
271,
23211,
7,
13383,
11,
1058,
8645,
378,
6601,
8,
198,
220,
2163,
2980,
378,
6601,
7,
74,
20975,
11,
462,
4908,
11,
45,
7266,
73,
11,
45,
28461,
874,
8,
198,
220,
220,
220,
1366,
7... | 1.985944 | 498 |
<filename>src/operators.jl
using QuantumOptics: projector, tensor, SparseOperator, DenseOperator, basisstate, Ket
using LinearAlgebra: diagm
import QuantumOptics: displace, thermalstate, coherentthermalstate, fockstate
export create, destroy, number, displace, coherentstate, coherentthermalstate, fockstate,
th... | [
27,
34345,
29,
10677,
14,
3575,
2024,
13,
20362,
198,
3500,
29082,
27871,
873,
25,
43396,
11,
11192,
273,
11,
1338,
17208,
18843,
1352,
11,
360,
1072,
18843,
1352,
11,
4308,
5219,
11,
43092,
198,
3500,
44800,
2348,
29230,
25,
2566,
36... | 2.330593 | 4,501 |
using Test
using DataWrangler
@testset "normalize" begin
# normalize! Vector
x = [1.,2,3,4,5]
normalize!(x)
@test x ≈ [-1.2649110640673518, -0.6324555320336759, 0.0, 0.6324555320336759, 1.2649110640673518]
x = [1.,2,3,4,5]
normalize!(x; method = "z-score")
@test x ≈ [-1.26491106406735... | [
3500,
6208,
198,
3500,
6060,
54,
36985,
1754,
198,
198,
31,
9288,
2617,
366,
11265,
1096,
1,
2221,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
3487,
1096,
0,
20650,
198,
220,
220,
220,
2124,
796,
685,
16,
1539,
17,
11,
18,
... | 1.845275 | 963 |
<filename>test/DB.jl
using AlgebraicRelations.DB
using SQLite
@present WorkplaceSchema <: TheorySQL begin
# Data tables
employee::Ob
emp_data::Attr(employee, Int)
name::Ob
name_data::Attr(name, String)
salary::Ob
sal_data::Attr(salary, Real)
# Relation tables
manager::Ob
emplm::Hom(manager... | [
27,
34345,
29,
9288,
14,
11012,
13,
20362,
198,
3500,
978,
29230,
291,
47117,
13,
11012,
198,
3500,
16363,
578,
198,
198,
31,
25579,
5521,
5372,
27054,
2611,
1279,
25,
17003,
17861,
2221,
198,
220,
1303,
6060,
8893,
198,
220,
6538,
37... | 2.463722 | 317 |
<reponame>Roger-luo/QMTK.jl<filename>test/Base/Space/SiteSpace.jl
using QMTK
using Compat.Test
@testset "Constructors" begin
space = SiteSpace(Bit, (2, 2); nflips=1)
@test israndomized(space) == true
typeof(space.data) <: Sites
space = SiteSpace(Spin, 2, 2; nflips=1)
@test israndomized(space) == ... | [
27,
7856,
261,
480,
29,
43719,
12,
2290,
78,
14,
48,
13752,
42,
13,
20362,
27,
34345,
29,
9288,
14,
14881,
14,
14106,
14,
29123,
14106,
13,
20362,
198,
3500,
1195,
13752,
42,
198,
3500,
3082,
265,
13,
14402,
198,
198,
31,
9288,
26... | 2.416667 | 384 |
#=
Copyright 2021 BlackRock, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... | [
2,
28,
198,
15269,
33448,
2619,
19665,
11,
3457,
13,
198,
198,
26656,
15385,
739,
262,
24843,
13789,
11,
10628,
362,
13,
15,
357,
1169,
366,
34156,
15341,
198,
5832,
743,
407,
779,
428,
2393,
2845,
287,
11846,
351,
262,
13789,
13,
1... | 2.432503 | 763 |
# g_memory_input_stream_new_from_data ()
# GInputStream *
# g_memory_input_stream_new_from_data (const void *data,
# gssize len,
# GDestroyNotify destroy);
# Creates a new GMemoryInputStream with data in memory of a given size.
# Parameters
# dat... | [
2,
308,
62,
31673,
62,
15414,
62,
5532,
62,
3605,
62,
6738,
62,
7890,
7499,
198,
2,
402,
20560,
12124,
1635,
198,
2,
308,
62,
31673,
62,
15414,
62,
5532,
62,
3605,
62,
6738,
62,
7890,
357,
9979,
7951,
1635,
7890,
11,
198,
2,
220... | 2.379242 | 501 |
<reponame>cosmofico97/Raytracing<filename>test/test_ReadingWriting.jl
# -*- encoding: utf-8 -*-
#
# The MIT License (MIT)
#
# Copyright © 2021 <NAME> and <NAME>
#
@testset "test_coordinates" begin
img = Raytracing.HDRimage(7, 4)
@test Raytracing.valid_coordinates(img, 0, 0)
@test Raytracing.valid_co... | [
27,
7856,
261,
480,
29,
6966,
76,
1659,
3713,
5607,
14,
19591,
2213,
4092,
27,
34345,
29,
9288,
14,
9288,
62,
36120,
33874,
13,
20362,
198,
2,
532,
9,
12,
21004,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
198,
2,
383,
17168,
13... | 1.963019 | 5,246 |
<reponame>davnn/CategoricalDistributions.jl<gh_stars>1-10
# # LOCAL DEFINITION OF SCITYPE
# This is to avoid making ScientificTypes a dependency.
function scitype(c::CategoricalValue)
nc = length(levels(c.pool))
return ifelse(c.pool.ordered, OrderedFactor{nc}, Multiclass{nc})
end
# # CLASSES
"""
class... | [
27,
7856,
261,
480,
29,
67,
615,
20471,
14,
34,
2397,
12409,
20344,
2455,
507,
13,
20362,
27,
456,
62,
30783,
29,
16,
12,
940,
198,
2,
1303,
37347,
1847,
5550,
20032,
17941,
3963,
6374,
9050,
11401,
198,
198,
2,
770,
318,
284,
336... | 2.472727 | 1,870 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.