code
stringlengths
2
1.05M
repo_name
stringlengths
5
101
path
stringlengths
4
991
language
stringclasses
3 values
license
stringclasses
5 values
size
int64
2
1.05M
module FactorAnalysis using Distributions export CFADistribution, rand, loglikelihood, dloglikelihood, fit_mle, fit_map include("sigma.jl") include("theta.jl") include("em.jl") include("utils.jl") #include("pgradient.jl") #include("em.jl") end # module
slundberg/FactorAnalysis.jl
src/FactorAnalysis.jl
Julia
mit
258
using ANMS using Base.Test const tol = 1e-8 let # rosenbrock function a = 1.0 b = 100.0 f = x -> (a - x[1])^2 + b*(x[2] - x[1]^2)^2 x₀ = [0., 0.] x, fmin = nelder_mead(f, x₀) @test norm(x .- [a, a]) < tol @test abs(fmin - 0.0) < tol end let # quadratic function f = x -> dot(x,...
bicycle1885/ANMS.jl
test/runtests.jl
Julia
mit
544
""" Low salinity water flooding model input: c_insitu: formation brine salinity, Real or Array c_inj: injection brine salinity, Real SW0: initial water saturation output: t_sec: production time rec_fact: recovery factor sw: final saturation profile """ function forced_imb_implicit(core_props, fluids_ls, flu...
simulkade/peteng
analytical/FractionalFlow/water_flood_fvm.jl
Julia
mit
9,688
# converted from crlibm function ieeedouble(xx::BigFloat) x=logabs=powermin=0.0 mantissa=exponent=expmin=expmax=expmiddle=powermax=powermiddle=infmantissa=0.0 sgn=0 set_bigfloat_precision(320) ; #Digits = 100; x = xx;#$evalf(xx); if (x==0) sgn, exponent, mantissa = 1, -1022, 0 els...
J-Sarnoff/FloatFloat.jl
src/type/nearest.jl
Julia
mit
2,320
function fib(c, d) a = 1 b = 1 for i in 3:c a, b = b, d*a + b end return b end # fib(n, k) = n < 2 ? n : fib(n - 1) + k*fib(n - 2) # fib(100, 4) function test() z = 0 while z < 1000001 fib(30, 3) z += 1 end end @time test()
polentozer/testing_0
julia/bench.jl
Julia
mit
283
module Filters include("Filters/firfilters.jl") export FIRFilter, createfirfilter include("Filters/iirfilters.jl") export IIRFilter, createiirfilter, butterworth, cheby1, cheby2, ellip, bessel export applyfilter, freqz function applyfilter(filt::IIRFilter, x::Float64) y = Cfloat[0]; ccall((:i...
devsprasad/LiquidSDR.jl
src/Filters.jl
Julia
mit
962
using Printf include("test_hb.jl")
JuliaSparse/HarwellRutherfordBoeing.jl
test/runtests.jl
Julia
mit
36
# struct Batch # product::Product # quantity::Float64 # start::DateTime # duration::TimePeriod # end """ Results from the production model. They are divided into three categories: * optimisation details: * `feasibility`: whether there is a solution (other categories make no sense otherwise) * `mo...
dourouc05/IndustrialProcessFlexibilisation.jl
src/model/results/production.jl
Julia
mit
2,442
# load JSON configuration files for channel and instrument parameters # # Copyright 2017 Raytheon BBN Technologies module config import ..yaml #import .yaml.load_file_relative cfg_folder = joinpath(Pkg.dir("QGL"), "cfg") cfg_path = joinpath(cfg_folder, "cfg_path.txt") # for simplicity here use single config file if ...
BBN-Q/QGL.jl
src/config.jl
Julia
apache-2.0
871
# Julia wrapper for header: /home/jared/build/petsc-3.6.0/include/petsc.h # Automatically generated using Clang.jl wrap_c, version 0.0.0 module PETSc include("libPETSc_common.jl") function PetscIsInfOrNanReal() ccall((:PetscIsInfOrNanReal,petsc),PetscErrorCode,()) end function PetscIsNormalReal() ccall((:Pet...
jiahao/PETSc.jl
src/auto/PETSc_auto.jl
Julia
mit
616,728
using MXNet #-------------------------------------------------------------------------------- # define lenet # input data = mx.Variable(:data) # first conv conv1 = @mx.chain mx.Convolution(data=data, kernel=(5,5), num_filter=20) => mx.Activation(act_type=:tanh) => mx.Pooling(pool...
JuliaPackageMirrors/MXNet.jl
examples/mnist/lenet.jl
Julia
apache-2.0
1,421
type SymbolDistr{SymbolT} symbols::Vector{SymbolT} probs::Vector{Float64} end probability_vector{T <: Number}(numbers::Vector{T}) = numbers ./ sum(numbers) # Constructor from Dicts SymbolDistr{ST, PT}(d::Dict{ST, PT}) = begin symbols = collect(keys(d)) probs = convert(Vector{Float64}, [d[s] for s in symbols])...
robertfeldt/InfoTheory.jl
spikes/xpfsa.jl
Julia
mit
3,890
# # This file is part of the Actors.jl Julia package, # MIT license, part of https://github.com/JuliaActors # # # remote node failure detection (RNFD) actor # ---------------------------------------------- # if an actor on a (relative) remote node is added to a # supervisor an actor is started scanning the remote li...
daqcore/Actors.jl
src/remote_failures.jl
Julia
mit
5,840
using MsgPack using Base.Test using Compat ck_pack(a, b) = pack(a) == b && unpack(b) == a # nil @test ck_pack(nothing, [0xc0]) # bool @test ck_pack(false, [0xc2]) @test ck_pack(true, [0xc3]) # positive fixint @test ck_pack(5, [0x05]) # UInt8 @test ck_pack(128, [0xcc,0x80]) # UInt16 @test ck_pack(2^8, [0xcd,0x01,0x0...
JuliaPackageMirrors/MsgPack.jl
test/runtests.jl
Julia
mit
4,021
abstract type LTISystem <: AbstractSystem end +(sys1::LTISystem, sys2::LTISystem) = +(promote(sys1, sys2)...) -(sys1::LTISystem, sys2::LTISystem) = -(promote(sys1, sys2)...) *(sys1::LTISystem, sys2::LTISystem) = *(promote(sys1, sys2)...) /(sys1::LTISystem, sys2::LTISystem) = /(promote(sys1, sys2)...) # Fallback number...
JuliaControl/Control.jl
src/types/Lti.jl
Julia
mit
3,481
#!/usr/bin/env julia ########################################################################## # run_convergence-indoors.jl # # Convergence as a function of number of iterations. ########################################################################## using CoordinatedPrecoding using Compat, JLD #################...
rasmusbrandt/CoordinatedPrecoding.jl
examples/run_convergence-indoors.jl
Julia
mit
1,921
## build_network.jl run(pipeline(`julia ../scripts/build_network_runner.jl data/small.ChromNet.jld --quiet`, "data/small.json")) # ## build_network.jl # M = trues(4, ChromNet.totalBins) # M[:,:] = rand(4, ChromNet.totalBins) .> 0.5 # header = ["A01", "B01", "C01", "D01"] # isfile("data/small.ChromNet") && rm("data/s...
slundberg/ChromNet.jl
test/scripts.jl
Julia
apache-2.0
2,049
@testset "Meataxe" begin @testset "$(typeof(f(3)))" for f in [n -> GF(Int(n)), n -> GF(n), n -> FiniteField(n, 1, "a")[1], n -> FiniteField(fmpz(n), 1, "a")[1]] F = f(3) @testset "cleanvect" begin M=MatrixSpace(F,2,3)([1,1,0,0,1,0]) v=MatrixSpace(F,1,3)([2,2,0]) @test iszero(Hecke.cleanvect(...
thofma/Hecke.jl
test/Misc/meataxe.jl
Julia
bsd-2-clause
2,557
module MatrixFunctions import Base: size, full, eltype, show, showarray import Base.LinAlg: (*), (+), (.*), issym, ishermitian, isposdef export AbstractMatrixFunction export MatrixFunction arithtype(T) = T arithtype(::Type{Bool}) = Int abstract AbstractMatrixFunction{Td} <: AbstractSparseMatrix{Td, Int} immutable ...
ttuegel/MatrixFunctions.jl
src/MatrixFunctions.jl
Julia
bsd-2-clause
4,028
#= Copyright (c) 2015, Intel Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaime...
IntelLabs/Sparso
test/correctness/prop-lower-upper-test3.jl
Julia
bsd-3-clause
1,816
function f_gd(x) (x[1] - 5.0)^2 end function g_gd(x, storage) storage[1] = 2.0 * (x[1] - 5.0) end initial_x = [0.0] d = DifferentiableFunction(f_gd, g_gd) results = Optim.gradient_descent(d, initial_x) @assert isempty(results.trace.states) @assert results.gr_converged @assert norm(results.minimum - [5.0]) < 0.0...
KristofferC/Optim.jl
test/gradient_descent.jl
Julia
mit
678
# Read in a config file, write out the structures one by one, check symmetry using DelimitedFiles """ Parse an array of lines (from an MTP-style config file) into a structure. Also return the unused lines. This routine is fragile in the sense that it assumes spacing between consecutive structures remains constant. """...
msg-byu/symlib
src/symcheck.jl
Julia
mit
3,021
include("../src/lstm_g/network.jl") include("../src/lstm_g/viz.jl") nin = 3 nhidden = 2 nout = 1 # basic ANN inputlayer = gatedlayer(3, tag=:input) hiddenlayer = gatedlayer(2, tag=:hidden) outputlayer = gatedlayer(1, tag=:output) @show inputlayer hiddenlayer outputlayer ci = connect(inputlayer, hiddenlayer) co = c...
tbreloff/OnlineAI.jl
test/test_lstm_g.jl
Julia
mit
746
function write_data( file_path::String, ax::Float64, ay::Float64, number_of_frames::Array{Int64, 1}, deltat::Float64, K::Array{Int64, 1}, DE::Array{Float64, 1}) file_stream::IOStream = open(file_path, "w") @printf(file_stream, "%s", "<data>\n") write_key(file_stream, "ax", ax) write...
roding/part_conc_spt_abc
src/cpu/file_io/write_data.jl
Julia
mit
594
type MustacheTokens tokens end ## after parsing off to squash, nest and render the tokens ## Make the intial set of tokens before squashing and nesting function make_tokens(template, tags) tags = ["{{", "}}"] # we hard code tags! tagRes = ["\{\{", "\}\}"] # escaped to be regular expressions ...
JuliaPackageMirrors/Mustache.jl
src/tokens.jl
Julia
mit
10,682
export ProductDomain immutable ProductDomain{D,T,dim} <: Domain{T,dim} domains::D end ProductDomain(d::Tuple) = ProductDomain{typeof(d),mapreduce(eltype,promote_type,d),mapreduce(dimension,+,d)}(d) fromcanonical(d::BivariateDomain,x::Tuple)=fromcanonical(d,x...) tocanonical(d::BivariateDomain,x::Tuple)=toc...
JuliaPackageMirrors/ApproxFun.jl
src/Multivariate/ProductDomain.jl
Julia
bsd-3-clause
1,895
# An infinite number of mathematicians walk into a bar... using Color using Compat colors = distinguishable_colors(9) box(w, h, n) = empty |> fillcolor(colors[n % 9 + 1]) |> size(w, h) cut(w, h, ::@compat Tuple{Escher.Vertical, Bool}) = (w, h/2) cut(w, h, ::Any) = (w/2, h) stack(w, h, d, n) = n == ...
cdsousa/Escher.jl
examples/layout.jl
Julia
mit
727
facts("Auth token generation is successful") do include(joinpath(dirname(@__FILE__),"../src/Quandl.jl")) context("created an empty token file after importing module") do context("created token file") do @fact isfile(joinpath(dirname(@__FILE__),"../token/auth_token")) --> true end ...
milktrader/Quandl.jl
test/auth_token.jl
Julia
mit
743
module TestConversions using Base.Test using DataArrays @assert isequal(@data([1, 2, NA]), convert(DataArray, @pdata([1, 2, NA]))) # Test vector() and matrix() conversion tools dv = @data ones(5) @assert isa(convert(Vector{Float64}, dv), Vector{Float64}) dv[1] = NA ...
JuliaPackageMirrors/DataArrays.jl
test/conversions.jl
Julia
mit
695
using Statistics, Econometrics function Analyze(chain) posmean = vec(mean(chain,dims=1)) posmedian = vec(median(chain,dims=1)) inci = zeros(3) lower = zeros(3) upper = zeros(3) for i = 1:3 lower[i] = quantile(chain[:,i],0.05) upper[i] = quantile(chain[:,i],0.95) inci[i] =...
mcreel/NeuralNetsForIndirectInference.jl
SV/Analyze.jl
Julia
mit
455
type LogisticGrowth <: AbstractLotkaVolterra r::Real K::Real LogisticGrowth(r,K) = K > 0 ? new(r,K) : error("must have positive carrying capacity") end LogisticGrowth() = LogisticGrowth(1.,1.) #LogisticGrowth specific data nspecies(Z::LogisticGrowth) = 1 #values here are scalar, as opposed to vector specificrat...
gajomi/LotkaVolterra.jl
src/logistic.jl
Julia
mit
1,937
# take a given molecular dynamics trial and save every tenth PE, KE, T, virial, and # speed distribution to a file whose name is based on ρ and Tdesired. function extract(folder::String, r::MolecularDynamicsTrial, N::Integer) rho = r.ρ Td = r.Td speeds = √sum(r.v[:,:,N:N:end] .* r.v[:,:,N:N:end], 1) ...
stefco/g6080
common/md/extract_tenth_t_pe_vir_v.jl
Julia
mit
863
# # Dataspaces # const DS_SCALAR = 0x00 const DS_SIMPLE = 0x01 const DS_NULL = 0x02 struct WriteDataspace{N,A<:Tuple} dataspace_type::UInt8 size::NTuple{N,Length} attributes::A end struct ReadDataspace dataspace_type::UInt8 dimensionality::UInt8 dimensions_offset::Int64 end ReadDataspace() =...
simonster/JLD2
src/dataspaces.jl
Julia
mit
3,384
# # This module creates a platform independent window with a canvas inside. # It uses OpenGL and GR libraries for that. Has an ability to draw a color pixels # on a canvas. Uses RGB color format for drawing. It implements lazy update # logic. It means, that canvas will be updated only after calling update() # method. S...
tmptrash/jevo
src/visual/OpenGlWindow.jl
Julia
mit
6,821
#------------------------------------------------------------------- #* EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC. #* #* This LIBRARY is free software; you can distribute it and/or modify #* it under the therms of the ALSOC FREE LICENSE as available at #* http://www.enq.ufrgs.br/alsoc. #* #* EMSO Copyrig...
DANA-Laboratory/EMSOModelLibrary.jl
JuliaEMSOModels/controllers/lag_1/Lag_1.jl
Julia
mit
2,033
global MAPLIGHT_API = URI("http://maplight.org") set_api_endpoint(endpoint) = (global MAPLIGHT_API = endpoint)
WestleyArgentum/MapLight.jl
src/endpoint.jl
Julia
mit
113
# A simple example to demonstrate the use of CUDA.jl using CUDA println("CUDA driver version: $(CUDA.DriverVersion)") try println("Devices") list_devices() println() dev = CuDevice(0) println("create context") ctx = create_context(dev) println("load module from vadd.ptx") md = CuMo...
zeryx/CUDA.jl
examples/ex1.jl
Julia
mit
1,264
crls_tol = 1.0e-5; for npower = 1 : 4 (b, A, D, HY, HZ, Acond, rnorm) = test(40, 40, 4, npower, 0); # No regularization. (x, stats) = crls(A, b); resid = norm(A' * (A*x - b)) / norm(b) @printf("CRLS: Relative residual: %8.1e\n", resid); @test(resid <= crls_tol); @test(stats.solved); λ = 1.0e-3; (x, ...
vepiteski/Krylov.jl
test/test_crls.jl
Julia
mit
1,263
module Fractals export burning_ship, mandelbrot macro real_iters(c, recur) quote const max_iter = 1000.0 const bailout = 1e10 local r = 0.0 local z = $c for i in 1:max_iter z = $recur if abs2(z) > bailout ^ 2 r = i - log2(log(abs(z)) * (1 / log(bailout))) break; ...
bgjackma/fractals-are-fun
escape_time/fractal.jl
Julia
mit
676
function backTrackingLS(f,g,maxLSiter,c1,θ,∇,fval) α = 1 lineSearchIter = 0 for i in 1:maxLSiter f_xk_alpha_k = f( θ + α * -∇) f_xk_plus_grad = fval + ( c1 * α * ∇' * -∇)[1] #@printf("%f \t < \t %f\n",f_xk_alpha_k,f_xk_plus_grad) if ! (f_xk_alpha_k < f_xk_plus_grad[1]) ...
zagazao/num-opt
src/linesearch/Linesearch.jl
Julia
mit
2,989
function io_test() function condition_push(stack::CompressedStack, elt::Int) f = deepcopy(stack.input) line = readline(f) aux = split(line) return convert(Bool, elt) end function condition_push2(stack::NormalStack, elt::Int) f = deepcopy(stack.input) line = readline(f) aux = split(line...
Azzaare/CompressedStacks.jl
test/temp.jl
Julia
mit
1,459
module cindex export parse_header, cu_type, ty_kind, name, spelling, value, children, cu_file, resolve_type, return_type, tokenize, pointee_type, typedef_type export CLType, CLCursor, CXString, CXTypeKind, CursorList, TokenList export getindex, start, next, done, search, show, endof export function_retu...
JuliaPackageMirrors/Clang.jl
src/cindex.jl
Julia
mit
12,800
# operation on MATLAB engine sessions ########################################################### # # Session open & close # ########################################################### # 64 K buffer should be sufficient to store the output text in most cases const default_output_buffer_size = 64 * 1024 type MSessi...
thomas-nilsson-irfu/MATLAB.jl
src/engine.jl
Julia
mit
7,710
# Apply kinetic operator to wave function in reciprocal space function op_K( pw::PWGrid, psi::Array{ComplexF64,2}, ik::Int64 ) # out = zeros(ComplexF64,size(psi)) Ncol = size(psi)[2] Ngwk = pw.gkvec.Ngw[ik] idx_gkk = pw.gkvec.idx_gk[ik] G = pw.gvec.G[:,idx_gkk] for is = 1:Ncol for...
f-fathurrahman/ffr-ElectronicStructure.jl
PW/sch_03/op_K.jl
Julia
mit
509
@compat (::Type{Sphere})(x...) = HyperSphere(x...) @compat (::Type{Circle})(x...) = HyperSphere(x...) widths{N, T}(c::HyperSphere{N, T}) = Vec{N, T}(radius(c)*2) radius(c::HyperSphere) = c.r origin(c::HyperSphere) = c.center minimum{N, T}(c::HyperSphere{N, T}) = Vec{N, T}(origin(c)) - Vec{N, T}(radius(c)) maximum{N, ...
JuliaPackageMirrors/GeometryTypes.jl
src/hypersphere.jl
Julia
mit
391
user_agents = ( "chrome", "firefox", "internet_explorer", "opera", "safari", ) windows_platform_tokens = ( "Windows 95", "Windows 98", "Windows 98; Win 9x 4.90", "Windows CE", "Windows NT 4.0", "Windows NT 5.0", "Windows NT 5.01", "Windows NT 5.1", "Windows NT 5.2", "Window...
JuliaPackageMirrors/Faker.jl
src/user_agent.jl
Julia
mit
3,750
export OrdLoc, OrdLocElem ############################################################################### # # Declaration types # OrdLoc / OrdLocElem # ############################################################################### mutable struct OrdLoc{T<:nf_elem} <: Hecke.Ring OK::NfAbsOrd{AnticNumberField,T...
thofma/Hecke.jl
src/Misc/OrdLocalization.jl
Julia
bsd-2-clause
17,037
struct BjerksundStenslandApproximationEngine{B <: AbstractBlackScholesProcess} <: PricingEngine process::B end function get_phi(S::Float64, gamma::Float64, H::Float64, I::Float64, rT::Float64, bT::Float64, variance::Float64) lambda = (-rT + gamma * bT + 0.5 * gamma * (gamma - 1.0) * variance) d = -(log(S / H) + ...
pazzo83/JQuantLib
src/pricing_engines/vanilla/bjerksund_stensland_engine.jl
Julia
mit
3,655
function (::Type{MT})(primitives::AbstractPrimitive{3, T}...; samples=(128,128,128), algorithm=MarchingCubes(), adf=false) where {T, MT <: AbstractMesh} f(x) = FRep(primitives[1], x) meshe...
sjkelly/Descartes.jl
src/meshes.jl
Julia
mit
805
#Is this usable data? function isconcrete{T<:Number}(x::T) !isna(x) && isfinite(x) end function isconcrete(x::MathConst) return true end function isconcrete(x) !isna(x) end function hasna(xs) return false end function hasna(xs::AbstractDataArray) for x in xs if isna(x) re...
joehuchette/Gadfly.jl
src/misc.jl
Julia
mit
13,182
const DROPOUT = 0 const BATCH_SIZE = 32 const SEQ_LENGTH = 32 const DIM_HIDDEN = 256 const DIM_EMBED = 256 const LSTM_N_LAYER = 2 const N_EPOCH = 21 const BASE_LR = 0.01 const WEIGHT_DECAY = 0.00001 const CLIP_GRADIENT = 1 const NAME = :ptb const N_GPU = 4 const USE_GPU...
JuliaPackageMirrors/MXNet.jl
examples/char-lstm/config.jl
Julia
apache-2.0
671
using Base.Test using Reactive a = Input(0) function crash(x) push!(a, 1) end facts("push! inside push!") do b = lift(crash, a) @fact_throws push!(a, 1) end
sjkelly/Reactive.jl
test/concurrency.jl
Julia
mit
172
using Scallop.Metrics @assert 12 == xmetrics(6)
milktrader/TradingSystem.jl
test/metrics.jl
Julia
mit
49
# This file is a part of EasyPkg, licensed under the MIT License (MIT). using Base.Test @testset "Some other tests" begin @test 40+2 == 42 @test 2*5 == 10 end
oschulz/EasyPkg.jl
test/should_pass/bar.jl
Julia
mit
163
export NestedFixedPoint module NestedFixedPoint using ..General import ..General: sample, vcov import Distributions: Gumbel, Logistic include("NFXPSolver.jl") include("NFXPFamily.jl") include("valueiteration.jl") include("NFXPResult.jl") include("NFXPSimulator.jl") include("loglikelihood.jl") end
cpritcha/DynamicDiscreteChoice
src/nfxp/nfxp.jl
Julia
mit
302
""" Thread-safe logging. """ module Log import Base.Threads.threadid # logging levels in increasing verbosity @enum LogLevel ERROR WARN INFO DEBUG const LEVEL = Ref{LogLevel}(INFO) const VERBOSE = Ref{Bool}(true) # print stack traces from errors # Rank for multinode functionality (can be set on startup) const rank...
jeff-regier/Celeste.jl
src/Log.jl
Julia
mit
1,996
# TODO: make this more sensible: # - separate tests for # 1. features that are "copy-and-pasted" from `Markdown` module # 2. features that are extended by Weave using Weave: WeaveMarkdown, Markdown # Test markdown2html writer html = WeaveMarkdown.html(Markdown.parse(""" # H1 ## H2 ## H3 Some **text** with d...
mpastell/Weave.jl
test/markdown_test.jl
Julia
mit
2,385
module Gumbo if isfile(joinpath(dirname(dirname(@__FILE__)),"deps","deps.jl")) include("../deps/deps.jl") else error("Gumbo not properly installed. Please run Pkg.build(\"Gumbo\")") end include("CGumbo.jl") export HTMLElement, HTMLDocument, HTMLText, NullNode, HTMLNode, att...
tkelman/Gumbo.jl
src/Gumbo.jl
Julia
mit
596
import gmsh using JSON gmsh.initialize() gmsh.option.setNumber("General.Terminal", 1) # set a full onelab db gmsh.onelab.set(""" { "onelab":{ "creator":"My app", "version":"1.3", "parameters":[ { "type":"number", "name":"number 1", "values":[ 1 ] }, { "type":"string", "name":"string 1", "values":[ "hel...
poofee/fastFEM
gmsh-4.2.2/demos/api/onelab_test.jl
Julia
mit
1,161
################################ # Coded by Julien Pascal # Last modification : 30/04/2016 # Replication of the the following paper: #################################################################################### # "On the Dynamics of Unemployment and Wage Distributions" # Paper from Jean Marc Robin (2011) # Avai...
JulianPasc/Final-Project-Julien-Pascal
src/objective_function_3.jl
Julia
mit
12,399
export all_partitions """ `all_partitions(A::Set)` creates a `Set` containing all possible partitions of the set `A`. `all_partitions(n::Int)` creates the `Set` of all partitions of the set `{1,2,...,n}`. Both of these take an optional second argument `k` to specify that only partitions with exactly `k` parts should ...
scheinerman/SimplePartitions.jl
src/all_partitions.jl
Julia
mit
2,657
using JLD using ProgressMeter export window_bed_file, streaming_cor, cov2cor!, streaming_edgeimpact # creates a BitArray with a 1 for every bin overlapped by the bed file regions function window_bed_file(stream, contigs; binSize=1000) numBins = ceil(Int64, sum(contigs.sizes) / binSize) chrOffsets = Dict{ASCII...
slundberg/ChromNet.jl
src/util.jl
Julia
apache-2.0
7,674
import Nemo.setcoeff!, Nemo.lift, Hecke.lift, Nemo.rem export psi_lower, psi_upper, show_psi #function setcoeff!(g::fmpz_mod_rel_series, i::Int64, a::Nemo.Generic.Res{Nemo.fmpz}) # setcoeff!(g, i, lift(a)) #end function bernstein(h::Int, it::Any, Q = FlintQQ, cl = ceil, a::Int = 776) #use 771 and cl = floor to get...
thofma/hecke
src/Misc/psibound.jl
Julia
bsd-2-clause
6,686
using DSGE, JLD, DifferentialEquations, StateSpaceRoutines, Statistics include("../../../../src/estimate/ct_filters/ct_kalman_filter.jl") # This file will test how well this Kalman Filter finds the # true outcome when we generate new data many different times # Solve model m = KrusellSmithCT() global T, R, C, inverse...
FRBNY-DSGE/DSGE.jl
docs/src/ct_hank/kalman_filter/ct_kalman_filter.jl
Julia
bsd-3-clause
3,736
using SparseArrays using Test using Languages using TextAnalysis using WordTokenizers using Serialization println("Running tests:") include("coom.jl") include("tokenizer.jl") include("ngramizer.jl") include("document.jl") include("metadata.jl") include("corpus.jl") include("preprocessing.jl") include("dtm.jl") includ...
johnmyleswhite/TextAnalysis.jl
test/runtests.jl
Julia
mit
517
## General HTML rendering - static pages and IJulia ––––––––––––––––––––––––––––––––––––– function save(file::AbstractString, mime::MIME"text/html", doc::Metadata, config::Config) config.include_internal || throw(ArgumentError("`config` option `include_internal` must be true for html")) ents = Entr...
hayd/Lexicon.jl
src/render/html.jl
Julia
mit
6,813
import Base: >>> export wrapbehavior, button, slider, checkbox, radio, radiogroup, togglebutton, textinput, progress, spinner, paper, datepicker # A widget can be coerced into a behavior # by calling `wrapbehavior` on it. abstract Widget <: B...
PallHaraldsson/Escher.jl
src/library/widgets.jl
Julia
mit
12,015
##################### # WebhookEvent Type # ##################### type WebhookEvent kind::GitHubString payload::Dict repository::Repo sender::Owner end function event_from_payload!(kind, data::Dict) if haskey(data, "repository") repository = Repo(data["repository"]) elseif kind == "mem...
JuliaPackageMirrors/GitHub.jl
src/activity/events.jl
Julia
mit
5,928
immutable TLSDist <: ContinuousUnivariateDistribution ν::Float64 μ::Float64 a::Float64 function TLSDist(ν::Float64, μ::Float64, a::Float64) if ν < 0 error("ν of TLS must be larger than zero.") end if a < 0 error("scaling a of TLS must be larger than zero."...
JuliaFinMetriX/Econometrics.jl
src/distributions/t_loc_scale.jl
Julia
mit
3,583
module LibExpat using Compat import Base: getindex, show, parse import Compat.String import Compat.unsafe_string if is_windows() const libexpat = "libexpat-1" elseif is_unix() const libexpat = "libexpat" end include("lX_common_h.jl") include("lX_defines_h.jl") include("lX_expat_h.jl") #include("lX_exports_h...
JuliaPackageMirrors/LibExpat.jl
src/LibExpat.jl
Julia
mit
11,021
#-------------monte_carlo.jl---------------------------------------------------# # # Purpose: A simple monte carlo script to integrate x^2 in a given range # #------------------------------------------------------------------------------# # A function to integrate x^2 in a given range with num number of points functio...
vchuravy/skillpill-julia
examples/monte_carlo/monte_carlo.jl
Julia
mit
731
function _adapt_ϵ(logϵ, Hbar, logϵbar, da_stat, m, M_adapt, δ, μ; γ=0.05, t0=10, κ=0.75) if m <= M_adapt Hbar = (1.0 - 1.0 / (m + t0)) * Hbar + (1 / (m + t0)) * (δ - da_stat) logϵ = μ - sqrt(m) / γ * Hbar logϵbar = m^(-κ) * logϵ + (1 - m^(-κ)) * logϵbar else logϵ = logϵbar ...
yebai/Turing.jl
test/skipped/dual_averaging.jl
Julia
mit
382
using LightGraphsSuplement using Base.Test # write your own tests here @test 1 == 2
matir143/LightGraphsSuplement
test/runtests.jl
Julia
mit
85
export # curves CurvePt, Curve, CurveIndex, CurveProjection, CURVEINDEX_START, get_lerp_time, index_closest_to_point, get_curve_index, curveindex_end, # roadway LaneTag, LaneBoundary, Lane, LaneConnection, SpeedLimit, RoadSegment, Roadway, ...
tawheeler/AutomotiveDrivingModels.jl
src/2d/roadway/main.jl
Julia
mit
1,035
""" bootstrap!{T}(r::Matrix{T}, m::LinearMixedModel{T}, f!::Function; β=fixef(m), σ=sdest(m), θ=getθ(m)) Overwrite columns of `r` with the results of applying the mutating extractor `f!` to parametric bootstrap replications of model `m`. The signature of `f!` should be f!{T}(v::AbstractVector{T}, m::L...
JuliaPackageMirrors/MixedModels.jl
src/simulate.jl
Julia
mit
4,220
module Nanomsg using Sockets export Socket, CSymbols, jl_nn_errno_check, poll export _nn_errno, _nn_strerror, _nn_symbol_info, _NNSymbolProperties const LIB = @static Sys.iswindows() ? "nanomsg.dll" : "libnanomsg" mutable struct NanomsgError <: Exception context::AbstractString errno::Cint NanomsgError...
Redsift/Nanomsg.jl
src/Nanomsg.jl
Julia
apache-2.0
9,748
using DSGE, Test, ModelConstructors m = AnSchorfheide() homedirpath = Sys.iswindows() ? joinpath(homedir(),".freddatarc") : joinpath(ENV["HOME"],".freddatarc") if haskey(ENV, "FRED_API_KEY") || isfile(homedirpath) load_data(m) @testset "Test util functions" begin @test get_class(:histobs) == :obs ...
FRBNY-DSGE/DSGE.jl
test/analysis/util.jl
Julia
bsd-3-clause
3,013
using Reactive using FactCheck using Compat a = Input(2) b = @lift a^2 facts("@lift") do context("@lift input expressions") do t1 = @lift (a,) t2 = @lift (a, b) l1 = @lift [a] l2 = @lift [a, b] c1 = @lift Any[a] push!(a, 3) @fact t1.value => (a.value,) ...
CLUSTERfoo/Reactive.jl
test/macro.jl
Julia
mit
855
## Conclusion: make my life easier and just define a GraphNode and a TreeNode print("Hi!") module tmp using GeometryTypes struct Node2 id::Int iPrev::Int #parent state::Nullable{Point2f0} end #Node2(id::Int, iPrev::Int) = Node2(id, iPrev, Point2f0()) Node2(id::Int, iPrev::...
nouyang/janson299r
wk11/scratch.jl
Julia
mit
768
export Config module Config println("Configuring Mocha...") const use_cuda_key = "MOCHA_USE_CUDA" const cuda_dev_key = "MOCHA_GPU_DEVICE" const use_native_extension_key = "MOCHA_USE_NATIVE_EXT" if haskey(ENV, cuda_dev_key) const cuda_dev_id = try parse(Int, ENV[cuda_dev_key]) catch 0 end else const ...
appapantula/Mocha.jl
src/config.jl
Julia
mit
998
__precompile__() module AdaptiveLASSO ### exports export # main function LSIAF, # input names CoordinateDescent3, CoordinateDescentTM ### include source files # core algorithm include("utils.jl") include("ComposeMatrices.jl") include("CoordinateDescentTM.j...
FelipeCalliari/AdaptiveLASSO.jl
src/AdaptiveLASSO.jl
Julia
mit
423
using Colors using Images using Boltzmann using MNIST using ImageView using Base.Test function run_mnist() X, y = testdata() # test data is smaller, no need to downsample binarize!(X;threhold=0.01) HiddenUnits = 256; Epochs = 10; LearningRate = 0.1; m = BernoulliRBM(28*28, HiddenUnits, (28,2...
sphinxteam/Boltzmann.jl
test/testmomentum.jl
Julia
mit
680
type MktEvent d::Int32 # date t::Int64# time dt::DateTime # datetime isExec::Int32 bid::Float32 ask::Float32 lastAmt::Int32 BS::Int32 OC::Int32 CP::Int32 oType::Int32 AcctID::Int32 function MktEvent() new(zero(Int32), zero(Int64), typemin(DateTime), zero(I...
Andy-P/PriceDist
src/eventIO.jl
Julia
mit
1,783
# A one dimensional optimization problem # # Problem 9 in # http://infinity77.net/global_optimization/test_functions_1d.html#d-test-functions # Andrea Gavana # # S. Goyette, Sherbrooke 2016/2017 export AMPGO09 "Univariate multimodal minimization problem AMPGO09" function AMPGO09(args...) nlp = Model() @variable(...
dpo/OptimizationProblems.jl
src/AMPGO09.jl
Julia
mit
430
# Julia wrapper for header: gurobi_c.h # Automatically generated using Clang.jl function GRBgetattrinfo(model, attrname, datatypeP, attrtypeP, settableP) ccall((:GRBgetattrinfo, libgurobi), Cint, (Ptr{GRBmodel}, Ptr{Cchar}, Ptr{Cint}, Ptr{Cint}, Ptr{Cint}), model, attrname, datatypeP, attrtypeP, settableP) end f...
JuliaOpt/Gurobi.jl
src/gen90/libgrb_api.jl
Julia
mit
42,477
function write_input_diffusion( file_path::String, solid_structure_path::String, diffusion_map_path::String, D0::Float64, D1::Float64, deltat_coarse::Float64, number_of_time_points_coarse::Int64, number_of_time_points_fine_per_coarse::Int64, number_of_diff...
roding/whitefish_diffusion
src/file_io/write_input.jl
Julia
mit
1,530
# Copyright (c) 2014 Aubrey Barnard. This is free software. See # LICENSE for details. # List with block-based storage that supports random access. The # benefits are that allocation and deallocation do not require copying # and that at most a constant amount of memory is unused (the block # size). The costs are a...
afbarnard/jltbl
BlockedList.jl
Julia
mit
4,721
root = Tree.Node(0) @assert Tree.isroot(root) @assert Tree.isleaf(root) nchildren = 0 for c in root nchildren += 1 end @assert nchildren == 0 c1 = Tree.addchild(root, 1) c2 = Tree.addchild(root, 2) c3 = Tree.addsibling(c2, 3) @assert Tree.lastsibling(c1) == c3 c21 = Tree.addchild(c2, 4) c22 = Tree.addchild(c2, 5) @...
JuliaPackageMirrors/ProfileView.jl
test/tree.jl
Julia
mit
695
module DictIO export writedict, readdict "Save the type and data of the passed dictionary as text." function writedict(f::IOStream, dict::Dict) println(f, join(match(r"[A-z]+{([^,]+),([^}]+)}", string(typeof(dict))).captures, '\t')) for (k,v) in dict println(f, string(k)*"\t"*string(v)) end end fu...
slundberg/DictIO.jl
src/DictIO.jl
Julia
mit
1,265
using LinearAlgebra #Create an interpolation path between x1 and x2, unit vectors #by normalizing the linear interpolation of parameter t[i]. function interpolate_vec(x1,x2,t) @assert(size(t)[1]>2) v_interp = zeros(ComplexF64,size(x1)[1],size(t)[1]) for i in 1:size(t)[1] v_interp[:,i] = (1-t[i])*x...
antoine-levitt/wannier
interpolation.jl
Julia
mit
6,968
""" SimpleNLPModel <: AbstractNLPModel Simple model for testing purposes. Modified problem 14 in the Hock-Schittkowski suite min (x₁ - 2)² + (x₂ - 1)² s.to x₁ - 2x₂ + 1 = 0 -x₁² / 4 - x₂² + 1 ≥ 0 0 ≤ x ≤ 1 x₀ = [2.0, 2.0]. """ mutable struct SimpleNLPModel <: AbstractNLPModel ...
dpo/NLPModels.jl
test/nlp/simple-model.jl
Julia
mit
3,933
# Copyright 2021 The FirstOrderLp Authors # # 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...
google-research/FirstOrderLp.jl
src/mirror_prox.jl
Julia
apache-2.0
30,006
using Cxx cxx""" #include <memory> #include <vector> class X184 { public: std::unique_ptr<int> val; }; enum X195 {x195, y195}; class Test195 { public: X195 x; }; """ sprint(show, icxx"std::unique_ptr<int>{nullptr};") sprint(show, icxx"X184{};") sprint(show, icxx"new X184{};") sprint(show, icxx"Test19...
zhmz90/Cxx.jl
test/show.jl
Julia
mit
412
Aaron Carta@Picard.2476:1460599410
acarta/spatiotemp
Assignments/hw2/.#lorenz.jl
Julia
mit
34
# This file is a companion to `src/api.jl` --- it defines the raw ccall wrappers, while # here small normalizations are made to make the calls more Julian. # For instance, many property getters return values through pointer output arguments, # so the methods here handle making the appropriate `Ref`s and return them (as...
timholy/HDF5.jl
src/api_helpers.jl
Julia
mit
12,334
# schema and helper methods type Schema schema::Vector{SchemaElement} name_lookup::Dict{AbstractString,SchemaElement} function Schema(elems::Vector{SchemaElement}) name_lookup = Dict{AbstractString,SchemaElement}() name_stack = AbstractString[] nchildren_stack = Int[] for ...
tanmaykm/Parquet.jl
src/schema.jl
Julia
mit
9,857
include("ekfslam-sim.jl") include("gr-draw.jl") # Global object containing simulation state, updated in real time. # It is exposed for monitoring, debugging, and flexible visualization. simdata = ekfsim_setup(10, "course1.txt") init_plot_window(simdata.scene.boundaries) draw_map(simdata.scene.landmarks, simdata.sce...
andrewadare/SLAM.jl
sim/run-ekfsim.jl
Julia
mit
827
## Definition of different types of links # Link is used to define natural encoding of networks by users # i.e. (tail,head,[capacity]) const Link = Tuple{Int,Int,Float64} const SimpleLink = Tuple{Int,Int} # Unweighted links function weightLink(l::SimpleLink,c::Float64) Link(l[1],l[2],c) end function weightLink(l::S...
Azzaare/NetworkFlows.jl
src/links.jl
Julia
mit
1,470
module SynapseClientTests using SynapseClient, PyCall using Test using Dates using UUIDs import SynapseClient: utils, AbstractEntity, AbstractSynapse, AbstractSynapseDict, Activity, Folder, File, Project, Evaluation, Submission, DictObject, Team ValueError = pybuiltin(:Va...
rasmushenningsson/SynapseClient.jl
test/runtests.jl
Julia
mit
1,087
################################################################################ # First try to detect and load existing libmxnet ################################################################################ libmxnet_detected = false if haskey(ENV, "MXNET_HOME") info("MXNET_HOME environment detected: $(ENV["MXNET...
BigEpsilon/MXNet.jl
deps/build.jl
Julia
apache-2.0
2,648