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 |
|---|---|---|---|---|---|
include("tools.jl")
import .DATools: FixedSizeBinaryMaxHeap, length, pop!, push!, top, getindex
function create_resp_ranks(num_props::Int, num_resps::Int, resp_prefs::Vector{Vector{Int}})
resp_ranks = zeros(UInt16, num_props, num_resps)
for j in 1:num_resps
for (r, i) in enumerate(resp_prefs[j])
... | nswa17/DA.jl | src/matchings.jl | Julia | bsd-2-clause | 5,294 |
module Scale
using Color
using Compat
using Compose
using DataArrays
using DataStructures
using Gadfly
using Showoff
import Gadfly: element_aesthetics, isconcrete, concrete_length,
nonzero_length
import Distributions: Distribution
include("color_misc.jl")
# Return true if var is categorical.
functi... | peter1000/Gadfly.jl | src/scale.jl | Julia | mit | 23,028 |
"""
stack(t, by = pkeynames(t); select = Not(by), variable = :variable, value = :value)`
Reshape a table from the wide to the long format. Columns in `by` are kept as indexing columns.
Columns in `select` are stacked. In addition to the id columns, two additional columns labeled
`variable` and `value` are added, c... | JuliaComputing/NDSparseData.jl | src/reshape.jl | Julia | mit | 2,633 |
macro forcartesian(sym, sz, ex)
idim = gensym()
N = gensym()
sz1 = gensym()
isdone = gensym()
quote
if !(isempty($(esc(sz))) || prod($(esc(sz))) == 0)
$N = length($(esc(sz)))
$sz1 = $(esc(sz))[1]
$isdone = false
$(esc(sym)) = ones(Int, $N)
... | cdsousa/Images.jl | src/compatibility/forcartesian.jl | Julia | mit | 959 |
#!/usr/bin/env julia
#=
Author: Tim Sterne-Weiler, 3/16/2015
e-mail: tim.sterne.weiler@utoronto.ca
Calculate enrichment of chimeras over expression level background
using multinomial draws of n=2 to calculate a second multinomial
distribution of gene pairs which is used to compare observed frequency
... | timbitz/aligater | bin/stats.jl | Julia | mit | 15,219 |
# An implementation of CRMR for the solution of the
# (under/over-determined or square) linear system
#
# Ax = b.
#
# The method seeks to solve the minimum-norm problem
#
# min ‖x‖² s.t. Ax = b,
#
# and is equivalent to applying the conjugate residual method
# to the linear system
#
# AA'y = b.
#
# This method is e... | vepiteski/Krylov.jl | src/crmr.jl | Julia | mit | 4,092 |
using Test
using AtariAlgos
gamename = "breakout"
game = AtariEnv(gamename)
policy = RandomPolicy()
ep = Episode(game, policy)
for sars in ep
end
@info "total reward: $(ep.total_reward)"
| tbreloff/AtariAlgos.jl | test/runtests.jl | Julia | mit | 189 |
using ProximalOperators
function agd(X, y, x0, f, g, eps, λ, maxiter, stepsize, num_data,prox_operator)
x_k = x0
x_old = x0
oval = Inf
val_array = zeros(0)
stop_array = zeros(0)
gval = g(x_k)
for i in 1:maxiter
# Logistic-regression with l2-norm of lambda
fval = f(x_k)
... | zagazao/num-opt | src/opt/AGD.jl | Julia | mit | 791 |
using PyPlot, Polynomials, CoolProp, Roots, JLD
using JFVM
include("rel_perms_real.jl")
# some data
MW_water = 0.018 # [kg/mol]
MW_oil = 0.142 # [kg/mol]
MW_DME = 0.04607 # [kg/mol]
# Fig 4, SPE-177919, T = 70 degC, p = 2000 psi
x_DME_oil = [0.0, 0.04, 0.10, 0.39, 0.62] # [mol frac]
w_DME_oil = MW_DME*x_D... | simulkade/peteng | physicalproperties/dme_simulation_no_pc_case02.jl | Julia | mit | 13,882 |
#!/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/poisson/cdf/test/fixtures/julia/runner.jl | Julia | apache-2.0 | 2,023 |
# The concept and trivial implementation of graph visitors
abstract AbstractGraphVisitor
# trivial implementation
# invoked when a vertex v is encountered for the first time
# this function returns whether to continue search
discover_vertex!(vis::AbstractGraphVisitor, v) = true
# invoked when the algorithm is about... | ggggggggg/Graphs.jl | src/graph_visit.jl | Julia | mit | 2,662 |
@defstruct Index2OnehotLayer Layer (
name :: String = "index2onehot",
(dim :: Int = -2, dim != 0),
(tops :: Vector{Symbol} = Symbol[], length(tops) > 0),
(bottoms :: Vector{Symbol} = Symbol[], length(bottoms) == length(tops)),
(n_class :: Int = 0, n_class > 0)
)
type Index2OnehotLayerState <: LayerState
la... | shyamalschandra/Mocha.jl | src/layers/index2onehot.jl | Julia | mit | 1,879 |
module Light
export Polar, Stokes, PolEllipse, rotate, mean, convert, measurements2stokes, stokes2polar
import Base: mean, convert, +, *, /
immutable Stokes{T <: AbstractFloat}
s0::T
s1::T
s2::T
s3::T
function Stokes(s0,s1,s2,s3)
if (s0 < 0) || (s1*s1 + s2*s2 + s3*s3 > s0*s0)
s0 = s1 = s2 = s3 = T(NaN)
e... | yakir12/polarimetryLab | src/Light.jl | Julia | mit | 2,869 |
using GraphTools
using Base.Test
if VERSION.minor < 5
macro testset(name, block)
eval(block)
end
end
@testset "GraphTools" begin
@testset "Undirected Graph" begin
include("undirected.jl")
end
@testset "Directed Graph" begin
include("directed.jl")
end
@testset "GraphStore" begin
include("... | wookay/GraphTools.jl | test/runtests.jl | Julia | mit | 346 |
#=
Implementation of shootf, the Numerical Recipes
algorithm for solving a boundary value problem
by shooting to a fixed point.
=#
# provides c0, G, m_H, k_B, sigma_sb, a_rad, Msun, Rsun, Lsun
include("constants.jl")
include("physics.jl")
include("opacity.jl")
include("derivs.jl")
include("nr.jl")
function load1(m, P... | adwasser/StarStruc.jl | src/shootf.jl | Julia | mit | 5,690 |
using Distributions
using JSON
mu = 2
s = 5
d = Logistic( mu,s )
x = linspace( -0.2, 0.2, 400 )
dmgf(t) = mgf(d, t )
y = map( dmgf, x )
println( y )
data = Dict([
("mu", mu),
("s", s),
("data", x),
("expected", y)
])
outfile = open("./test/fixtures/array.json", "w")
JSON.json(data)
write( outfile, JSON.json(d... | distributions-io/logistic-mgf | test/fixtures/test.array.jl | Julia | mit | 327 |
#custom extenstion of CudaArray in CUDArt for sparse vectors/matrices
#using CSC format for interop with Julia's native sparse functionality
import Base: length, size, ndims, eltype, similar, pointer, stride,
copy, convert, reinterpret, show, summary, copy!, get!, fill!, issym,
ishermitian, isupper, islower
im... | denizyuret/CUSPARSE.jl | src/util.jl | Julia | mit | 10,198 |
struct PaintContext
device
yardstick::Float64
min_fontsize::Float64
end
function push_style(context::PaintContext, style)
save_state(context.device)
if style !== nothing
for (key, value) in style
if key == :fontsize
value = max(value*context.yardstick, context.m... | nolta/Winston.jl | src/paint.jl | Julia | mit | 8,544 |
# Predefined regularizers
# You may also implement your own regularizer by subtyping
# the abstract type Regularizer.
# Regularizers should implement `evaluate` and `prox`.
# TO DO:
# document this stuff better
# tidy up the interfaces a la losses.jl
import Base.scale!, Roots.fzero
export Regularizer, # abstract t... | zhmz90/LowRankModels.jl | src/regularizers.jl | Julia | mit | 8,155 |
export cgls
function cgls{T1,T2}(A::SparseMatrixCSC{T1,Int},b::Array{T2,1}; kwargs...)
T = promote_type(T1,T2)
x1 = zeros(T,size(A,1))
x2 = zeros(T,size(A,2))
Af(x,flag) = (flag=='F') ? A_mul_B!(1.0,A,x,0.0,x1) : At_mul_B!(1.0,A,x,0.0,x2)
return cgls(Af,b;kwargs...)
end
cgls(A,b::Vector;kwa... | JuliaPackageMirrors/KrylovMethods.jl | src/cgls.jl | Julia | mit | 4,185 |
function DotTest(m_rand,d_rand,operators,parameters)
# Dot product test for a vector of linear operators
m_adj = LinearOperator(d_rand,operators,parameters,adj=true)
d_fwd = LinearOperator(m_rand,operators,parameters,adj=false)
inner1 = InnerProduct(d_rand,d_fwd)
inner2 = InnerProduct(m_rand,m_adj)
println("<d_r... | JuliaPackageMirrors/Seismic.jl | src/Tools/DotTest.jl | Julia | mit | 1,891 |
using GLVisualize, AbstractGPUArray, GLAbstraction, GeometryTypes, Reactive, ColorTypes
using Meshes, MeshIO, FileIO, WavefrontObj, GLFW
global const T = Float32
function fold_pivot(v0, v1)
xt, yt, zt, translation = v1
xrot = Quaternions.qrotation(v0.xaxis, xt)
yrot = Quaternions.qrotation(v0.yaxis, yt)
zrot = Qu... | staticfloat/GLVisualize.jl | test/test_color.jl | Julia | mit | 3,657 |
using LowRankModels
using Distributions
# This is just to create a low-rank representation of some count data, I don't care how accurate it is.
m,n = 100, 50;
k = 2;
A = rand(Poisson(),(m,n));
losses = convert(Array{Loss,1}, fill(poisson(10),n));
rx, ry = ZeroReg(), ZeroReg();
g_pre = GLRM(A, losses, rx, ry, k, scale=... | jaehyunp/LowRankModels.jl | test/poisson_test.jl | Julia | mit | 831 |
include("Grp/Agnostic.jl")
include("Grp/GenGrp.jl")
include("Grp/SmallGroups.jl")
include("Grp/Morphisms.jl")
| thofma/Hecke.jl | src/Grp.jl | Julia | bsd-2-clause | 110 |
"""
`CALCULATE_AFFINE` - Compute left-hand affine transform from two Nxd point sets
```
tform = calculate_affine(moving_pts, fixed_pts)
```
* moving_pts: Nxd array, each row being homogeneous coords of a point, of the
point set that is moving to fit the fixed point set.
* fixed_pts: Nxd array, each row being hom... | JuliaPackageMirrors/ImageRegistration.jl | src/transforms.jl | Julia | mit | 3,848 |
module TestSort
using DataFrames, Random, Test, CategoricalArrays
@testset "standard tests" begin
dv1 = [9, 1, 8, missing, 3, 3, 7, missing]
dv2 = [9, 1, 8, missing, 3, 3, 7, missing]
dv3 = Vector{Union{Int, Missing}}(1:8)
cv1 = CategoricalArray(dv1, ordered=true)
d = DataFrame(dv1 = dv1, dv2 = d... | JuliaStats/DataFrames.jl | test/sort.jl | Julia | mit | 5,915 |
using CUSPARSE
using CUDArt
using Base.Test
m = 25
n = 35
k = 10
blockdim = 5
##############
# test_axpyi #
##############
function test_axpyi!(elty)
x = sparsevec(rand(1:m,k), rand(elty,k), m)
y = rand(elty,m)
d_x = CudaSparseVector(x)
d_y = CudaArray(y)
alpha = rand(elty)
d_y = CUSPARSE.axpy... | denizyuret/CUSPARSE.jl | test/axpyi.jl | Julia | mit | 1,153 |
function check_for_skip(cur_item)
has_skip = check_for_test_param(cur_item, "skip")
has_skip
end
| djsegal/julz | src/functions/utils/check_for_skip.jl | Julia | mit | 104 |
include("../../src/global/ImportFolders.jl")
import Config
import Client
import Connection
import Event
global i = 1
global t = time()
global con = Client.create(ip"127.0.0.1", Config.val(:conServerPort), true)
function resp(sock::Base.TCPSocket, data::Array{Any, 1}, ans::Connection.Answer)
global i
global t
g... | tmptrash/jevo | tmp/perf/ClientMyFast.jl | Julia | mit | 627 |
using Knet
using ReinforcementLearning
using ArgParse
using JLD
const GAMMA = 0.95
const WINIT = 0.1
const EPISODES = 1000
function main(args)
s = ArgParseSettings()
s.description = ""
@add_arg_table s begin
("--actor"; nargs='*'; arg_type=Int64)
("--critic"; nargs='*'; arg_type=Int64)
... | ilkerkesen/rl | actor-critic.jl | Julia | mit | 5,614 |
###########################################################################
### ProposalDensities wrapping distributions from the Distributions package
###########################################################################
type SingleSymmetricDistributionWrapper{D<:Distributions.Distribution} <: SymmetricDensity
... | QuantifyingUncertainty/GeneralizedMetropolisHastings.jl | src/proposals/DistributionWrapper.jl | Julia | mit | 4,948 |
############################################################
# joAbstractLinearOperatorInplace ##########################
############################################################
# includes
include("joAbstractLinearOperatorInplace/constructors.jl")
include("joAbstractLinearOperatorInplace/base_functions.jl")
inclu... | slimgroup/JOLI.jl | src/joAbstractLinearOperatorInplace.jl | Julia | mit | 377 |
import YAML: load
type DirectoryStructure
root::AbstractString
tmp::AbstractString
src::AbstractString
bin::AbstractString
store::AbstractString
function DirectoryStructure(root)
new(
root,
joinpath(root, "tmp"),
joinpath(root, "src"),
j... | JuliaPackageMirrors/Playground.jl | src/config.jl | Julia | mit | 3,170 |
function isnorm_fac_elem(K::NfRel{nf_elem}, a::nf_elem)
Ka, mKa, mkK = collapse_top_layer(K)
Kas, KasToKa = simplify(Ka)
Ka = Kas
#mKa = KasToKa * mKa
mkK = mkK * inv(KasToKa)
ZKa = lll(maximal_order(Ka))
C, mC = class_group(ZKa, use_aut = true)
S = collect(keys(factor(mkK(a)*ZKa)))
c = get_attrib... | thofma/Hecke.jl | src/NumField/NfRel/NEQ.jl | Julia | bsd-2-clause | 1,830 |
using Images, FactCheck, Base.Test, Colors
facts("Edge") do
EPS = 1e-14
## Checkerboard array, used to test image gradients
white{T}(::Type{T}) = one(T)
black{T}(::Type{T}) = zero(T)
white{T<:Unsigned}(::Type{T}) = typemax(T)
black{T<:Unsigned}(::Type{T}) = typemin(T)
global checkerboard
... | benmoran/Images.jl | test/edge.jl | Julia | mit | 18,638 |
function basictest(lib::Polyhedra.Library)
@testset "Polyhedron eltype conversion tests with $(typeof(lib))" begin
A = [1 0; 0 1]
b = [0, 0]
linset = BitSet([2])
R = [1 1]
h = hrep(A, b, linset)
v = vrep(A, R)
p = copy(polyhedron(h, lib))
@test hrepis... | blegat/Polyhedra.jl | test/basic.jl | Julia | mit | 1,552 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | mbaijal/incubator-mxnet | julia/src/deprecated.jl | Julia | apache-2.0 | 5,317 |
using RDatasets, DataArrays, Gadfly
plot(dataset("car", "SLID"), x="Wages", color="Language",
Geom.histogram(position=:stack))
| joehuchette/Gadfly.jl | test/stacked_discrete_histogram.jl | Julia | mit | 136 |
using Humanize
using Base.Test
function test_datasize()
println("test_datasize")
tests = [300, 3000, 3000000, 3000000000, 3000000000000, 1e26, 3141592]
results = Dict( :dec => ["450.000 B", "4.500 kB", "4.500 MB", "4.500 GB", "4.500 TB", "150.000 YB", "4.712 MB"],
:bin => ["630.000 B",... | JuliaPackageMirrors/Humanize.jl | test/runtests.jl | Julia | mit | 3,224 |
module RockPaper
import Base.isless
import Base.rand
abstract Variant
type Rock <: Variant
end
type Paper <: Variant
end
type Scissors <: Variant
end
type Lizard <: Variant
end
type Spock <: Variant
end
isless(::Type{Scissors}, ::Type{Rock}) = true
isless(::Type{Lizard}, ::Type{Rock}) = true
isless(::Type{Rock}... | maximvl/julia_challenges | 6_spock.jl | Julia | mit | 1,124 |
using MacroTools
export Parameter
export @gen_convert_parameter, convert_parameter
@doc doc"""
@gen_convert_parameter(model_typename, (keyname, size_fn, default)...)
Generates `convert_parameter(model::model_typename, param::Parameter)`.
# Example
``` julia
@gen_convert_parameter(A, ("A", numbondtypes, 1.0), (... | yomichi/SpinMonteCarlo.jl | src/API/parameter.jl | Julia | mit | 3,250 |
using Distributions
using JSON
lambda = 1
k = 1
d = Weibull( lambda,k )
x = linspace( 1, 0, 25 )
dmgf(t) = mgf(d, t )
y = map( dmgf, x )
println( y )
data = Dict([
("lambda", lambda),
("k", k),
("data", x),
("expected", y)
])
outfile = open("./test/fixtures/matrix.json", "w")
JSON.json(data)
write( outfile, J... | distributions-io/weibull-mgf | test/fixtures/test.matrix.jl | Julia | mit | 337 |
# test the triangle functions etc
using Geometry2D
using PyPlot
srand(1)
p1 = Point(0.1,0.1)
p2 = Point(0.9,0.1)
p3 = Point(0.33,0.9)
t1 = Triangle([p1,p2,p3])
println("area of t1 = $(area(t1))")
figure(30)
hold(false)
plot(0,0)
hold(true)
plot(t1)
println( isin(p1,t1) )
println( isin(p2,t1) )
println( isin(p3,t1) ... | mroughan/Geometry2D.jl | test/test_triangle.jl | Julia | mit | 3,073 |
#=
HNF algorithm due to Arne Storjohann
"A Fast + Practical + Deterministic Algorithm for Triangularizing Integer Matrices"
=#
# This function only changes CC, zero_cols and N but not T.
function conditioning_with_transform!(T::MatElem{S}, N::MatElem{S}, CC::Array{S}, zero_cols::BitArray, row::Int, col1::Int) where S ... | thofma/hecke | src/Misc/HNFstorjohann.jl | Julia | bsd-2-clause | 13,511 |
#=
Computes quantities related to the Gaussian linear state space model
x_{t+1} = A x_t + C w_{t+1}
y_t = G x_t + H v_t
The shocks {w_t} and {v_t} are iid and N(0, I)
@author : Spencer Lyon <spencer.lyon@nyu.edu>
@date : 2014-07-28
References
----------
TODO: Come back and update to match `LinearStat... | QuantEcon/QuantEcon.jl | src/lss.jl | Julia | bsd-3-clause | 7,539 |
struct BlackSwaptionEngine{Y <: YieldTermStructure, S <: SwaptionVolatilityStructure, DC <: DayCount} <: PricingEngine
yts::Y
vol::Quote
volStructure::S
dc::DC
displacement::Float64
end
function BlackSwaptionEngine(yts::Y, vol::Quote, dc::DC, displacement::Float64 = 0.0) where {Y <: YieldTermStructure, DC <:... | pazzo83/JQuantLib | src/pricing_engines/swaptions/black_swaption_engine.jl | Julia | mit | 3,736 |
function vctestnullsim(teststat, evalV, evalAdjV, n, rankX, WPreSim;
device::String = "CPU", nSimPts::Int = 1000000,
nNewtonIter::Int = 15,
test::String = "eLRT", pvalueComputing::String = "chi2",
PrePartialSumW::Array{Float64, ... | Tao-Hu/VarianceComponentTest.jl | src/vctestnullsim.jl | Julia | mit | 14,894 |
using SolveBio
using Base.Test
@test SolveBio.login()["is_active"]
# Depository tests
println("Running depository tests...")
@test SolveBio.Depository.list()["total"] > 240
@test SolveBio.Depository.get("ClinVar")["id"] == 223
@test SolveBio.Depository.get(223)["name"] == "ClinVar"
@test SolveBio.Depository.versions... | JuliaPackageMirrors/SolveBio.jl | test/runtests.jl | Julia | mit | 794 |
# This file is auto-generated by AWSMetadata.jl
using AWS
using AWS.AWSServices: lex_runtime_service
using AWS.Compat
using AWS.UUIDs
"""
delete_session(bot_alias, bot_name, user_id)
delete_session(bot_alias, bot_name, user_id, params::Dict{String,<:Any})
Removes session information for a specified bot, alias... | JuliaParallel/AWS.jl | src/services/lex_runtime_service.jl | Julia | mit | 19,951 |
using Polyhedra
using BenchmarkTools
using StaticArrays
# Intersection/Vector
# BenchmarkTools.Trial:
# memory estimate: 133.73 KiB
# allocs estimate: 2424
# --------------
# minimum time: 454.533 μs (0.00% GC)
# median time: 461.111 μs (0.00% GC)
# mean time: 488.875 μs (4.38% GC)
# ma... | blegat/Polyhedra.jl | perf/runbenchmarks.jl | Julia | mit | 1,760 |
struct ERBFilterbank{C,G,T<:Real,U<:Real,V<:Real} <: Filterbank
filters::Vector{SecondOrderSections{C,G}}
ERB::Vector{T}
center_frequencies::Vector{U}
fs::V
end
function make_erb_filterbank(fs, num_channels, low_freq, EarQ = 9.26449, minBW = 24.7, order = 1)
T = 1/fs
if length(num_channels) == ... | jfsantos/AuditoryFilters.jl | src/ERBFilterbank.jl | Julia | mit | 2,678 |
# Setup functions for MathGL.jl
# resetting all parameters, clear graph
function reset(gr::Graph)
cmgl.set_def_param(gr.ptr)
end
# Transparency options
function alpha(gr::Graph, enable::Bool)
cmgl.set_alpha(gr.ptr, enable)
end
function alpha(gr::Graph, val::Real)
cmgl.set_alpha_default(gr.ptr, val)
end
... | thomastaudt/MathGL.jl | src/setup.jl | Julia | mit | 17,906 |
Γ = gamma
| gajomi/OrderStatistics.jl | src/helpers.jl | Julia | mit | 11 |
function nmex(a::Matrix{Float64}, x::Vector{Float64};
tol::Float64=1.0e-10, limit::Int64=1000, show=0)
iters = 0
n = size(a, 1)
converged = false
local big
while true
iters += 1
x1 = a * x
big = 0.0
for i in 1:n
abs(x1[i]) > abs(big) && (big = x1[i])
end
x1 = x1 / big
... | goedman/NMfE.jl | src/nmlib/nmex.jl | Julia | mit | 491 |
module WebRTCVAD
export sinc_resample, VADInstance, set_mode, valid_rate_and_frame_length,
process
const libvad = joinpath(dirname(@__FILE__), "..", "deps", "libvad")
function sinc_resample(samples_in::Vector{Int16}, in_freq::Integer,
out_freq::Integer)
input_length = length(samples... | jlep/WebRTCVAD.jl | src/WebRTCVAD.jl | Julia | mit | 2,728 |
using RLESUtils, RunUtils, IFTTTUtils
const CONFIG = "flat"
const DATA = "nvn_libcas098smallfilt_10K"
const COMP = gethostname()
function template_gp(i)
"""
using GrammarExpts,ACASX_GP
config=configure(ACASX_GP, "$CONFIG", "$DATA")
acasx_gp(; seed=$i, outdir=Pkg.dir("GrammarExpts/results/ACASX_GP_$(CO... | rcnlee/GrammarExpts.jl | modules/ACASX_GP/scripts/flat_libcas098small_10Kfilt.jl | Julia | apache-2.0 | 525 |
#!/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/math/base/special/acoth/benchmark/julia/benchmark.jl | Julia | apache-2.0 | 2,842 |
using Base.Test
using Compat
using Images, FixedPointNumbers
import VideoIO
testdir = joinpath(Pkg.dir("VideoIO"), "test")
videodir = joinpath(Pkg.dir("VideoIO"), "videos")
VideoIO.TestVideos.available()
VideoIO.TestVideos.download_all()
swapext(f, new_ext) = "$(splitext(f)[1])$new_ext"
println(STDERR, "Testing fil... | Keno/VideoIO.jl | test/avio.jl | Julia | mit | 2,406 |
module Tree
export appendBuffer, appendList, createNesting
export resolveDollar, resolveComma
function appendBuffer(xs, level, buffer)
if level == 0
return vcat(xs, {buffer})
else
res = appendBuffer(xs[end], (level - 1), buffer)
return vcat(xs[1:end-1], {res})
end
end
functio... | JuliaPackageMirrors/CirruParser.jl | src/Tree.jl | Julia | mit | 2,098 |
if VERSION > v"0.5-" && isdefined(Base,:displaysize)
tty_cols = Base.displaysize()[2]
else
tty_cols = Base.tty_size()[2]
end
function set_tty_cols(val::Integer)
global tty_cols = val
end
show_backtraces = true
function set_show_backtraces(val::Bool)
global show_backtraces = val
end
function stringify_er... | JuliaPackageMirrors/RunTests.jl | src/io.jl | Julia | mit | 967 |
using Conda
using Base.Test
already_installed = "curl" in Conda._installed_packages()
@test Conda.exists("curl")
Conda.add("curl")
@unix_only curl_path = joinpath(Conda.PREFIX, "bin", "curl-config")
@windows_only begin
using BinDeps
manager = Conda.Manager(["curl"])
curl_libpath = BinDeps.libdir(manager,... | dhoegh/Conda.jl | test/runtests.jl | Julia | mit | 716 |
using FactCheck
include("returns.jl")
include("methods.jl")
include("const.jl")
include("helpers.jl")
exitstatus()
| JuliaQuant/FinancialAnalytics.jl | test/runtests.jl | Julia | mit | 117 |
using Test, SndLib, WAV
wavDir = "wavDir/"
sf = 48000
nbits = 32
phase = 0
level = 60
dur = 1
rampDur = 0.01
maxLevel = 101
channelOpts = ["right", "left", "diotic", "mono", "odd left", "odd right"]
F0 = 440
harmPhaseOpts = ["sine", "cosine", "alternating", "random", "schroeder-", "schroeder+"]
lowHarm = 1
highHarm = ... | sam81/SndLib.jl | test/test_complexTone.jl | Julia | mit | 980 |
export pmult, imult
export psparse, ParallelSparseMatrix
export SparseMatrixCSR, sparse_csr
type ParallelSparseMatrix{TF}
F::TF
refs::Vector{Any}
procs::Vector{Int}
end
function psparse(F, procs)
ParallelSparseMatrix(
F,
Any[@spawnat(i, fetch(F)) for i in procs],
procs)
end
import Base.At_mul_B
i... | jaak-s/BayesianDataFusion.jl | src/parallel_csr.jl | Julia | mit | 2,865 |
logit(v::Float64) = log(v/(1-v))
inv_logit(w::Float64) = exp(w)/(1+exp(w))
| scidom/CellwiseEditingDifferentiation.jl | src/logit.jl | Julia | mit | 76 |
typealias Fractional Union(FloatingPoint, FixedPoint)
abstract Color{T, N} <: FixedVector{T, N}
abstract AlphaColor{T} <: Color{T, 4}
abstract Color3{T} <: Color{T, 3}
abstract AbstractGray{T} <: Color{T, 1}
abstract Intensity{T} <: Color{T, 1}
abst... | timholy/ColorTypes.jl | src/types.jl | Julia | mit | 4,915 |
module EMLpower_plant
using DanaTypes
using DotPlusInheritance
using Reexport
include("power_plant/CalorEspecifico.jl")
include("power_plant/CoefGlobal_area.jl")
include("power_plant/Dif_Pres.jl")
include("power_plant/Dif_Temp.jl")
include("power_plant/Eficiencia.jl")
include("power_plant/EnergiaInterna.jl")
... | DANA-Laboratory/EMSOModelLibrary.jl | JuliaEMSOModels/water_steam/power_plant.jl | Julia | mit | 2,138 |
# each component must specify IV (current-voltage) relations
# for a two port component, we only require one IV relation
# for a three port component, we require two, etc
# NOTE: for perfect voltage sources, clearly we don't have an
# IV relation - so for these, we use the obvious node voltage relation
# and a "dummy" ... | mridsole/SimpleCircuits.jl | dciv_relations.jl | Julia | mit | 19,168 |
using Distributions
# FIXME implement actual distribution using Distributions.MixtureModel
typealias BimodalCauchy @compat Tuple{Cauchy, Cauchy}
# In the literature Cauchy distributions have been used for sampling the
# f and cr constants used in DE.
function sample_bimodal_cauchy_once(cauchyDistrs::BimodalCauchy, cu... | multidis/BlackBoxOptim.jl | src/bimodal_cauchy_distribution.jl | Julia | mit | 1,410 |
## _Toy: Custom dynamic functions ------------------------------------------
import MCInsurance.Dynamic
type DynamicHook
yield_mkt_init::Float64
yield_rf_init::Float64
ind_surplus::Vector{Float64}
ind_surplus_threshold::Vector{Float64}
ind_surplus_init::Float64
ind_surplus_threshold_init::Float64
ind_sur... | mkriele/MCInsurance.jl | test/dynamic_behavior.jl | Julia | mit | 8,110 |
using Base.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 de... | andrej-makarov-skrt/xjulia | exercises/trinary/runtests.jl | Julia | mit | 1,066 |
module MemcacheSessionAdapter
using Sessions, Genie, Loggers, Genie.Configuration, App, Memcache, JSON, Nullables
"""
write(session::Sessions.Session) :: Sessions.Session
Persists the `Session` object to the Memcache storage, using the configured DB.
"""
function write(session::Sessions.Session) :: Sessions.Ses... | essenciary/Genie.jl | src/session_adapters/MemcacheSessionAdapter.jl | Julia | mit | 1,404 |
escapename(n::String) =
replace(n,r"(^#)" => "_#")
fmtcof(c::Float64) =
if c < 0.0
if c < -1.0 || c > -1.0
"- $(-c)"
else
"-"
end
elseif c > 0.0
if c < 1.0 || c > 1.0
"+ $c"
else
"+"
end
else
... | JuliaOpt/Mosek.jl | src/show.jl | Julia | mit | 11,635 |
function func1(arr)
@test arr[1] == 1.0
@test arr[2] == 2.0
@test arr[3] == 3.0
end
module Containers
include(joinpath(@__DIR__, "testcommon.jl"))
@wrapmodule libjlcxx_containers
export test_tuple, const_ptr, const_ptr_arg, const_vector, const_matrix
end
using Main.Containers
@test test_tuple() == (1,2.0... | barche/CppWrapper | test/containers.jl | Julia | mit | 800 |
## Various methods for filtering and sorting Metadata
const CATEGORY_ORDER = [:module, :function, :method, :type, :typealias, :macro, :global]
"""
Filter Metadata based on categories or file source.
**Arguments**
* `docs` : main input
**Optional keyword arguments**
* `categories` : categories to include in the re... | hayd/Lexicon.jl | src/filtering.jl | Julia | mit | 4,247 |
s = """
@doc "this is a test" -> f() = 0
"""
msgs = lintstr( s )
@assert isempty( msgs )
s = "@doc \"\"\"this is a test\"\"\" -> f() = 0"
msgs = lintstr( s )
@assert isempty( msgs )
s = """
@doc "this is a test"
f() = 0
"""
msgs = lintstr( s )
@assert contains( msgs[1].message, "Did you forget an -> after @doc")
s = ""... | tkelman/Lint.jl | test/doc.jl | Julia | mit | 558 |
##
# ProductFun represents f(x,y) by Fun(.coefficients[k](x),.space[2])(y)
# where all coefficients are in the same space
##
export ProductFun
immutable ProductFun{S<:UnivariateSpace,V<:UnivariateSpace,SS<:AbstractProductSpace,T}<:BivariateFun{T}
coefficients::Vector{Fun{S,T}} # coefficients are in x
... | acarta/spatiotemp | ApproxFun/src/Multivariate/ProductFun.jl | Julia | mit | 10,579 |
sig = [cos(2*pi*0.15*i) for i=1:2048];
@test_approx_eq_eps Estimation.quinn_fernandes(sig,2*pi*0.1)/(2*pi) 0.15 1e-5
| JuliaDSP/Estimation.jl | test/frequency.jl | Julia | mit | 117 |
using VoronoiCells
using GeometryBasics
using Random
using Test
@testset "Cells" begin
@testset "PointCollection from GeometryBasics" begin
rng = Random.MersenneTwister(2)
points = [Point2(rand(rng), rand(rng)) for _ in 1:5]
rect = Rectangle(Point2(0, 0), Point2(1, 1))
pc = Vorono... | JuliaGeometry/VoronoiCells.jl | test/Cells.jl | Julia | mit | 3,659 |
module BQL
import Base: show, showerror, >>, !, +, -, <, <=, >, >=, ==, !=, &, |, *, /, //
export
Combinator,
IllegalInputError,
IllegalOperandsError,
IllegalContextError,
Const,
This,
Field,
Fields,
Var,
Vars,
Select,
Given,
UnaryOp,
BinaryOp,
Sieve,
C... | rbt-lang/rbt-proto | jl/BQL.jl | Julia | apache-2.0 | 6,513 |
# This file is auto-generated by AWSMetadata.jl
using AWS
using AWS.AWSServices: amp
using AWS.Compat
using AWS.UUIDs
"""
create_alert_manager_definition(data, workspace_id)
create_alert_manager_definition(data, workspace_id, params::Dict{String,<:Any})
Create an alert manager definition.
# Arguments
- `data... | JuliaCloud/AWS.jl | src/services/amp.jl | Julia | mit | 20,076 |
#unum-test-division.jl
#some simple tests in Unum{4,5}
x = Unum{4,5}(30.0)
y = Unum{4,5}(1.5)
z = (x / y)
@test is_exact(z)
@test calculate(z) == 20.0
x = Unum{4,6}(30.0)
y = Unum{4,6}(1.5)
z = (x / y)
@test is_exact(z)
@test calculate(z) == 20.0
x = Unum{4,7}(30.0)
y = Unum{4,7}(1.5)
z = (x / y)
@test is_exact(z)
@... | REX-Computing/unumjl | test/unit/unit-division.jl | Julia | mit | 2,618 |
module GeoCommon
type SimpleLocation
name::String
latitude::Float64
longitude::Float64
end
end
| astrieanna/geojl | src/geocommon.jl | Julia | mit | 113 |
# This file is a part of AstroLib.jl. License is MIT "Expat".
# Copyright (C) 2016 Mosè Giordano.
function aitoff(l::T, b::T) where {T<:AbstractFloat}
l = rem(l, T(360), RoundNearest)
alpha2 = deg2rad(l/2)
delta = deg2rad(b)
r2 = sqrt(T(2))
f = 2*r2/pi
sin_alpha2, cos_alpha2 = sincos(alpha2)
... | giordano/AstroLib.jl | src/aitoff.jl | Julia | mit | 2,172 |
# Test disjoint set
s = IntDisjointSets(10)
@test length(s) == 10
@test num_groups(s) == 10
for i = 1:10
@test find_root(s, i) == i
end
@test_throws BoundsError find_root(s, 11)
@test !in_same_set(s, 2, 3)
union!(s, 2, 3)
@test num_groups(s) == 9
@test in_same_set(s, 2, 3)
@test find_root(s, 3) == 2
union!(s, ... | weijianzhang/DataStructures.jl | test/test_disjoint_set.jl | Julia | mit | 1,905 |
function montage(firstindex::Index, lastindex::Index)
ind_range = get_index_range(premontaged(firstindex), premontaged(lastindex))
ind_range = unique([montaged(i[1:2]...) for i in ind_range])
for index in ind_range
premontage(premontaged(index))
ms = MeshSet(index)
render_montaged(ms; render_full=true... | seung-lab/Julimaps | src/archive/meshsession.jl | Julia | mit | 8,298 |
# This is a wrapper for an int that allows the next empty index of an array to be tracked when the array is being filled by recursive functions
type Counter
N::Int
end
| JuliaPackageMirrors/SnFFT.jl | src/Counter.jl | Julia | mit | 169 |
# Thanks to Jiahao Chen for this great example!
using AudioIO
import AudioIO.play
type note{S<:Real, T<:Real}
pitch::S
duration::T
sustained::Bool
end
function play(A::note, samplingfreq::Real=44100, shape::Function=t->0.6sin(t)+0.2sin(2t)+.05*sin(8t))
timesamples=0:1/samplingfreq:(A.duration*(A.sust... | ssfrr/AudioIO.jl | examples/lilyplay.jl | Julia | mit | 5,066 |
# Test ArbFloats.jl
using Test
using ArbFloats
function package_directory(pkgName::String)
pkgdir = Base.find_package(pkgName)
nothing == pkgdir && throw(ErrorException(string("Package $pkgName not found.")))
return abspath(joinpath(split(pkgdir, pkgName)[1], pkgName))
end
d = joinpath... | JuliaArbTypes/ArbFloats.jl | test/runtests.jl | Julia | mit | 852 |
module RandomMatrices
import Distributions
using Combinatorics,Compat
import Distributions: ContinuousMatrixDistribution, Chisq
import Base.rand
#If the GNU Scientific Library is present, turn on additional functionality.
_HAVE_GSL = try
using GSL
true
catch
false
end
export bidrand, #Generate random bidi... | dlfivefifty/RandomMatrices.jl | src/RandomMatrices.jl | Julia | mit | 1,345 |
module Lattices
export Lattice, MakeLattice
struct Lattice
name::String
l::Int16
dim::Int8
a::Array
unit::Array
N::Int16
X::Array
nnei::Int8
neigh::Array
end
function armod(x,y)
return mod.(x-1,y)+1
end
function Make... | albi3ro/M4 | Packages/Lattices.jl | Julia | mit | 3,702 |
using CRlibm
using Compat
using Base.Test
@test cos(0.5, RoundDown) == 0.8775825618903726
@test cos(0.5, RoundUp) == 0.8775825618903728
@test cos(0.5, RoundNearest) == cos(0.5) == 0.8775825618903728
@test cos(1.6, RoundToZero) == -0.029199522301288812
@test cos(1.6, RoundDown) == -0.029199522301288815
function my_ep... | JuliaPackageMirrors/CRlibm.jl | test/runtests.jl | Julia | mit | 2,028 |
using Push
using Test
cfg_path = joinpath(dirname(@__FILE__), "configuration/float.cfg")
cfg = Push.load_configuration(cfg_path)
# FLOAT.*
s = Push.run("(1.0 FLOAT.*)", cfg)
@test s.float == [1.0]
s = Push.run("(2.5 3.0 50.0 0.1 FLOAT.*)", cfg)
@test s.float == [2.5, 3.0, 5.0]
s = Push.run("(2.5 3.0 -50.0 10.0 FLOAT.... | ChrisTimperley/Push.jl | test/test_float.jl | Julia | mit | 7,182 |
module Parquet
using Thrift
using ProtoBuf
using Snappy
using Zlib
using LRUCache
using Compat
import Base: show, open, close, values, start, next, done
import Thrift: isfilled
export is_par_file, ParFile, show, nrows, ncols, rowgroups, columns, pages, bytes, values, colname, colnames
export SchemaConverter, schema,... | tanmaykm/Parquet.jl | src/Parquet.jl | Julia | mit | 920 |
#GracePlot base types & core functions
#-------------------------------------------------------------------------------
#==Constants
===============================================================================#
const DEFAULT_DPI = 200 #Reasonable all-purpose resolution
#==Configuration
==========================... | ma-laforge/GracePlot.jl | src/base.jl | Julia | mit | 7,869 |
srand(13457)
import Distributions: mvtdist
p = 7
df = 5
L2 = makeLtri(rand(round(Int, p * (p + 1) / 2)))
μ3 = rand(p)
function f1(x)
L = makeLtri(x[p+1:end])
d = mvtdist(df, x[1:p], L * L')
sqmahal(d, zeros(p))
end
function f2(x)
Σ2 = L2 * L2'
d = mvtdist(df, x, Σ2)
sqmahal(d, zeros(p))
end
fu... | jmxpearson/distribution_diff_tests | mvtdist.jl | Julia | mit | 1,096 |
abstract type BoundingPair{T} end
struct BotTop{T} <: BoundingPair{T}
bot::T
top::T
function BotTop(bot::T, top::T) where T
bot, top = min(bot,top), max(bot,top)
new{T}(bot, top)
end
end
@inline function isBetween{T<:Real}(value::T, bounds::BotTop{T})
bounds.bot < value < ... | DiademSpecialProjects/FLOAT128.jl | src/util/domainCheck.jl | Julia | mit | 1,515 |
module IndexTest
using HPAT
using ParallelAccelerator
using CompilerTools
using HDF5
using MPI
using Base.Test
using HPAT.Partitioning
using HPAT.SEQ
using HPAT.TWO_D
using HPAT.ONE_D
#CompilerTools.OptFramework.set_debug_level(3)
#CompilerTools.LivenessAnalysis.set_debug_level(5)
#CompilerTools.LambdaHandling.set_de... | IntelLabs/HPAT.jl | test/index_test.jl | Julia | bsd-2-clause | 1,780 |
export test_problem, tridiagonal
#
# test the linear program solver on a simple problem
#
using Ipopt, KNITRO
#simple_tests();
# 54
# 59
#
function solve_with_JuMP_sqrt(A::SparseMatrixCSC{Float64,Int64}, b::Array{Float64,1}, c::Array{Float64,1}, solver=IpoptSolver(max_iter=300))
model = Model(solver=solver)
n, k ... | ohinder/Everest | src/benchmarking/benchmark_nlo_netlib.jl | Julia | mit | 1,889 |
using JuliaFEM
using Lexicon
include("badges.jl")
"""
Searches recursively all the modules from packages. As documentation grows, it's a bit
troublesome to add all the new modules manually, so this function searches all the modules
automatically.
Parameters
----------
module_: Module
Module where we wan... | ahojukka5/JuliaFEM.jl | docs/build_doctests.jl | Julia | mit | 1,485 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.