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 |
|---|---|---|---|---|---|
local Crystal = require 'crystal'
local loader = {}
function loader.new_level()
return {
crystals = {},
goals = {},
walls = {}
}
end
function loader.save_crystal(level, ...)
local crystal = Crystal:new({}, ...)
table.insert(level.crystals, crystal)
end
function loader.load_level(level, name)
--local da... | skyem123/ludumdare2016 | game/loader.lua | Lua | mit | 1,525 |
-- Gather_Resources.lua v1.0 -- by Darkfyre
--
--
dofile("common.inc");
button_names = {"Grass","Grass Small Icon","Slate","Slate Small Icon","Clay","Clay Small Icon"};
counter = 0;
function checkOK()
while 1 do
checkBreak();
srReadScreen();
OK = srFindImage("OK.png");
if OK then
sleepWithStatus(100, "... | wzydhek/Automato-ATITD | scripts/gather_resources.lua | Lua | mit | 6,341 |
--[[-----------------------------------------------------------------------------
DropdownGroup Container
Container controlled by a dropdown on the top.
-------------------------------------------------------------------------------]]
local Type, Version = "DropdownGroup", 21
local AceGUI = LibStub and LibStub("AceGUI-... | Naliwe/IntelliJ_WowAddOnSupport | resources/Wow_sdk/AceGUI-3.0/widgets/AceGUIContainer-DropDownGroup.lua | Lua | mit | 4,965 |
local _, NeP = ...
--[[
DESC: Checks if unit has a Blacklisted Debuff.
This will remove the unit from the OM cache.
---------------------------------------------------]]
local BlacklistedAuras = {
-- CROWD CONTROL
[118] = '', -- Polymorph
[1513] = '', -- Scare Beast
[1776] = '', -- Gouge
[26... | modhunter/NerdPack | tables/blacklisted_auras.lua | Lua | mit | 2,244 |
local Lattice = require 'Lattice'
local MyLattice = Lattice:New();
math.randomseed(os.time())
local Model = require 'Model';
Model = Model:New();
Model.Lattice = MyLattice;
MyLattice:Init(10,10,1);
MyLattice:InitRandomField(8,0);
MyLattice.J = 2;
-- If you want to calculate resistances, also init the RN;
MyLattice:... | jochem-brouwer/VO2_Model | Run_ResistanceTest.lua | Lua | mit | 4,052 |
GPad.VFS.FSS = {}
local Tag = "CreateVFS"
if CLIENT then
GPad.VFS.Protocol:Receive(Tag, function(inBuffer)
local size = inBuffer:PullNumber()
local FS = inBuffer:PullTable()
GPad.VFS.FSS["SERVER"] = GPad.VFS.MakeRoot("Server")
GPad.VFS.FSS["SERVER"]:SetFileSystem(FS)
PrintTable(GPad.VFS.FSS["SERVER"]:GetFi... | Capster/GPad | lua/gpad/vfs/copyfs.lua | Lua | apache-2.0 | 621 |
local events = require "kong.core.events"
local cache = require "kong.tools.database_cache"
local function invalidate_cache(consumer_id)
cache.delete(cache.acls_key(consumer_id))
end
local function invalidate(message_t)
if message_t.collection == "consumers" then
invalidate_cache(message_t.entity.id)
elseif... | xvaara/kong | kong/plugins/acl/hooks.lua | Lua | apache-2.0 | 602 |
local router = require "dynx.resty.router"
local r = router:new("dynx.resty.router.redis_kv_cache")
local route, err = r:get_route(ngx.var.uri)
if not route and err then
return ngx.exit(503)
end
if not route or route == ngx.null then
return ngx.exit(404)
end
ngx.var.rr_key = ngx.var.uri
ngx.var.rr_route = route
n... | dhiaayachi/dynx | upstream_rewrite.lua | Lua | apache-2.0 | 390 |
----------------------------------------------------------------------------------------------------
-- Proposal:
-- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0238-Keyboard-Enhancements.md
----------------------------------------------------------------------------------------------------
-... | smartdevicelink/sdl_atf_test_scripts | test_scripts/API/KeyboardEnhancements/Resumption/005_SDL_resumes_KeyboardProperties_single_parameter.lua | Lua | bsd-3-clause | 2,615 |
return function(normalized_hostname, wildcard_regex)
if wildcard_regex then
local matches, match_err = ngx.re.match(ngx.ctx.host_normalized, wildcard_regex, "jo")
if matches then
return true
elseif match_err then
ngx.log(ngx.ERR, "regex error: ", match_err)
end
else
if ngx.ctx.host_n... | NREL/api-umbrella | src/api-umbrella/utils/matches_hostname.lua | Lua | mit | 410 |
--- Module for describing an action in a 'declarative' way
-- @classmod lqc.fsm.action
-- @alias Action
local Action = {}
local Action_mt = { __index = Action }
--- Creates a new action.
-- @param var (Symbolic) variable to store the result of the action in
-- @param cmd Command that was called during this action
-... | Primordus/lua-quickcheck | lqc/fsm/action.lua | Lua | mit | 1,085 |
-- Elevate all the mental attributes of a unit
-- by vjek
local help = [====[
elevate-mental
==============
Set all mental attributes of the selected dwarf to the maximum possible, or
any number numbers between 0 and 5000 passed as an argument:
``elevate-mental 100`` for example would make the dwarf very stupi... | Modified-MW-DF/modified-MDF | MWDF Project/Dwarf Fortress/hack/scripts/elevate-mental.lua | Lua | mit | 1,673 |
local HeadersPolicy = require('apicast.policy.headers')
local ngx_variable = require 'apicast.policy.ngx_variable'
describe('Headers policy', function()
before_each(function()
-- avoid stubbing all the ngx.var.* and ngx.req.* in the available context
stub(ngx_variable, 'available_context', function(context) ... | 3scale/docker-gateway | spec/policy/headers/headers_spec.lua | Lua | mit | 17,505 |
--
-- FixedPrecisionFormat v4.0.0 by SilverAzide
--
-- This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.
--
-- History:
-- 4.0.0 - 2018-03-17: Revised code to work with inline Lua (requires Rainmeter 4.1 or later).
-- 1.1.0 - 2015-05-22: Added support for scale factor "... | iamanai/ModernGadgets | Skins/ModernGadgets/@Resources/Scripts/FixedPrecisionFormat.lua | Lua | mit | 7,618 |
function simulated_annealing(tuning_run::Run,
channel::RemoteChannel;
temperature::Function = log_temperature)
iteration = 1
function iterate(tuning_run::Run)
p = temperature(iteration)
iteration += 1
return probabilisti... | phrb/StochasticSearch.jl | src/core/search/techniques/simulated_annealing.jl | Julia | mit | 490 |
const _cache = Dict{AbstractString,Array}()
function fetch_word_list(filename::AbstractString)
haskey(_cache, filename) && return _cache[filename]
try
io = open(filename, "r")
words = map(x -> chomp(x), readlines(io))
close(io)
ret = convert(Array{UTF8String,1}, words)
_cache[filename] = ret
... | slundberg/Languages.jl | src/utils.jl | Julia | mit | 408 |
using DandelionWebSockets
import JSON
import Base.==
import DandelionSlack: on_event, on_reply, on_error, on_connect, on_disconnect,
EventTimestamp, RTMWebSocket, send_text, stop, RTMClient, makerequest,
wsconnect, HttpException
import DandelionWebSockets: @mock, @mockfunc... | dandeliondeathray/DandelionSlack.jl | test/rtm_test.jl | Julia | mit | 15,967 |
##################################################
"""
symbols(name(s), assumptions...)
Calls `sympy.symbols` to produce symbolic variables and symbolic functions. An alternate to the recommended `@syms`, (when applicable)
In sympy `sympy.symbols` and `sympy.Symbol` both allow the construction of symbolic variabl... | JuliaPy/SymPy.jl | src/constructors.jl | Julia | mit | 6,177 |
__precompile__(true)
module ImplicitEquations
using ValidatedNumerics
import ValidatedNumerics: Interval, diam
using RecipesBase
using Compat
include("predicates.jl")
include("intervals.jl")
include("tupper.jl")
include("asciigraphs.jl")
#include("plot.jl")
include("plot_recipe.jl")
export eq, neq, ⩵, ≷, ≶
export... | JuliaPackageMirrors/ImplicitEquations.jl | src/ImplicitEquations.jl | Julia | mit | 461 |
export hom, hom_check
"""
`hom_check(G,H,d)` checks if the dictionary `d` is a graph homomorphism
from `G` to `H`.
"""
function hom_check(G::SimpleGraph, H::SimpleGraph, d::Dict)::Bool
for e in G.E
v, w = e
x = d[v]
y = d[w]
if !H[x, y]
return false
end
end
... | scheinerman/SimpleGraphAlgorithms.jl | src/hom.jl | Julia | mit | 1,166 |
#!/usr/bin/env julia
using ArgParse
s = ArgParseSettings()
@add_arg_table s begin
"config"
help = "a YAML configuration file"
default = "config.yaml"
end
parsed_args = parse_args(ARGS, s)
import YAML
config = YAML.load(open(parsed_args["config"]))
# Make some diagnostic plots to show what the model loo... | iancze/JudithExcalibur | attic/plot_tstructure.jl | Julia | mit | 5,278 |
const strip_patterns = @compat(UInt32(0))
const strip_corrupt_utf8 = @compat(UInt32(0x1)) << 0
const strip_case = @compat(UInt32(0x1)) << 1
const stem_words = @compat(UInt32(0x1)) << 2
const tag_part_of_speech = @compat(UInt32(0x1)) << 3
const... | slundberg/TextAnalysis.jl | src/preprocessing.jl | Julia | mit | 13,988 |
############################################################
# joDict ##############################################
############################################################
export joDict, joDictException
struct joDictException <: Exception
msg :: String
end
##################################################... | slimgroup/JOLI.jl | src/joLinearOperatorConstructors/joCoreBlockConstructors/joDict.jl | Julia | mit | 5,546 |
module WavefrontOBJs
export loadOBJ, loadMTL, load_obj_mtl, numVertices, numFaces
include("geotypes.jl")
include("types.jl")
include("utils.jl")
include("obj.jl")
include("material.jl")
# convenience for loading OBJ and MTL simultaneously
function load_obj_mtl(fpath::ASCIIString)
objpath=string(fpath,".obj")
mtl... | ericjang/WavefrontOBJs.jl | src/WavefrontOBJs.jl | Julia | bsd-2-clause | 540 |
## array.jl: Dense arrays
typealias Vector{T} Array{T,1}
typealias Matrix{T} Array{T,2}
typealias VecOrMat{T} Union(Vector{T}, Matrix{T})
typealias DenseVector{T} DenseArray{T,1}
typealias DenseMatrix{T} DenseArray{T,2}
typealias DenseVecOrMat{T} Union(DenseVector{T}, DenseMatrix{T})
typealias StridedArray{T,N,A<:De... | shubhamg31/columbus_julia | lib/julia/base/array.jl | Julia | apache-2.0 | 38,770 |
module Emulation
export run_cpu
const EMULATED_INTRINSICS = [
:get_global_id,
:get_global_size
]
type EmulationContext
global_id
global_size
function EmulationContext()
new(
[0,0,0],
[0,0,0]
)
end
end
# Emulated version of intrinsic functions
# mainl... | JuliaGPU/HSA.jl | src/emulation/emulation.jl | Julia | mit | 2,595 |
"""
SensitiveFloat objects for expectations involving r_s and c_s.
Args:
vs: A vector of variational parameters
Attributes:
Each matrix has one row for each color and a column for
star / galaxy. Row 3 is the gamma distribute baseline brightness,
and all other rows are lognormal offsets.
- E_l_a: A NUM_BANDS x NUM_SO... | jeff-regier/Celeste.jl | src/deterministic_vi/source_brightness.jl | Julia | mit | 10,351 |
# Linear function - full rank
#
# Source: Problem 32 in
# J.J. More', B.S. Garbow and K.E. Hillstrom,
# "Testing Unconstrained Optimization Software",
# ACM Transactions on Mathematical Software, vol. 7(1), pp. 17-41, 1981.
#
# See also Buckley#80 (with different N and M)
#
# classification SUR2-AN-V-0
e... | dpo/OptimizationProblems.jl | src/arglina.jl | Julia | mit | 746 |
## Scanner
type Scanner
string::AbstractString
tail::AbstractString
pos::Integer
end
Scanner(string::AbstractString) = Scanner("", string, 0)
## Returns `true` if the tail is empty (end of string).
function eos(s::Scanner)
s.tail == ""
end
## Tries to match the given regular expression at the curr... | JuliaPackageMirrors/Mustache.jl | src/scanner.jl | Julia | mit | 1,446 |
#-------------------------------------------------------------------
#* 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/water_steam/power_plant/CorrenteVap.jl | Julia | mit | 1,944 |
module Translation
using Random
const filename = joinpath(tempdir(), "translation-$(randstring()).jld")
module Writing
using JLD
import ..Translation: filename
mutable struct MyType
a::Int
end
jldopen(filename, "w") do file
truncate_module_path(file, Writing)
write(file, "x", MyType(3))
end
end # Wri... | JuliaIO/JLD.jl | test/type_translation.jl | Julia | mit | 760 |
using ColorTypes
using ColorTypes.FixedPointNumbers
using Test
@isdefined(CustomTypes) || include("customtypes.jl")
using .CustomTypes
SP = VERSION >= v"1.6.0-DEV.771" ? " " : "" # JuliaLang/julia #37085
@testset "single color" begin
iob = IOBuffer()
cf = RGB{Float32}(0.32218,0.14983,0.87819)
c = conv... | SimonDanisch/ColorTypes.jl | test/show.jl | Julia | mit | 6,095 |
struct Iterator_C{T <: Iterable}
ptr::Ptr{Void}
src::T
end
export Iterator_C, free, iterate
function iterator_type(ptr::Ptr{Void})
t = ccall((:cass_iterator_type, libcass), Cint, (Ptr{Void},), ptr)
IteratorTypes[t]
end
free(it::Iterator_C) = ccall((:cass_iterator_free, libcass), Void, (Ptr{Void},), ... | alkan/CassandraDriver.jl | src/iterator.jl | Julia | apache-2.0 | 1,160 |
function deferred_acceptance(prop_prefs::Matrix{Int}, resp_prefs::Matrix{Int}, caps::Vector{Int})
p = size(prop_prefs, 2)
r = size(resp_prefs, 2)
prop_matched = Array(Int, p)
for i in 1:p
prop_matched[i] = -1
end
resp_matched = zeros(Int, sum(caps))
indptr = Array(Int, r+1... | EikiTakigawa/Deferred-Acceptance | DA_Many_to_1.jl | Julia | apache-2.0 | 3,188 |
module GeneralizedMaps
using Compat
using Docile
export OrientedDart, Dart, id, ids, GeneralizedMap, sew, collectcelldarts, collectkcells, countkcells, Orbit, OrbitBut
type OrientedDart{T, S}
index::T
# involutions or references to other darts in the GeneralizedMap
phi::Vector{Nullable{OrientedDart{T,S}}}... | goldnd/GeneralizedMaps | src/GeneralizedMaps.jl | Julia | bsd-2-clause | 13,264 |
module TestMax
using StreamStats
using Distributions
using Base.Test
# Max of uniform draws
for n in rand(1:1_000_000, 100)
xs = rand(n)
stat = StreamStats.Max()
for x in xs
update!(stat, x)
end
online_m = maximum(stat)
online_ms = state(s... | JuliaPackageMirrors/StreamStats.jl | test/max.jl | Julia | mit | 459 |
using StatsModels
@test terms(rcopy(R"y ~ x + (1 | g)")) == terms(@formula y ~ x + (1 | g))
@test terms(rcopy(R"y ~ x + (1 | g) + (1 | d)")) == terms(@formula y ~ x + (1 | g) + (1 | d))
@test terms(rcopy(R"y ~ (a + b) * c")) == terms(@formula y ~ (a + b) * c)
@test terms(rcopy(R"y ~ c : (a + b)")) == terms(@formula y ... | JuliaStats/RCall.jl | test/convert/formula.jl | Julia | mit | 1,449 |
module TestAudioIO
using FactCheck
using AudioIO
import AudioIO.AudioBuf
const TEST_SAMPLERATE = 44100
const TEST_BUF_SIZE = 1024
include("testhelpers.jl")
type TestAudioStream <: AudioIO.AudioStream
root::AudioIO.AudioMixer
info::AudioIO.DeviceInfo
function TestAudioStream()
root = AudioMixer... | ssfrr/AudioIO.jl | test/test_AudioIO.jl | Julia | mit | 2,729 |
# Check that we can read the official HDF5 example files
urlbase = "http://www.hdfgroup.org/ftp/HDF5/examples/files/exbyapi/"
using HDF5
fcmp = [0 1 2 3 4 5 6;
2 1.66667 2.4 3.28571 4.22222 5.18182 6.15385;
4 2.33333 2.8 3.57143 4.44444 5.36364 6.30769;
6 3 3.2 3.85714 4.66667 5.54545 6.46154]'
icmp = [0 ... | jpata/HDF5.jl | test/readremote.jl | Julia | mit | 3,008 |
module TNorms
#using Debug
using ..Norms.TNorm
type AlgebraicProduct <: TNorm
end
type BoundedDifference <: TNorm
end
type DrasticProduct <: TNorm
end
type EinsteinProduct <: TNorm
end
type HamacherProduct <: TNorm
end
type Minimum <: TNorm
... | altieresdelsent/JuliaFuzzy | src/norm/t/TNorms.jl | Julia | mit | 331 |
using CompileBot
snoop_bench(
BotConfig(
"Plots",
),
joinpath(@__DIR__, "precompile_script.jl"),
)
| tbreloff/Plots.jl | deps/SnoopCompile/snoop_bench.jl | Julia | mit | 120 |
@test iscyclic(permcycs((1,2,3)))
@test iscyclic(permcycs((42,100,3)))
@test !iscyclic(permcycs((1,2), (3,4)))
| jlapeyre/PermutationsA.jl | test/predicates_test.jl | Julia | mit | 111 |
Base.bits(b::Ubound) = string("$(bits(b.lower)) -> $(bits(b.upper))")
function Base.show{ESS,FSS}(io::IO, x::Ubound{ESS,FSS})
@typenames
print(io, "$bname($(x.lower), $(x.upper))")
end
| REX-Computing/unumjl | src/ubound/ubound-hlayer.jl | Julia | mit | 191 |
using MinMaxFilter
using Base.Test
using MAT
# #######
#
# 1 dimension
#
# Compare to matlab slowminmaxfilt_algo.m
#
# t = [1:1024] ./1024; d = sin(2*pi*4*t);
# [minval, maxval] = slowminmaxfilt_algo(d, 100)
# dlmwrite('minmax_output.txt',[minval; maxval], 'delimiter', '\t', 'precision', '%.12f')
#
# ######
matlab =... | codles/MinMaxFilter.jl | test/runtests.jl | Julia | mit | 2,019 |
# Test import macro
import Import: encap, @imports
using Base.Test
@imports "./a/index"
@test a == 1
@test b == 2
@test_throws UndefVarError c
@imports "./a/index" a b c
@test a == 1
@test b == 2
@test c == 3
# aliasing
@imports "./a/index" a => f b c
@test f == 1
@imports "./a" a=>f b=>g c=>h
@test f == 1
@test ... | openbohemians/Import.jl | test/testimport.jl | Julia | mit | 358 |
## Classical derivative-based, iterative, root-finding algorithms: Newton and Halley
## Newton
function newton_itr(f, fp, x0;
xtol=4*eps(), xtolrel=4*eps(), ftol=4*eps(),
maxsteps=100, maxfnevals=100)
update = (o) -> begin
xn = o.xn[end]
fxn = o.fxn[end]
... | JuliaPackageMirrors/Roots.jl | src/newton.jl | Julia | mit | 4,208 |
using Test
using StaticArrays
using Polyhedra
@testset "Element" begin
@testset "RemProj" begin
r = Ray([1//1, -5//1, 0//1])
l = Line([-15//1, 75//1, -26//1])
r = Polyhedra.remproj(r, l)
@test r isa Ray
@test coord(r) == [1//1, -5//1, -15//1]
@test r == Ray([1, -5, -... | blegat/Polyhedra.jl | test/elements.jl | Julia | mit | 2,788 |
export scorePkg
const REQUIRE_EXISTS = 20.
const REQUIRE_VERSION = 20.
const LICENSE_EXISTS = 10.
const LICENSE = 0.
const LICENSE_FILE = 0.
const TEST_EXISTS = 20.
const TEST_RUNTESTS = 10.
const TEST_PASSES = 20.
const TEST_NOWARNING = 10.
const TEST_TRAVIS = 10.
const MAX_PKG_SCORE = REQUIRE_EXISTS + REQUIRE_VERSIO... | aviks/PackageEvaluator.jl | src/score.jl | Julia | mit | 3,675 |
using Distributions
using DataFrames
using Base.Test
using MCInsurance
get_lc_cat = function(i::Int)
[tf.init-lc.all[i,:ph_y_birth], # curr. age
if lc.all[i,:ph_gender] == "M" 1 else 2 end, # gender
lc.all[i,:ph_qx_be_name], # best est qx
df_lc_prod[lc.all[i,:prod_id],:int... | mkriele/MCInsurance.jl | test/Bucket.jl | Julia | mit | 7,231 |
"""
JavaRef is abstract parent for JavaLocalRef, JavaGlobalRef, and JavaNullRef in the JavaCall Module
It is distinct from its parent type, JavaCall.JNI.AbstractJavaRef, since its use is defined in
JavaCall itself rather than the JNI submodule.
"""
abstract type JavaRef <: JNI.AbstractJavaRef end
"""
... | aviks/JavaCall.jl | src/core.jl | Julia | mit | 20,956 |
using Test
include("trinary.jl")
@testset "trinary 1 is decimal 1" begin
@test trinary_to_decimal("1") == 1
end
@testset "trinary 2 is decimal 2" begin
@test trinary_to_decimal("2") == 2
end
@testset "trinary 10 is decimal 3" begin
@test trinary_to_decimal("10") == 3
end
@testset "trinary 11 is decimal... | exercism/xjulia | exercises/practice/trinary/runtests.jl | Julia | mit | 1,061 |
s = """
module Test
export foobar
end
"""
msgs = lintstr(s)
@assert( contains( msgs[1].message, "undefined symbol" ))
| tkelman/Lint.jl | test/module.jl | Julia | mit | 119 |
using Resampling
using RDatasets
using GURLS
# Load the iris dataset
iris = dataset("datasets","iris")
iris_train, iris_test = splitrandom(iris, 0.7)
# Regress SepalWidth on PetalLength, PetalWidth, and the Interaction between the two
m = train(SepalWidth ~ PetalLength * PetalWidth,data = iris_train, kerne... | joehuchette/GURLS.jl | demo/iris.jl | Julia | mit | 443 |
module TextWrap
export
wrap,
print_wrapped,
println_wrapped
function _expand_tabs(text::String, i0::Int)
out_buf = IOBuffer()
i = i0 % 8
for c in text
if c == '\t'
while i < 8
print(out_buf, ' ')
i += 1
end
i = 0
... | sjkelly/TextWrap.jl | src/TextWrap.jl | Julia | mit | 8,147 |
using Mocha
backend = GPUBackend()
init(backend)
include("mnist-layers.jl")
train_net = Net("train-net", backend, [train_dl, non_data_layers...])
test_net = Net("test-net", backend, [test_dl, non_data_layers...])
adam_instance = Adam()
params = make_solver_parameters(adam_instance;
max_iter=500_000,
regu_co... | jeff-regier/Mocha.jl | examples/variational-bayes/aevb.jl | Julia | mit | 813 |
type KMeansOutput
assignments::Vector{Int64}
centers::Matrix{Float64}
iterations::Int64
rss::Float64
converged::Bool
end
KMeansOutput() = KMeansOutput(Int64[], Float64[], 0, 0.0, false)
function show(io::IO, results::KMeansOutput)
println(io, "Cluster Assignments:")
println(io, results.assignments)
pr... | axsk/Clustering.jl | src/types.jl | Julia | mit | 1,380 |
using DataFrames, ROOTDataFrames
N = 10000
#pre-allocate input data
bigdf = similar(
#here we define TTree structure
DataFrame(
evt=Int64[],
njet=Int64[],
jet_pt=Vector{Float64}[],
jet_eta=Vector{Float64}[],
jet_id=Vector{Int64}[],
nlep=Int64[],
lep_pt... | jpata/ROOTDataFrames.jl | examples/make_tree.jl | Julia | mit | 1,206 |
using OdinSon
using Distributions
# API ideas
function gpar(;kwargs...)
Dict{Symbol, Any}(kwargs)
end
# A recursive merge is needed to deal with nested dicts
#TODO: this needs tests. It also might not do the write thing if one value is a dict, and the other is not.
# though I am not sure this is even valid gpar s... | gabrielgellner/OdinSon.jl | examples/boxplot/categorical.jl | Julia | mit | 5,053 |
#!/usr/bin/env julia
#
# @license Apache-2.0
#
# Copyright (c) 2018 The Stdlib 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
#
# U... | stdlib-js/stdlib | lib/node_modules/@stdlib/stats/base/dists/discrete-uniform/variance/test/fixtures/julia/runner.jl | Julia | apache-2.0 | 1,812 |
export partition_sparse
using SparseArrays
function partition_sparse(colptr, nnz, sz, nparts)
nnz_per_chunk = nnz/nparts
dom = ArrayDomain(map(x->1:x, sz))
nxt = nnz_per_chunk
colstart = 1
splits = UnitRange[]
for i=1:nparts-1
idxs = searchsorted(colptr, nxt)
if length(idxs) == ... | shashi/ComputeFramework.jl | src/array/sparse_partition.jl | Julia | mit | 1,054 |
using Test
using DandelionWebSockets: CloseRequest, SocketClosed, protocolstate
using DandelionWebSockets: PongMissed, STATE_CLOSING
@testset "Connection management " begin
@testset "the server initiates a closing handshake" begin
@testset "state is CLOSING" begin
logic, handler, writer = make... | dandeliondeathray/WebSocketClient.jl | test/client_protocol_connection_test.jl | Julia | mit | 5,406 |
module ParallelSparseMatMul
using Compat
import Base: ==, ctranspose, transpose, *, At_mul_B, Ac_mul_B, A_mul_B!, At_mul_B!,
Ac_mul_B!, sdata, size, display, getindex, SparseMatrix.SparseMatrixCSC
export getindex, getindex_cols, shspeye, shsprand, shsprandn, shmem_randsample,
SharedBilinearOperator, ... | madeleineudell/ParallelSparseMatMul.jl | src/ParallelSparseMatMul.jl | Julia | bsd-2-clause | 529 |
#=
This object represents a Telegram user or bot.
Field Type Description
id Integer Unique identifier for this user or bot
first_name String User‘s or bot’s first name
last_name String Optional. User‘s or bot’s last name
username String Optional. User‘s or bot’s usernam... | Fazendaaa/Julia-Telegram-Bot | src/objects.jl | Julia | mit | 23,215 |
using Taste
using FactCheck
facts("Have a beer") do
todays_selection = [
Lambic = Bitter(rand(11:23))
Blonde = Bitter(rand(15:30))
Kölsch = Bitter(rand(18:25))
Märzen = Bitter(rand(18:25))
English = Bitter(rand(20:35))
Porter = Bitter(rand(20:40))
Brown = Bitter(rand(15:25))
No... | jiahao/Taste.jl | test/runtests.jl | Julia | mit | 785 |
export Parameters
immutable Parameters
mu::Integer
lambda::Integer
mutrate::AbstractFloat
targetfitness::AbstractFloat
numinputs::Integer
numoutputs::Integer
numperlevel::Integer
numlevels::Integer
numlevelsback::Integer
funcs::Vector{Func}
fitfunc::Function
end
function... | glesica/CGP.jl | src/Parameters.jl | Julia | mit | 659 |
module ELF
include("constants.jl")
using StrPack
using DWARF
using ObjFileBase
import Base: start, next, done, endof, length, getindex
import Base: read, readuntil, write, readbytes, seek, seekstart, position
import Base: show, showcompact
import Base: sizeof
import ObjFileBase: ... | ambujone/DIDebug | src/ELF.jl | Julia | mit | 22,366 |
using DataFrames, Gadfly
srand(123)
D = convert(DataFrame, 99*rand(4, 4)+0.5)
xsc = Scale.x_continuous(minvalue=0.0, maxvalue=100)
ysc = Scale.y_continuous(minvalue=0.0, maxvalue=100)
plot(D, x=:x1, y=:x2, xend=:x3, yend=:x4, Geom.segment(arrow=true), xsc, ysc)
plot(D, x=:x1, y=:x2, xend=:x3, yend=:x4, Geom.vec... | JuliaPackageMirrors/Gadfly.jl | test/vector.jl | Julia | mit | 336 |
_fill_tuples_expr(inner::Function, SZ::Tuple{Int}, inds...) =
:(tuple($(ntuple(i->inner(i, inds...), SZ[1])...)))
_fill_tuples_expr{N}(inner::Function, SZ::NTuple{N, Int}, inds...) =
:(tuple($(ntuple(i->_fill_tuples_expr(inner, SZ[1:end-1], i, inds...),SZ[end])...)))
fill_tuples_expr(inner::Function, SZ::Tuple... | mschauer/FixedSizeArrays.jl | src/constructors.jl | Julia | mit | 6,558 |
#Node Superclass
abstract _Node{K,V}
#Internal Node - binary version
type Node{K,V} <: _Node{K,V}
key::K
value::V
left::_Node{K,V}
right::_Node{K,V}
end
#Leaf class, might be too formal
type Leaf{K,V} <: _Node{K,V}
end
#constructors for node class
Node{K,V}(key::K, value::V) = Node{K,V}(key, value, L... | PaulTheodorPyl/Genomic.jl | src/Classes.jl | Julia | mit | 2,387 |
@defstruct ChannelPoolingLayer Layer (
name :: String = "channel-pooling",
(bottoms :: Vector{Symbol} = Symbol[], length(bottoms) > 0),
(tops :: Vector{Symbol} = Symbol[], length(tops) == length(bottoms)),
(kernel :: Int = 1, kernel > 0),
(stride :: Int = 1, stride > 0),
(pad :: NTuple{2, Int} = (0,0), all(... | rened/Mocha.jl | src/layers/channel-pooling.jl | Julia | mit | 4,529 |
@compat function barplot(;x::AbstractVector = Int[],
y::AbstractVector = Int[],
y2::AbstractVector = Int[],
group::AbstractVector = Int[],
stacked::Bool = false,
horizontal::Bool = false,
normalize::Bool = false)... | slowbrain/Vega.jl | src/derived/barplot.jl | Julia | mit | 2,013 |
module Elliptic
# elliptic integrals of 1st/2nd/3rd kind
export E, F, K, Pi
# jacobi elliptic functions
export Jacobi
# matlab compatible
export ellipj, ellipke
include("jacobi.jl")
include("slatec.jl")
function E(phi::Float64, m::Float64)
if isnan(phi) || isnan(m) return NaN end
if m < 0. || m > 1. throw(D... | nolta/Elliptic.jl | src/Elliptic.jl | Julia | mit | 3,567 |
"""
Simple evaluators implement a single objective function, and use the genotype
of a species when performing the evaluation (as opposed to using some later
stage of development).
"""
type SimpleEvaluator <: Evaluator
evaluator::Function
stage::AbstractString
threads::Int
end
"""
Provides a definition for a sim... | ChrisTimperley/Wallace.jl | src/evaluator/_simple.jl | Julia | mit | 1,219 |
module UnitQuaternions
import Base: +, -, ^, ==, ×, angle, inv, log, mean, show, getindex
export UnitQuaternion, ⊕, ⊞, ⊟, axis, covariance, rotatevector, rotateframe, rotationmatrix, slerp, vector
const EPS = 1e-9
####################################################################################################
#... | kam3k/UnitQuaternions.jl | src/UnitQuaternions.jl | Julia | mit | 9,578 |
## Return the linear predictor vector
function linpred!(out, p::LinPred, f::Real=1.)
if f == 0
A_mul_B!(out, p.X, p.beta0)
else
beta0 = p.beta0
delbeta = p.delbeta
scbeta = p.scratchbeta
@inbounds for i = 1:length(scbeta)
scbeta[i] = beta0[i] + f*delbeta[i]
... | abhijithch/GLM.jl | src/linpred.jl | Julia | mit | 6,870 |
Dict(
2 => Symbol[:dot,:floor,:max,:any,:ldexp,:ceil,:normalize,:all,:log,:mod,:cross,:trunc,:round,:min]
3 => Symbol[:round,:ceil,:trunc,:floor,:fma,:any,:all,:clamp]
1 => Symbol[:atanh,:tanh,:exp2,:floor,:max,:any,:sin,:tan,:modf,:step,:log2,:acosh,:ceil,:normalize,:length,:atan,:all,:log,:isnan,:trunc,:a... | JuliaGL/GLBackend.jl | src/transpiler/gl_inbuild_funs.jl | Julia | mit | 416 |
# Geometry which displays points at given (x, y) positions.
immutable PointGeometry <: Gadfly.GeometryElement
tag::Symbol
function PointGeometry(; tag::Symbol=empty_tag)
new(tag)
end
end
const point = PointGeometry
function element_aesthetics(::PointGeometry)
[:x, :y, :size, :color]
end
... | tbreloff/Gadfly.jl | src/geom/point.jl | Julia | mit | 1,710 |
"""
makecpt(cmd0::String="", arg1=nothing; kwargs...)
Make static color palette tables (CPTs).
Full option list at [`makecpt`]($(GMTdoc)makecpt.html)
- **A** | **alpha** | **transparency** :: [Type => Str]
Sets a constant level of transparency (0-100) for all color slices.
($(GMTdoc)makecpt.html#a)
- $(GMT... | joa-quim/GMT.jl | src/makecpt.jl | Julia | mit | 6,349 |
# keep data from Preintegration process
using TransformUtils
using PyCall
using PyLCM
using RoME
function gen_bindings()
@show lcmtpath = joinpath(dirname(@__FILE__),"lcmtypes")
run(`lcm-gen -p --ppath $(lcmtpath) $(lcmtpath)/devjl_preint_d33_short_t.lcm`)
println("Adding lcmtypes dir to Python path: $(l... | dehann/RoME.jl | examples/parselcmlog.jl | Julia | mit | 1,966 |
using TargetedLearning.LReg
using StatsFuns
facts("Testing LReg") do
n, p, newn = 50, 3, 20
srand(10)
x = rand(n, p)
y = round(rand(n))
newx = rand(newn, p)
context("without offest or weights") do
lrfit = lreg(x, y)
@fact lrfit --> is_a(LR)
@fact predict(lrfit, newx) -... | lendle/TargetedLearning.jl | test/LReg.jl | Julia | mit | 1,892 |
#!/usr/bin/env julia
#
# @license Apache-2.0
#
# Copyright (c) 2018 The Stdlib 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
#
# U... | stdlib-js/stdlib | lib/node_modules/@stdlib/number/float64/base/from-binary-string/test/fixtures/julia/runner.jl | Julia | apache-2.0 | 1,777 |
#################################################################
######################## BELIEF #################################
#################################################################
# For tools supporting belief updates see POMDPToolbox.jl
"""
Abstract type for an object that defines how the belief sh... | sisl/POMDPs.jl | src/belief.jl | Julia | mit | 2,360 |
### Nuclear attraction term
function Aterm( i::Int64, r::Int64, u::Int64, l1::Int64, l2::Int64,
ax::Float64,bx::Float64,cx::Float64, gamma::Float64)
term1 = (-1)^(i+u)*binomial_prefactor(i,l1,l2,ax,bx)
term2 = factorial(i)*cx^(i-2r-2u)
term3 = (1/4/gamma)^(r+u)/factorial(r)/factorial(u)/fac... | f-fathurrahman/ffr-ElectronicStructure.jl | LO_Gaussian/nuclear.jl | Julia | mit | 5,440 |
# NOTE(tim):
# value V will be placed in bin B if V ∈ [Bₗ Bᵣ)
# (or V ∈ [Bₗ Bᵣ] if B is the rightmost bin)
# TODO(tim):
# handle NA
# handle Nullable
# handle NaN
# ability to specify decoding behavior
const DEFAULT_LIN_DISC_FORCE_OUTLIERS_TO_CLOSEST = true
immutable LinearDiscretizer{N<:Real, D<:Integer} <: Abstra... | JuliaPackageMirrors/Discretizers.jl | src/linear_discretizer.jl | Julia | mit | 7,964 |
module CPLEX
using Compat
@osx_only Libdl.dlopen("libstdc++",Libdl.RTLD_GLOBAL)
include("../deps/deps.jl")
### imports
import Base.convert, Base.show, Base.copy
# Standard LP interface
importall MathProgBase.SolverInterface
# exported functions
# export is_valid,
# s... | sbebo/CPLEX.jl | src/CPLEX.jl | Julia | mit | 2,375 |
module TestZpk
using CustomTest
using Base.Test
using ControlSystems
# Naming convention:
# ------------------
# {type}_{dims}
# type: C: Continuous, D: Discrete
# dims: "npnuny" (np = # poles)
# CONTINUOUS
C_111 = zpk([-2],[-5],1)
C_211 = zpk([-1+sqrt(2)im,-1-sqrt(2)im], [-5,-3],1)
C_212 = zpk(vecarray(2, 1, [-1+sqr... | JuliaPackageMirrors/ControlSystems.jl | test/test_zpk.jl | Julia | mit | 5,152 |
# GMM estimation for a sample from Chi^2(theta)
# compare to two method of moments estimators (see chi2mm.m)
using Econometrics, Random, Distributions, Plots
function main()
n = 30
theta = 3.0
reps = 1000
results = zeros(reps,2)
y = zeros(n) # this is just a place holder to define the moments, below
# define the momen... | mcreel/Econometrics | Examples/GMM/EfficientGMM.jl | Julia | mit | 1,029 |
# A form is something that ends up as geometry in the graphic.
abstract FormPrimitive
immutable Form{P <: FormPrimitive} <: ComposeNode
primitives::Vector{P}
end
function isempty(f::Form)
return isempty(f.primitives)
end
function isscalar(f::Form)
return length(f.primitives) == 1
end
function draw(... | tkelman/Compose.jl | src/form.jl | Julia | mit | 30,349 |
myDict=Dict{AbstractString, Int}()
myDict["Hi"] = 37
myDict["ho"] = 23
print(barplot(myDict))
myPlot=barplot(["Please","don't","crash","my","friend"], [10,24,30,13,7])
barplot!(myPlot, "and", 5)
print(myPlot)
barplot!(myPlot, ["just", "dont", "!"], [2, 49, 15])
@test_throws DimensionMismatch barplot!(myPlot, ["just", ... | JuliaPackageMirrors/UnicodePlots.jl | test/tst_plots.jl | Julia | mit | 8,501 |
#TODO keep max/min, prevent relim
using Munkres
using PyCall
pygui(:tk) #prevent conflict with gtk
using PyPlot
# remove all keybindings
D = PyCall.PyDict(matplotlib["rcParams"])
for k in keys(D); contains(k, "keymap") && (D[k] = Any[]) end
ioff()
#####
# this visualization module expects functions specific to Galer... | 285714/ncm | master/type/GalerkinViz.jl | Julia | mit | 13,109 |
import Base:
convert,
done,
eltype,
find,
get,
getindex,
isempty,
keys,
length,
linearindexing,
next,
setindex!,
show,
size,
start,
summary,
values,
vcat,
>>,
.==,
.!=,
.>,
.>=,
.<,
.<=,
.+,
.-,
.*,
./,
... | rbt-lang/rbt-proto | jlnext/src/importbase.jl | Julia | apache-2.0 | 350 |
#function all_equal(xs::AbstractArray)
#if isempty(xs)
#return true
#end
#x = xs[1]
#for i in 2:length(xs)
#if xs[i] != x
#return false
#end
#end
#return x
#end
function iszero{T}(x::T)
return x == zero(T)
end
function Maybe(T::Type)
return @comp... | jiahao/Compose.jl | src/misc.jl | Julia | mit | 6,701 |
# Precompile linting some strings for performance
lintstr("""
x, y = 1, 2
for i in 1:10
println(i)
end
if x == 0
let z = 1
println(x + z - y)
end
elseif x == 1 && y == 2
println("precompile")
end
""")
| JuliaPackageMirrors/Lint.jl | src/precompile.jl | Julia | mit | 226 |
module MDFlattenTests
using Test
import Markdown
using Documenter.Utilities.MDFlatten
@testset "MDFlatten" begin
@test mdflatten(Markdown.Paragraph("...")) == "..."
@test mdflatten(Markdown.Header{1}("...")) == "..."
# a simple test for blocks in top-level (each gets two newline appended to it)
@tes... | MichaelHatherly/Lapidary.jl | test/mdflatten.jl | Julia | mit | 2,339 |
using StaticArrays
typealias Vec2d SVector{2,Float64};
type CartesianMesh
nx
ny
Δx
Δy
end
CartesianMesh(nx, ny) = CartesianMesh(nx, ny, 1.0/nx, 1.0/ny);
immutable Cell
id :: Int
x :: Vec2d
vol :: Float64
end
immutable Face
x :: Vec2d
s :: Vec2d
owner :: Int
... | furstj/NSP | lessons/cartesianmesh.jl | Julia | mit | 2,427 |
#pubsub.jl must be run first
using std_srvs.srv
using nav_msgs.srv
#Set up services
const srvcall = ServiceProxy("callme", SetBool)
println("Waiting for 'callme' service...")
wait_for_service("callme")
function srv_cb(req::GetPlanRequest)
println("GetPlan call received")
@test_approx_eq(req.start.pose.positi... | JuliaPackageMirrors/RobotOS.jl | test/services.jl | Julia | mit | 1,727 |
using MultivariateStats
using Base.Test
srand(34568)
## data
m = 9
n = 6
n2 = 3
X = randn(m, n)
A = randn(n, n2)
Xt = X'
b = randn(1, n2)
E = randn(m, n2) * 0.1
Y0 = X * A + E
Y1 = X * A .+ b + E
y0 = Y0[:,1]
y1 = Y1[:,1]
## llsq
A = llsq(X, Y0; trans=false, bias=false)
A_r = copy(A)
@test size(A) == (n, n2)
@... | JuliaPackageMirrors/MultivariateStats.jl | test/lreg.jl | Julia | mit | 3,542 |
SimpleCircuits.Tests.@circuit8
# change the base resistance to a parameter
rb.R = :Rb
params = Dict(:Rb => 1e+3)
# sweep over values of the base resistor
rb_vals = logspace(1., 5., 200)
circ_soln = dc_sweep(circ, :Rb, rb_vals, params)
# plot both the base voltage and the collector voltage against rb
subplot(2, 1, 1... | mridsole/SimpleCircuits.jl | examples/simple_npn.jl | Julia | mit | 758 |
# Get traces
import Base.Profile: LineInfo
typealias IP Uint
typealias RawData Vector{IP}
typealias Trace Vector{LineInfo}
const lidict = (IP=>LineInfo)[]
lookup(ip::IP) = haskey(lidict, ip) ? lidict[ip] : (lidict[ip] = Profile.lookup(ip))
lookup(ips::RawData) = map(lookup, ips)
pruneC(trace::Trace) = filter(line->... | dlfivefifty/Jewel.jl | src/profile/data.jl | Julia | mit | 2,779 |
include("interpolation.jl")
include("wannierize_utils.jl")
using PyPlot
using LinearAlgebra
#using Interpolations
## Assumptions: the kpoints are contained in a NxNxN cartesian grid, the neighbor list must contain the six cartesian neighbors
## N1xN2xN3 grid, filename.mmn must contain the overlaps
## nbeg and nend s... | antoine-levitt/wannier | wannierize.jl | Julia | mit | 13,341 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.