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
############################################################################## ## ## TODO ## ############################################################################## # - Convert to c function. Hard to read so many ccall's. function init() ccall((:OpenSSL_add_all_digests, "libcrypto"), Void, ()) end function ...
JuliaPackageMirrors/Crypto.jl
src/digest.jl
Julia
mit
1,806
# test 5: commands & subtables function ap_settings5() s = ArgParseSettings("Test 5 for ArgParse.jl", exc_handler = ArgParse.debug_handler) @add_arg_table s begin "run" action = :command help = "start running mode" "jump" action = ...
sjkelly/ArgParse.jl
test/argparse_test5.jl
Julia
mit
9,835
# Use typeof to find the types of types. Try Symbol or Int64. Can you find the types of operators? typeof(Symbol) typeof(Int64) typeof(+) # Create a typed dictionary with keys that are symbols and values that are floats. What happens when you add :thisis => :notanumber to the dictionary? dict = Dict(:a => 1.1) dict[:t...
hemslo/seven-in-seven
julia/day1/day1.jl
Julia
mit
1,220
using GLFW # Note: This was written as a quick test for multiwindow support. # It is not a clean example (yet) of the proper way to do it. windows = [] glClear = Dict{GLFW.Window, Function}() for i in 1:3 name = "Window $i" window = GLFW.CreateWindow(640, 480, name) GLFW.MakeContextCurrent(window) GLFW.SetMouseBu...
JuliaGL/GLFW.jl
examples/multiwindow.jl
Julia
mit
917
# deals with CCP's crest API module CREST using Requests using DataFrames using Currencies using ProgressMeter using TimeSeries using eve.SDE using eve.MarketDatas @usingcustomcurrency isk "Interstellar Kredit" 2 export getLatestSellOrders export getLatestBuyOrders export getLatestOrders export MarketData global bucke...
barcharcraz/eve.jl
src/CREST.jl
Julia
mit
6,491
ENV["PLOTS_TEST"] = "true" ENV["GKSwstype"] = "100" using Documenter using SymPy makedocs( sitename = "SymPy", format = Documenter.HTML(), modules = [SymPy], pages = [ "Home" => "index.md", "Examples" => "introduction.md", "SymPy tutorial"=> [ "About" => "Tutorial/index.md", "Introduct...
JuliaPy/SymPy.jl
docs/make.jl
Julia
mit
992
function read_from_file(vocab_path::AbstractString, min_freq::Int64=0, stopwords::Set{AbstractString}=Set{AbstractString}(); regex::Regex=r"") fin = open(vocab_path) freqs = Array{Int64, 1}() id2word = Array{AbstractString, 1}() while !eof(fin) try word, freq = split(readline(fin)) freq_num = parse(Int64, ...
sbos/AdaGram.jl
src/util.jl
Julia
mit
6,387
# from states to frequency counts typealias BeliefParticles Dict{Any, Float64} function sampleStateFromBelief(belief::BeliefParticles) r = rand() cumsum = 0.0 freqsum = sumBeliefFreq(belief) last_state = 0.0 for (state, state_freq) in belief cumsum += state_freq/freqsum if r < cumsum r...
haroldsoh/pac.jl
src/common.jl
Julia
mit
775
using Sundials, Test h1 = Sundials.Handle(Sundials.CVodeCreate(Sundials.CV_BDF)) h2 = h1 @test !isempty(h1) @test !isempty(h2) empty!(h1) @test isempty(h1) @test isempty(h2) # Check that the pointers are correct, and h1 empties h2 empty!(h1) # Make sure this does not throw h = Sundials.Handle(h1.ptr_ref[]) # Chec...
JuliaLang/Sundials.jl
test/handle_tests.jl
Julia
bsd-2-clause
1,442
include("Map/Map.jl") include("Map/ResidueRingPoly.jl") include("Map/NfOrd.jl") include("Map/NumField.jl") include("Map/NumberField.jl") include("Map/GrpAb.jl") include("Map/NfRel.jl") include("Map/FqPolyRing.jl") include("Map/automorphisms.jl") include("Map/FiniteField.jl")
thofma/Hecke.jl
src/Map.jl
Julia
bsd-2-clause
276
################################################################################ # # Enumeration of subfields # ################################################################################ # This is a simple implementation of the algorithms described in # "Generating subfields" by van Hoeij, Kluners and Novocin #...
thofma/Hecke.jl
src/NumField/SimpleNumField/Subfields.jl
Julia
bsd-2-clause
10,784
@testset "FieldFactory" begin println("Quadratic Fields") @time begin @testset "Quadratic Fields" begin lq = fields(2, 1, fmpz(10)^4) @test length(lq) == 6086 lqreal = fields(2, 1, fmpz(10)^4, only_real = true) @test length(lqreal) == 3043 ind = 0 for x in lq if ...
thofma/hecke
test/FieldFactory/FieldFactory.jl
Julia
bsd-2-clause
5,171
# Note ReshapeLayer is NOT a UtilLayer because it computes backward (via some upper layers) @defstruct ReshapeLayer Layer ( name :: AbstractString = "reshape", (tops :: Vector{Symbol} = [], length(tops) > 0), (bottoms :: Vector{Symbol} = [], length(bottoms) == length(tops)), (shape :: NTuple = (), eltype(shape)...
benmoran/Mocha.jl
src/layers/reshape.jl
Julia
mit
1,264
# FITS methods const VERBOSE_MODE = @compat Dict("r"=>"read-only", "w"=>"read-write", "r+"=>"append") # helper function for show() function show_ascii_table(io, names, cols, spaces=2, indent=0) ncols = length(cols) ncols >= 1 || error("No col...
JuliaPackageMirrors/FITSIO.jl
src/fits.jl
Julia
mit
3,872
function glplot(p::Plots.Plot, style::Symbol=:default; kw_args...) show(p) end function glplot(arg1, style=:default; screen=viewing_screen, kw_args...) robj = visualize(arg1, style; kw_args...) _view(robj, screen, camera=:perspective) register_plot!(robj, screen) robj end function register_plot!(...
JuliaPackageMirrors/GLPlot.jl
src/plot.jl
Julia
mit
4,953
""" A key table stores the data as a set of dictionaries for each field. """ immutable KeyTable{Index,StorageTypes,Key,KeyType} <: AbstractTable{Index,Key} data::Dict{KeyType,StorageTypes} function KeyTable(data_in) check_table(Index,StorageTypes) check_key(Key,KeyType) new(data_in) ...
nalimilan/Tables.jl
src/KeyTable.jl
Julia
mit
510
# Subtypes of Stationary must define the following functions: # metric(kernel::Stationary) = ::Metric # cov(k::Stationary, r::Float64) = ::Float64 # grad_kern! abstract Stationary <: Kernel abstract StationaryData <: KernelData distance(k::Stationary, X::Matrix{Float64}) = pairwise(metric(k), X) distance(k::Stationar...
JuliaPackageMirrors/GaussianProcesses.jl
src/kernels/stationary.jl
Julia
mit
2,231
# Hock and Schittkowski problem number 31. # # Source: # Problem 31 in # W. Hock and K. Schittkowski, # Test examples for nonlinear programming codes, # Lectures Notes in Economics and Mathematical Systems 187, # Springer Verlag, Heidelberg, 1981. # # classification QQR2-AN-3-1 # # A. Montoison, Montreal,...
dpo/OptimizationProblems.jl
src/hs31.jl
Julia
mit
641
function localReduceByKey(lst) res = Dict{ASCIIString, Int64}() for elt in lst res[elt] = get(res, elt, 0) + 1 end return res end #to do: actually use op, now just using + function reduceByKey(op, lst) res = Dict{ASCIIString, Int64}() for elt in lst for w...
twareproj/tware
benchmarks/julia/wordcount/functions.jl
Julia
apache-2.0
2,450
include("gage_min_distance.jl")
UMOL/MolecularGeometry.jl
src/function/distance/all.jl
Julia
mit
31
#= HDP.jl Adham Beyki, odinay@gmail.com 27/10/2015 TODO: Check CRF sampler =# ################################################### ## Hierarchical Dirichlet Process Mixture Models ## ################################################### type HDP{T} <: hMixtureModel component::T KK::Int gg::Float64 g1::...
adham/BNP.jl
src/HDP.jl
Julia
mit
32,509
matchesprefix(c::AString, pre::AString) = isempty(pre) || lowercase(c[1]) == lowercase(pre[1]) matchesprefix(c::Dict, pre::AString) = matchesprefix(c[:text], pre) matchesprefix(c, ::Void) = true handle("completions") do data @destruct [path || nothing, mod || "Main", line, column, force] = data withpath(path) do ...
JuliaPackageMirrors/Atom.jl
src/completions.jl
Julia
mit
716
cgls_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) = cgls(A, b); resid = norm(A' * (A*x - b)) / norm(b) @printf("CGLS: Relative residual: %8.1e\n", resid); @test(resid <= cgls_tol); @test(stats.solved); λ = 1.0e-3; (x, ...
vepiteski/Krylov.jl
test/test_cgls.jl
Julia
mit
1,263
module REIYFramework export main export cfg_t export Individual_t using DataFrames using ArgParse using PyPlot using IniFile import Base.show @everywhere using RNN @everywhere using Match @everywhere using YARS @everywhere global yars = None type Individual_t rnn::Vector{RNN_t} fitness::Float64 cost::Float64 ...
kzahedi/REIYFramework.jl
src/REIYFramework.jl
Julia
mit
15,990
using RubyCall using Base.Test # write your own tests here @test_approx_eq rbModule(:Math)[:sqrt](3) sqrt(3) a=RubyCall.RbValue([13,7,3,9]) @test a[:sort]()[1] == 3
aviks/RubyCall.jl
test/runtests.jl
Julia
mit
166
let roadway = gen_straight_roadway(1, 1000.0) @test length(roadway.segments) == 1 seg = roadway[1] @test length(seg.lanes) == 1 lane = seg.lanes[1] @test isapprox(lane.width, DEFAULT_LANE_WIDTH) @test lane.curve[1] == CurvePt(VecSE2(0.0,0.0,0.0), 0.0) @test lane.curve[2] == CurvePt(Vec...
tawheeler/AutomotiveDrivingModels.jl
test/2d/roadway/test_roadway_generation.jl
Julia
mit
2,270
__precompile__(true) module CLBLAS using OpenCL: cl export axpy!, scal!, gemm!, gemv!, gbmv! # why there is a type assertion at context.jl line 38 depsfile = joinpath(dirname(@__FILE__), "..", "deps", "deps.jl") if isfile(depsfile) include(depsfile) else error("CLBLAS not properly installed. Please run Pkg.b...
JuliaGPU/CLBLAS.jl
src/CLBLAS.jl
Julia
apache-2.0
2,729
# This is an auto-generated file; do not edit # Pre-hooks # Macro to load a library macro checked_lib(libname, path) ((VERSION >= v"0.4.0-dev+3844" ? Base.Libdl.dlopen_e : Base.dlopen_e)(path) == C_NULL) && error("Unable to load \n\n$libname ($path)\n\nPlease re-run Pkg.build(package), and restart Julia.") qu...
vonDonnerstein/QuantumLab
deps/deps.jl
Julia
mit
481
headers = Dict( # This is the expected response when the client sends # Sec-WebSocket-Key => "dGhlIHNhbXBsZSBub25jZQ==" "Sec-WebSocket-Accept" => "s3pPLMBiTxaQ9kYGzzhZRbK+xOo=" ) type MockRequest accept::String uri::Requests.URI method::String headers::Dict MockRequest(accept::String)...
dandeliondeathray/WebSocketClient.jl
test/handshake_test.jl
Julia
mit
3,034
# TODO: Test HyperLogLog
JuliaPackageMirrors/StreamStats.jl
test/hyper_log_log.jl
Julia
mit
25
@constructor LIBROOT TList () TList1 ( ) @method LIBROOT TList At Ptr{TObject} (idx::Int_t, ) At1 (nothing, ) @method LIBROOT TList After Ptr{TObject} (obj::Ptr{TObject}, ) After1 (nothing, ) @subclass TList TSeqCollection
JuliaPackageMirrors/ROOT.jl
gen/tlist.jl
Julia
bsd-2-clause
225
# Julia wrapper for header: /opt/local/include/libavutil/imgutils.h # Automatically generated using Clang.jl wrap_c, version 0.0.0 @c None av_image_fill_max_pixsteps (Ptr{Cint}, Ptr{Cint}, Ptr{AVPixFmtDescriptor}) libavutil @c Cint av_image_get_linesize (AVPixelFormat, Cint, Cint) libavutil @c Cint av_image_fill_lines...
meggart/Movies
src/avutil/imgutils.jl
Julia
mit
1,252
#------------------------------------------------------------------- #* 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/types/heat_flux.jl
Julia
mit
2,185
#Date Adjusters #Extracted from https://github.com/JuliaLang/julia/blob/master/test/dates/adjusters.jl # U.S. Federal Holidays newyears(y) = (y,1,1) independenceday(y) = (y,7,4) veteransday(y) = (y,11,11) christmas(y) = (y,12,25) boxingDay(y) = (y,12,26) dec27nth(y) = (y,12,27) dec28nth(y) = (y,12,28) dec29nth(y) = (y...
wacax/CAT-Tube-Pricing
dateAdjusters.jl
Julia
mit
2,350
# Example of the piecewise linear regration with Mosek, MosekTools, and JuMP # See Mosek manual 9.2.3 Convex piecewise linear regression using JuMP, Mosek, MosekTools using RDatasets, Plots # prepare data data = dataset("datasets", "pressure"); Y = data.Temperature ./1000; Y = Y[8:end] X = data.Pressure ./1000; ...
JuliaOpt/Mosek.jl
examples/JuMP/piecewise_reg.jl
Julia
mit
1,094
# cudnnRNNMode_t const CUDNN_RNN_RELU = Cint(0) const CUDNN_RNN_TANH = Cint(1) const CUDNN_LSTM = Cint(2) const CUDNN_GRU = Cint(3) # cudnnDirectionMode_t const CUDNN_UNIDIRECTIONAL = Cint(0) const CUDNN_BIDIRECTIONAL = Cint(1) # cudnnRNNInputMode_t const CUDNN_LINEAR_INPUT = Cint(0) const CUDNN_SKIP_INPU...
hshindo/Merlin.jl
src/cuda/cudnn/rnn.jl
Julia
mit
7,575
using Base.Test using Lens clear_all_listeners!() @test length(values(Lens.lens_to_listeners)) == 0 function simpletest1() a = 10 b = 10 lens(:after_rands1;a=a,b=b) end gfunc(m) = @test sum(m[:a]) + sum(m[:b]) == 20 register!(:after_rands1, Listener(:gfunc, gfunc, true, true)) @test nlisteners() == 1 enable_al...
JuliaPackageMirrors/Lens.jl
test/listener.jl
Julia
mit
700
using FeatureSelection using Base.Test # write your own tests here include("tst_measures.jl")
Evizero/FeatureSelection.jl
test/runtests.jl
Julia
mit
95
# derived_sequence.jl """ A DerivedSequence inherits functionality from an underlying sequence that is stored. Yet, it is its own type, and hence specific functionality can be added. Any type that inherits from DerivedSequence has a full interface of a Sequence. Without any other definitions, the new type is function...
daanhb/SignalExtensions.jl
src/derived_sequence.jl
Julia
mit
842
#= # Type definition for a FeatureVector. # Wrapper around a Dict type. # Restricted to Any type [key] => [value] of Number type. =# type FeatureVector{K,V<:Number} <: FeatureSpace map::Dict{K,V} total::Number length::Number mdata::Any FeatureVector() = new(Dict{K,V}(),0,0) FeatureVector{K,V}(map::Dict{K...
SLU-TMI/TextMining.jl
src/feature_vector.jl
Julia
mit
9,452
@testset "lanczos" begin @testset "givens" begin symOrth = KrylovMethods.symOrtho v = ([0;randn()],[randn();0],randn(2)) for k=1:3 println("Givens rotation for v=[$(v[k][1]),$(v[k][2])]") c,s,r = symOrth(v[k][1],v[k][2]) @test abs(c.^2 + s.^2 - 1) < 1e-14 Q = [c s; -s c] w = [norm(v[k]);0] ...
lruthotto/KrylovMethods.jl
test/testLANCZOS.jl
Julia
mit
1,290
# Constructors ----------------------------------------------------------------- function SIIMktEq() tf = TimeFrame() shock_type = :Invest sub_modules = [:type_1, :type_2] balance = DataFrame() corr = zeros(Float64, 1,1) shocks = [eq => 0.0 for eq in sub_modules] return SIIMktEq(tf, shock_type, sub_modul...
mkriele/MCInsurance.jl
src/SII/SII_SIIMktEq.jl
Julia
mit
2,580
using Distributions using JSON alpha = 5 beta = 7 d = Gamma( alpha, 1/beta ) x = [ -5, -2.5, 0, 2.5, 5 ] dmgf(t) = mgf(d, t ) y = map( dmgf, x ) println( y ) data = Dict([ ("alpha", alpha), ("beta", beta), ("data", x), ("expected", y) ]) outfile = open("./test/fixtures/partial.json", "w") JSON.json(data) writ...
distributions-io/gamma-mgf
test/fixtures/test.partial.jl
Julia
mit
350
module W2vUtils export W2vData, nwords, projdim, vocabulary, wordindex, projection, distance, nearest_words, analogy, load include("common.jl") include("w2v_data.jl") end # module
mrkn/W2vUtils.jl
src/W2vUtils.jl
Julia
mit
209
"Make Tensors appear like Julia Arrays" module Idiomatic using ..CoreTypes using ..API.Tf using ..API.TfNn import ..API.Tf: constant import Base: (*), (+), (-), (.*), (.+), (==), size, log, exp, mean, squeeze, linspace, randn, length, reshape, isequal, sum, mean export constant, dtype # From TfNn export relu zeroind...
benmoran/TensorFlow.jl
src/Idiomatic.jl
Julia
apache-2.0
2,487
module ValueHistories using DataStructures using RecipesBase export ValueHistory, UnivalueHistory, History, QHistory, MultivalueHistory, MVHistory, increment!, @trace include("abstract.jl") include("history.jl") include("qhistory.jl") include("mvhistory.jl") inclu...
Evizero/ValueHistories.jl
src/ValueHistories.jl
Julia
mit
351
# # Multi connection server implementation. Works through TCP # protocol for connection with clients. Fully asynchronous and # one threaded. It implements RPC-similar logic, where clients # may run functions with parameters on server and obtain results. # # It uses green threads (or coroutines) inside. See this link # ...
tmptrash/jevo
src/net/Server.jl
Julia
mit
9,932
expr_computation_unit_cache = quote type ComputationUnitCache data_request_queue::RemoteChannel data_receiving_queue::RemoteChannel cached_matrices::Dict{Int, SharedMatrix{Float64}} function ComputationUnitCache(data_request_queue::RemoteChannel) data_receiving_queue = RemoteChannel(myid()) cached_matrices...
usefulhyun/ParMatrices.jl
demo/computation_unit_cache.jl
Julia
mit
1,100
################ # Comment Type # ################ @ghdef mutable struct Comment body::Union{String, Nothing} path::Union{String, Nothing} diff_hunk::Union{String, Nothing} original_commit_id::Union{String, Nothing} commit_id::Union{String, Nothing} id::Union{Int, Nothing} original_position...
JuliaWeb/GitHub.jl
src/issues/comments.jl
Julia
mit
3,534
H = Hilbert(10) @test full(H)[10,10] == 1//(10+10-1)
JuliaPackageMirrors/SpecialMatrices.jl
test/hilbert.jl
Julia
mit
54
function show(io::IO, p::Poly) print(io,"Poly(") print(io,p) print(io,")") end function printexponent(io,var,i) if i == 0 elseif i == 1 print(io,var) else print(io,var,"^",i) end end function printterm{T}(io::IO,p::Poly{T},j,first) pj = p[j] if pj == zero(T) ...
JuliaPackageMirrors/Polynomials.jl
src/show.jl
Julia
mit
1,963
## # These routines simplify the multiplication of two operators # they are currently used for dekron of PDEs to make sure equivalent operators are # recognized as the same # I put this in Extras as it's currently a "hack" # # In the future, product rule/etc. could be implemented, and some sort of ordering # to recogn...
ApproxFun/ApproxFun.jl
src/Extras/simplify.jl
Julia
bsd-3-clause
1,244
""" **ShotProfileWEM** *Shot Profile Wave Equation Migration and Demigration of 3D isotropic data.* **IN** * m : filename of image * d : filename of data * adj : flag for adjoint (migration), or forward (demigration) (default=true) * pspi : flag for Phase Shift Plus Interpolation (default=true) * nref : number ...
JuliaPackageMirrors/Seismic.jl
src/Imaging/ShotProfileWEM.jl
Julia
mit
12,123
using Multilane using StatsBase using JLD using POMDPs using POMDPToolbox using Plots rng = MersenneTwister(58) behaviors = standard_uniform(1.0, correlation=0.75) nb_lanes = 4 desired_lane_reward = 10. rmodel = NoCrashRewardModel(desired_lane_reward*10., desired_lane_reward,4.0,nb_lanes) pp = PhysicalParam(nb_lan...
zsunberg/Multilane.jl
scratch_18_04/test_uniform_filter.jl
Julia
mit
3,133
#= Visual illustration of the central limit theorem @author : Spencer Lyon <spencer.lyon@nyu.edu> References ---------- Based off the original python file illustrates_clt.py =# using PyPlot using Distributions # == Set parameters == # srand(42) # reproducible results n = 250 # Choice of n k = 100000 # Number o...
Perth68/QuantEcon.jl
examples/illustrates_clt.jl
Julia
bsd-3-clause
1,001
function main(window) push!(window.assets, "widgets") # Button btn_inp = Input{Escher.MouseButton}(leftbutton) bt = hbox( button("Click") >>> btn_inp, hskip(1em), "Clicks: ", hskip(1em), foldl((x, _) -> x + 1, 0, btn_inp) ) |> packacross(center) # Checkbox cbox_inp = Input(...
CLUSTERfoo/Escher.jl
test/widget-sampler.jl
Julia
mit
2,207
const log2π = log(2π) """ The Akaike information criterion """ function aic{F<:Real,R<:Real}(y::Vector{F}, ŷ::Vector{R}, p::Int, k::FloatingPoint=2.) const n = length(y) n == length(ŷ) || throw(DimensionMismatch("y and y_hat have to be of the same size")) const r = ŷ - y n * (log2π + 1 + log(dot(r,r)/n)) + ...
Evizero/FeatureSelection.jl
src/measures.jl
Julia
mit
700
# Unit tests for Varpro # using DelimitedFiles using Test using Random using Varpro include("set1.jl") include("gaussmix.jl") @testset "Varpro" begin verbose = false @test runone(rexp, verbose=verbose) @test runone(cexp, verbose=verbose) @test runone(example, verbose=verbose, atol=1e-4) @test ru...
macd/Varpro.jl
test/runtests.jl
Julia
mit
507
using SimpleBinaryManagementExample using Base.Test @test distance(1.0, 1.0) == 0 @test distance(2.0, 3.0) == 1.0 @test distance(1.0, 3.0) == 4.0 @test distance(1.0, 4.0) == 9.0 @test distance(1, 1) == 0 @test distance(2, 3) == 1.0
r9y9/SimpleBinaryManagementExample.jl
test/runtests.jl
Julia
mit
233
# This file is a part of JuliaFEM. # License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md #= - read meshes from different formats - reorder connectivity, create element sets, node sets, ... - create partitions for parallel runs - renumber elements / nodes - maybe precheck for bad elements...
JuliaFEM/JuliaFEM.jl
src/preprocess.jl
Julia
mit
11,744
#this file is imported in the Norms module using .TNorms.Minimum using .TNorms.HamacherProduct using .TNorms.EinsteinProduct using .TNorms.DrasticProduct using .TNorms.BoundedDifference using .TNorms.AlgebraicProduct function compute(tType::Minimum, a, b) return min(a, b); end function compute(tType::...
altieresdelsent/JuliaFuzzy
src/norm/t/compute.jl
Julia
mit
891
println("Hello, Julia!")
yomichi/JuliaBook-Samples
src/hello.jl
Julia
mit
25
include("distribution.jl") export TE function TE_ML(data::Matrix{Int64}; base=2) # D_KL(p(x|y,z)||p(x|y)) pxyz = fe3p(data) px_c_yz = fe3c2p(data) px_c_y = fe2c1p(data[:,[1:2]]) r = 0 for x=1:size(data)[1] for y=1:size(data)[2] for z=1:size(data)[3] if px_c_yz[x, y, z] != 0.0 && px_c...
tkelman/Shannon.jl
src/te.jl
Julia
mit
923
# steepest descent with quadratic line-search function steepest_descent(;obj=nothing, grad=nothing, x0=nothing, alpha0 = 1.0, tol = 1e-4, precon = 1.0, maxnit = 1_000, Carmijo = 0.2, displevel = 2, alpha_min = 1e-8) # evaluate the objective x = x0 ...
cortner/LujiaLt
src/solve_old.jl
Julia
mit
4,925
#= Two pooling layers - MeanPool and MaxPool =# ######################################## # MeanPool ######################################## #= Mean pooling function 2D input -> 2D pooled output for each patch of each image Input: A - inputs from previous layer - dim x dim x num_patches x num_obs Out...
Wedg/Alice.jl
src/pooling.jl
Julia
mit
5,391
# Julia wrapper for header: /usr/include/scip/cons_bounddisjunction.h # Automatically generated using Clang.jl wrap_c function SCIPincludeConshdlrBounddisjunction(scip) ccall((:SCIPincludeConshdlrBounddisjunction, libscip), SCIP_RETCODE, (Ptr{SCIP_},), scip) end function SCIPcreateConsBounddisjunction(scip, cons...
SCIP-Interfaces/SCIP.jl
src/wrapper/cons_bounddisjunction.jl
Julia
mit
1,870
function Base.show(io::IO, C::ClassField_pp{S, T}) where {S, T} println(IOContext(io, :compact => true), "Cyclic class field of degree $(degree(C)) defined modulo $(defining_modulus(C))") if isdefined(C, :a) println(io, "Kummer generator ", C.a) end if isdefined(C, :K) println(io, "Kummer extension: ", ...
thofma/Hecke.jl
src/RCF/class_fields.jl
Julia
bsd-2-clause
12,609
using Alembic using DataFrames image_dim = Int64(30000/4) pt = (0,0) ranges = (199, (1:227, 2150:2550), [27, 201], 200, (1:527, 1850:2850), (-473:527, 1850:2850), [27, 501], [501, 501], [0, 0]) src_img = SharedArray(rand(UInt8, image_dim, image_dim)) dst_img = SharedArray(rand(UInt8, image_dim, image_dim)) dst_image ...
seung-lab/Julimaps
src/timing_tests/time_get_match.jl
Julia
mit
2,737
import JSON # mock a listener: eval(Atom, parse("sock = IOBuffer()")) readmsg() = JSON.parse(String(takebuf_array(Atom.sock))) # callback count cb = 0 # check the different message handlers: # pingpong Atom.handlemsg(Dict("type" => "ping", "callback" => (cb += 1))) @test readmsg() == ["cb", cb, "p...
JuliaPackageMirrors/Atom.jl
test/eval.jl
Julia
mit
1,068
# Class containing the objects for the windowed version of the integral operator # for the slow varying quantity along the principal ray direction type FastMslow # type to encapsulate the fast application of M = I + omega^2G*spadiagm(nu) GFFT :: Array{Complex128,2} nu :: Array{Float64,1} x :: Array{Fl...
Forgotten/Lippmann-Schwinger
src/FastConvolutionSlow.jl
Julia
mit
5,200
using JLD2, FileIO using Test struct Anint; x::Int; end struct Bparam{T}; x::T; end @testset "Inline Union Representation" begin fn = mktemp()[1]*".jld2" u = Union{Int,Float64}[1, 2.5, 3, 4.5] save(fn, "u", u) @test all(skipmissing(u) .== skipmissing(load(fn, "u"))) jldopen(fn, "r") do f ...
simonster/JLD2
test/inlineunion.jl
Julia
mit
1,177
#include("data.jl") function read_data_MSB(file_name_image,file_name_label,size) # pretty shity that have the size in there #open file and read it s = open(file_name_image); ss = open(file_name_label); #seek correct possition seek(s,16); seek(ss,8); #read in data input = read(s,Uint8,784,size); store_out...
loliverhennigh/NeuNet.jl
src/read_data_MSB.jl
Julia
mit
503
using LightGraphsFlows, LightGraphs flow_graph = DiGraph(8) # (node,node,flow) flow_edges = [(1,2,10),(1,3,5),(1,4,15),(2,3,4),(2,5,9), (2,6,15),(3,4,4),(3,6,8),(4,7,16),(5,6,15), (5,8,10),(6,7,15),(6,8,10),(7,3,6),(7,8,10)]; capacity_matrix = zeros(Int ,nv(flow_graph) ,nv(flow_graph)); for...
Gnimuc/BKMaxflow.jl
examples/basic.jl
Julia
mit
2,411
include("../../src/stem/porter.jl") for line in readlines(open("./voc.txt")) println( stem(strip(line)) ) end
dellison/CompLing.jl
test/data/julia_test.jl
Julia
mit
116
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(array(dv), Vector{Float64}) @assert isa(convert(Vector{Float64}, dv), Vector{Float64}) d...
timholy/DataArrays.jl
test/conversions.jl
Julia
mit
614
random_int(min=0, max=9999)= string(rand(min : max)) random_digit()= string(rand(0:9)) random_digit_not_null()= string(rand(1:9)) random_digit_or_empty()= rand(0:1)==1? string(rand(0:9)) : " " random_digit_not_null_or_empty()= rand(0:1)==1? string(rand(1:9)) ...
staticfloat/Faker.jl
src/base.jl
Julia
mit
1,499
######################################################################### # Printers for various data types. They are all overloading Base.show() # ######################################################################### # Function that returns an alias to be printed for any data cell _show_celltype_(c::CellData) = !...
zgornel/j4pr.jl
src/core/printers.jl
Julia
mit
4,625
# Macros used to express ISPC concepts in Julia code. using Base.Meta function ispc_esc(expr) # println(expr) return esc(expr) # All ISPC entry points are escaped as @fastmath. # This is to prevent Julia from inserting a number of runtime # checks into the lowered AST that are either untranslatea...
damiendr/ISPC.jl
src/macros.jl
Julia
apache-2.0
6,370
# This file contains constants used by the MachO file format # The values of the constants have been taken from the appropriate # header files on a Mac OS 10.9 system or the MachO reference documentation using Base.Meta macro constants(array, stripprefix, expr) ret = Expr(:block) # Initialize the name lookup ...
JuliaPackageMirrors/MachO.jl
src/constants.jl
Julia
mit
17,935
const var = :value type GetterSpec name argnames argtypes attr_idx index_idx result_specs # Simple validating constructor function GetterSpec(name, argnames, argtypes, attr_idx = 2, index_idx = 3; result_specs = Dict()) namelen = length(argnames) typelen = len...
rollingthunder/HSA.jl
gen/gen_getters.jl
Julia
mit
12,537
## # Authentication mechanisms # Only SASL-Plain supported for now type AccumuloAuth mechanism::String callback::Function AccumuloAuth(mechanism::String=SASL_MECH_PLAIN, callback::Function=Thrift.sasl_callback_default) = new(mechanism, callback) end function AccumuloAuthSASLPlain(uid::String, passwd::Stri...
JuliaDB/Accumulo.jl
src/sess.jl
Julia
mit
2,768
module MatrixDecomposition export luls, lupp, choleskyls, qrls, lulspp # Solve a system of linear equations using backwards substitution function bwsub(a::Array{Float64, 2}, v::Array{Float64, 1}) # Make sure we have an upper triangular matrix if !istriu(a) error("Matrix is not upper triangular") end # Create re...
andrewjlm/StatComputing
MatrixDecomposition.jl
Julia
mit
7,614
include("quadtest.jl")
JuliaPackageMirrors/SparseGrids.jl
test/runtests.jl
Julia
mit
24
importall Gadfly importall DataFrames using OVRFF: model, validation, risk, optimizer, preprocessing VERSION >= v"0.4.0-dev+6521" && __precompile__() function main() p = 5 d = 5 m = 100 X = 2 * rand( d, m ) - 1 scaler = preprocessing.StandardScaler(X) preprocessing.transform!(scaler, X, X) ...
RomainBrault/OVRFF
sample/RFF_variance.jl
Julia
mit
2,717
## Define a new univariate Distribution type for Mamba. ## The definition must be placed within an unevaluated quote block. @everywhere extensions = quote ## Load needed packages and import methods to be extended using Distributions import Distributions: minimum, maximum, logpdf ## Type declaration type New...
axsk/Mamba.jl
doc/mcmc/newunivardist.jl
Julia
mit
2,000
@testset "SplayTree" begin @testset "pushing values" begin t = SplayTree{Int}() for i in 1:100 push!(t, i) end @test length(t) == 100 for i in 1:100 @test haskey(t, i) end for i = 101:200 @test !haskey(t, i) end ...
JuliaLang/DataStructures.jl
test/test_splay_tree.jl
Julia
mit
3,006
@require TimeSeries begin """ Convert a TimeArray into an Array{Timestamp} ```julia Array{Timestamp}(a::TimeArray) ``` ### Arguments * `a::TimeArray` ### Returns * `::Array{Timestamp}` : an array of Timestamp from a TimeArray ### Examples ```julia ...
JuliaPackageMirrors/Timestamps.jl
src/conversion.jl
Julia
mit
839
""" `haltonsequence(b, n)` Generate the first `n` numbers in Halton's sequence with base `b`. """ function haltonsequence(b, n) map((i) -> haltonnumber(b, i), 1:n) end """ `haltonnumber(base, index)` Generate the `n`-th Halton number in the sequence with base `b`. # Note Implementation is based on the p...
JuliaPackageMirrors/BlackBoxOptim.jl
src/utilities/halton_sequence.jl
Julia
mit
594
using NumericalMethodsforEngineers #= @sym begin LagrangePolynomial(xi_, yi_) := Module([N, sum, num, den], begin N = Length(xi) sum = 0 For( i=1, i <= N, Increment(i), begin num = 1 den = 1 For( j=1, j <= N, Increment(j), begin If...
goedman/NMfE.jl
test/wrm_with_using_nmfe.jl
Julia
mit
1,599
using Highway using JLD Tf = 14400; T = 12; N = 9 t1 = 10800 Lanes = 2; Lanes_t = 3 A = fld(Tf-t1, T)+1 Sections = [Highway.Sections2_CR[i] for i in 1:2:length(Highway.Sections2_CR)] S = length(Sections) J_in = linspace(0.2/Lanes, 0.6/Lanes, 9); J = length(J_in) peeds_Transition = Array{Float64}(S, Lanes, J) Densit...
LeonardoCastro/Cuernavaca
Simulations/S2-Data-Express.jl
Julia
mit
6,068
#------------------------------------------------------------------- #* 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/Entalpia.jl
Julia
mit
1,274
@testset "RayClassGroup" begin #include(joinpath(Hecke.pkgdir, "examples", "RayClass.jl")) @testset "Big prime" begin k, = wildanger_field(2, 13) Zk = maximal_order(k) p = next_prime(fmpz(2)^100) r, mr = ray_class_group(ideal(Zk, p), n_quo = 2) @test order(domain(mr)) == 2 end @testset "...
thofma/Hecke.jl
test/NfOrd/RayClassGroup.jl
Julia
bsd-2-clause
2,730
# This file is auto-generated by AWSMetadata.jl using AWS using AWS.AWSServices: marketplace_catalog using AWS.Compat using AWS.UUIDs """ cancel_change_set(catalog, change_set_id) cancel_change_set(catalog, change_set_id, params::Dict{String,<:Any}) Used to cancel an open change request. Must be sent before t...
JuliaCloud/AWS.jl
src/services/marketplace_catalog.jl
Julia
mit
9,656
using Base.Test using Klara fnames = ( :value, :loglikelihood, :logprior, :logtarget, :gradloglikelihood, :gradlogprior, :gradlogtarget, :tensorloglikelihood, :tensorlogprior, :tensorlogtarget, :dtensorloglikelihood, :dtensorlogprior, :dtensorlogtarget ) println(" Testing BasicContUnvPara...
JuliaStats/Lora.jl
test/BasicContUnvParameterState.jl
Julia
mit
1,581
# Generating #define constants const CURL_SOCKET_BAD = -1 const CURL_MAX_WRITE_SIZE = 16384 const CURL_MAX_HTTP_HEADER = (100*1024) const CURL_WRITEFUNC_PAUSE = 0x10000001 const CURLFINFOFLAG_KNOWN_FILENAME = (1<<0) const CURLFINFOFLAG_KNOWN_FILETYPE...
JuliaPackageMirrors/LibCURL.jl
src/lC_defines_h.jl
Julia
mit
9,939
using JSom using Base.Test srand(1) @testset "Grid SOM" begin gsom = GridSOM(5, 5, 1) gsom.weights = zeros(5, 5, 1) set_unit_weight(gsom, 3, 4, 5.0) set_unit_weight(gsom, 2, 2, 2.0) @testset "neighboring units" begin n1 = sort(JSom.neighbor_units(gsom, (2,2))) n2 = sort(JSom.neig...
agrimaldi/JSom
test/runtests.jl
Julia
mit
7,243
# Locally Linear Embedding (LLE) # ------------------------ # Nonlinear dimensionality reduction by locally linear embedding, # Roweis, S. & Saul, L., Science 290:2323 (2000) #### LLE type immutable LLE{T <: Real} <: SpectralResult k::Int λ::AbstractVector{T} proj::Projection{T} LLE{T}(k::Int, λ::Abst...
JuliaPackageMirrors/ManifoldLearning.jl
src/lle.jl
Julia
mit
2,115
using BinaryProvider # requires BinaryProvider 0.3.0 or later # Parse some basic command-line arguments const verbose = "--verbose" in ARGS const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr"))) products = [ LibraryProduct(prefix, String["libbkmaxflow"], :libbkmaxflow), ] ...
Gnimuc/BKMaxflow.jl
deps/build.jl
Julia
mit
3,433
module IntervalTrees using Compat, Docile using Docile: @doc import Base: first, last export IntervalTree, IntervalMap, AbstractInterval, Interval, IntervalValue, depth, hasintersection, from, first, last, print, show, value include("slice.jl") @doc """ An AbstractInterval{T} must have a `first` and `las...
tkelman/IntervalTrees.jl
src/IntervalTrees.jl
Julia
mit
37,882
n = rand(1:10) r = matrixdepot("deriv2", n, false) rf32 = matrixdepot("deriv2", Float32, n, false) r2 = matrixdepot("deriv2", Float32, n, 2, false) if mod(n, 2) == 0 r3 = matrixdepot("deriv2", Float32, n, 3, false) end try matrixdepot("deriv2", Float64, n, 4, false) catch ArgumentError println("deriv2: i...
weijianzhang/MatrixDepot.jl
test/regu.jl
Julia
mit
1,880