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 |
|---|---|---|---|---|---|
"""
Console appender
It appends log events to `STDOUT` or `STDERR` using a layout specified by the user.
"""
type Console <: Appender
name::AbstractString
layout::LAYOUT
filter::FILTER
state::LifeCycle.State
io::IO
end
function Console(config::Dict{AbstractString,Any})
nm = get(config, "name"... | wildart/Log4jl.jl | src/appenders/console.jl | Julia | apache-2.0 | 955 |
#!/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/arcsine/stdev/test/fixtures/julia/runner.jl | Julia | apache-2.0 | 1,727 |
# @doc doc"""
# closeness_centrality(g::AbstractGraph; normalize=true)
#
# Computes closeness centrality of a graph, based on all vertices.
# """ ->
function closeness_centrality(
g::AbstractGraph;
normalize=true)
n_v = nv(g)
closeness = zeros(n_v)
for u = 1:n_v
d = dijkstr... | jpfairbanks/LightGraphs.jl | src/centrality/closeness.jl | Julia | bsd-2-clause | 627 |
# test various model functions
# word vectors
model = wordvectors("bigvecs.txt", Float32)
println(model)
rm("bigvecs.txt")
rm("vocab.txt")
modelbin = wordvectors("bigvecs.bin", kind = :binary)
rm("bigvecs.bin")
try
wordvectors("bigvecs.txt", kind = :unkown)
catch ArgumentError
println("unknown kind value")... | weijianzhang/Word2Vec.jl | test/model.jl | Julia | apache-2.0 | 1,512 |
#=
Tools for working with Markov Chains
@author : Spencer Lyon, Zac Cranko
@date: 07/10/2014
References
----------
http://quant-econ.net/jl/finite_markov.html
=#
import LightGraphs: DiGraph, period, attracting_components,
strongly_connected_components, is_strongly_connected
____solver_docs = ""... | rawls238/QuantEcon.jl | src/mc_tools.jl | Julia | bsd-3-clause | 8,700 |
export Window,
include_asset
immutable Window
alive::Signal
dimension::Signal
route::Signal
dir::AbstractString
assets::Signal
end
Window(;
alive=true,
dimension=(0px, 0px),
route="",
dir="ltr") =
Window(Signal(Bool, alive), Signal(Any, dimension), Signal(Any, route), "l... | JuliaPackageMirrors/Escher.jl | src/basics/window.jl | Julia | mit | 776 |
# TODO: Implement liblazy functions over standard arrays / other collections
function Base.split{T}(xs::Vector{T}, x; keep = true)
result = Vector{T}[]
push!(result, T[])
for i = 1:length(xs)
if xs[i] == x
(keep || !(isempty(result[end]) || i == length(xs))) &&
push!(result, T[])
else
... | JuliaPackageMirrors/Lazy.jl | src/collections.jl | Julia | mit | 1,033 |
# "Philippe Toint (private communication)"
# classification SUR2-AN-V-0
# A. Montoison, Montreal, 05/2018.
export NZF1
function NZF1(n :: Int=13)
mod(n,13) != 0 && @warn("NZF1: number of variables adjusted to be divisible by 13")
nbis = max(1,div(n,13))
n = 13*nbis
l = div(n,13)
nlp = Model()
@var... | dpo/OptimizationProblems.jl | src/NZF1.jl | Julia | mit | 810 |
## TODO consolidate low-level part code. I thought newer code was better. Now, it seems the older code is useful
posnegi(x::Mxpr,n::Integer) = n >= 0 ? n : length(x) + n + 1
## WARNING: The following method is not the same as the others, it won't work in the general case (not for sequence specs)
## we may need to do s... | jlapeyre/SJulia.jl | src/parts.jl | Julia | mit | 16,080 |
"Create a new feature definition object to hold the field definitions."
createfeaturedefn(name::AbstractString) = GDAL.fd_create(name)
"Destroy a feature definition object and release all memory associated with it"
destroy(featuredefn::FeatureDefn) = GDAL.destroy(featuredefn)
"Drop a reference, and destroy if unrefer... | yeesian/GDALUtils.jl | src/ogr/featuredefn.jl | Julia | mit | 6,196 |
###########################################################################
# Lazy wrapper around a PyObject to load a module on demand.
mutable struct LazyPyModule
name::String
o::PyObject
LazyPyModule(n) = new(n, PyNULL())
end
PyObject(m::LazyPyModule) = ispynull(getfield(m, :o)) ? copy!(getfield(m, :o),... | JuliaPy/PyPlot.jl | src/plot3d.jl | Julia | mit | 4,403 |
struct LF3dGrid
LFx::LF1dGrid
LFy::LF1dGrid
LFz::LF1dGrid
#
Nx::Int64
Ny::Int64
Nz::Int64
# XXX probably these variables are not important
Lx::Float64
Ly::Float64
Lz::Float64
#
lingrid::Array{Float64,2}
xyz2lin::Array{Int64,3}
lin2xyz::Array{Int64,2}
end
function init_LF3d_p( NN::Array{I... | f-fathurrahman/ffr-ElectronicStructure.jl | src/LagrangeFunction/LF3d.jl | Julia | mit | 3,200 |
module Bandits
using Distributions
export gaussian_bandit, comb_multivariate_normal_bandit
export mab, combinatorial_mab
export offline_argmax, combucb, scaled_combucb
export escb, scaled_escb, ols_ucb, adaptive, extract_stats, get_all_actions
export ucb, ucb_v, ucb2, moss_anytime, moss, h_algo,... | RemyDegenne/Bandits | src/Bandits.jl | Julia | mit | 1,155 |
# Experimental functions for linear extensions
export linear_extension, linear_extension_empty!, all_linear_extensions, random_linear_extension
"""
`linear_extension(P)` returns a linear extension of the poset `P`.
"""
function linear_extension(P::SimplePoset{T}) where T
PP = deepcopy(P)
result = linear_exte... | scheinerman/SimplePosets.jl | src/linear_extensions.jl | Julia | mit | 2,679 |
using MathUtils
using Base.Test
# Test log_sum_exp()
original = log(sum(exp([1, 2])))
ours = log_sum_exp([1, 2])
@test abs(ours - original) <= eps(original)
original = log(sum(exp([1, 2, 3, 4, 5, 6])))
ours = log_sum_exp([1, 2, 3, 4, 5, 6])
@test abs(ours - original) <= eps(original)
original = log(sum(exp([1, 1, 1,... | marcoct/MathUtils.jl | test/runtests.jl | Julia | mit | 875 |
#!/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/logistic/quantile/test/fixtures/julia/runner.jl | Julia | apache-2.0 | 2,058 |
#!/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/erlang/pdf/test/fixtures/julia/runner.jl | Julia | apache-2.0 | 2,255 |
function moon_position(time::Float64)
moon_angle = MOON_INITIAL_ANGLE + 2.0pi * time / MOON_PERIOD
x::Float64 = DISTANCE_TO_MOON * cos(moon_angle)
y::Float64 = DISTANCE_TO_MOON * sin(moon_angle)
return [x, y]
end
function update(me::Moon, time)
me.position = moon_position(time)
me
end | rodrigolece/grupo-fisica-compu | notas/apollo/moon.jl | Julia | mit | 312 |
"""
Description
The foo() method is for making foo
Usage
foo(12) = "foo"
Method Signature(s)
foo(x::Int; y::UTF8String="foo")
Details
The foo function makes foo
References
http://www.duckduckgo.com
See Also
bar(x) which makes bars
"""
function foo()
# awesome co... | milktrader/Tuxedo.jl | src/src.jl | Julia | mit | 332 |
function test_phidf(order, α)
srand(98765)
dummy_input = rand(64)
delay = zeros(order + 1)
for x in dummy_input
SPTK.phidf!(x, order, α, delay)
@test all(isfinite.(delay))
end
end
function test_lspcheck(order)
srand(98765)
dummy_lsp = rand(1024)
# TODO valid check
... | r9y9/SPTK.jl | test/utils.jl | Julia | mit | 816 |
#!/usr/bin/env julia
using MIToS.Utils.Scripts
Args = parse_commandline(
# TO DO ----------------------------------------------------------------------
["--distance", "-d"],
Dict(
:help => "The distance to be calculated, options: All, Heavy, CA, CB",
:arg_type => ASCIIString,
:defa... | JuliaPackageMirrors/MIToS.jl | scripts/Distances.jl | Julia | mit | 3,567 |
immutable GeneralizedPareto <: ContinuousUnivariateDistribution
μ::Float64
σ::Float64
ξ::Float64
function GeneralizedPareto(μ::Real, σ::Real, ξ::Real)
σ > zero(σ) || error("Scale must be positive")
@compat new(Float64(μ), Float64(σ), Float64(ξ))
end
GeneralizedPareto() = new(1.0, 1.0, 1.0)
end
# ... | sammorris81/ExtremeValueDistributions.jl | src/density/generalizedpareto.jl | Julia | mit | 3,560 |
using Marble
reload("Marble")
# Streams
path = Marble.mrbldir("streams/$(string(Base.Random.uuid4()))")
settings = Marble.get_settings(path)
Marble.create_paths(settings)
cache = Marble.Cache("$(settings["paths"]["cache"])/hashes.json")
doc = Marble.MarbleDoc("stream", readstring("$(Pkg.dir("Marble"))//test/docs/test.... | dustinrb/Marble.jl | test/devel.jl | Julia | mit | 1,544 |
# Julia wrapper for header: /usr/local/include/libavutil/des.h
# Automatically generated using Clang.jl wrap_c, version 0.0.0
export
av_des_alloc,
av_des_init,
av_des_crypt,
av_des_mac
function av_des_alloc()
ccall((:av_des_alloc,libavutil),Ptr{AVDES},())
end
function av_des_init(d,key,key_bits... | JuliaPackageMirrors/VideoIO.jl | src/ffmpeg/AVUtil/v55/des.jl | Julia | mit | 795 |
#=
relerr testing
=#
set_bigfloat_precision(320);
@inline abserr(xIdeal::Real,xActual::Real) = abs(xIdeal-xActual)
relerr(xIdeal::Real,xActual::Real) = xIdeal==0 ? 0 : abserr(float(xIdeal),float(xActual))/abs(float(xIdeal))
function relerr1{T<:Float64}(xIdeal::T,xActual::T)
a = abserr(xIdeal,xActual)
x = abs(x... | DiademSpecialProjects/FLOAT128.jl | test/util/testit.jl | Julia | mit | 4,042 |
function string_keys_to_dict(keys::ASCIIString, callback::Function)
keys_arr = convert(Array{ASCIIString}, split(keys)) # split returns Array{String}
vals_arr = repeat([callback]; inner = [length(keys_arr)])
Dict(keys_arr, vals_arr)
end
function parse_info(response::UTF8String)
# Parse the result of R... | moisespsena/Redis.jl | src/client.jl | Julia | mit | 18,385 |
module MLBase
using ArrayViews
using StatsBase
import Base: length, show, keys, precision, length, getindex
import Base: start, next, done
import Base.Order: lt, Ordering, ForwardOrdering, ReverseOrdering, Forward, Reverse
import StatsBase: RealVector, IntegerVector, RealMatrix, IntegerMatrix,... | lendle/MLBase.jl | src/MLBase.jl | Julia | mit | 4,207 |
abstract GraphicsArea
abstract Canvas <: GraphicsArea
origin(c::Canvas) = (origin_x(c), origin_y(c))
Base.size(c::Canvas) = (width(c), height(c))
pixel_size(c::Canvas) = (pixel_width(c), pixel_height(c))
function Base.print(io::IO, c::GraphicsArea)
for row in 1:nrows(c)
printrow(io, c, row)
print(... | JuliaPackageMirrors/UnicodePlots.jl | src/canvas.jl | Julia | mit | 3,600 |
#Propose stellar parameters in the main algorithm, send them to each of the workers.
#Workers evaluate these, then return a lnprob. Master sums all of the lnprobs, and decides whether to keep the proposed jump. Sends back a KEEP or REVERT.
#Then, also, the program can go off and do it's own IND-ependent sampling, dec... | iancze/Stars.jl | parallel.jl | Julia | mit | 1,264 |
let
# constructor
term = Term("GO:0000001", "mitochondrion inheritance")
@test isa(term, Term)
@test term.id == 1
@test term.name == "mitochondrion inheritance"
@test !isobsolete(term)
@test go"GO:0000001" == term
@test go"0000001" == term
@test string(term) == "Term(\"GO:0000001\", ... | bicycle1885/GeneOntology.jl | test/test_term.jl | Julia | mit | 479 |
@testset "Cli Function Tests" begin
@test isdefined(Julz, :cli) == true
originalSTDOUT = STDOUT
(outRead, outWrite) = redirect_stdout()
run(`$JULIA_HOME/julia -L $(dirname(@__FILE__))/../../../../Julz/src/functions/utils/cli.jl -e 'cli()' -- hello`)
close(outWrite)
data = readavailable(outRead)
clo... | djsegal/julz | test/functions/utils/cli_test.jl | Julia | mit | 415 |
module TestSelect
using FactCheck
using DataCubes
immutable Wrap{T}
elem::T
end
facts("Select tests") do
col1 = nalift(reshape(500:-1:1, 10, 50))
col2 = nalift(reshape(1.0*(1:500), 10, 50))
col3 = nalift(reshape(map(i->string("sym_",i), 1:500), 10, 50))
col4 = nalift(hcat(rand(10,30), fill(:testsym, 10, 20... | c-s/DataCubes.jl | test/test_select.jl | Julia | mit | 30,712 |
#! /usr/bin/julia
# Rosetta Code, Day of the week
isdefined(:Date) || using Dates
lo = 2008
hi = 2121
xmas = Date(lo, 12, 25):Year(1):Date(hi, 12, 25)
smas = recur(xmas) do y
Dates.dayofweek(y) == Dates.Sun
end
println("Years (from ", lo, " to ", hi, ") having Christmas on a Sunday:")
for y in smas
printl... | MichaeLeroy/rosetta-code | julia/completed/day_of_the_week.jl | Julia | mit | 349 |
#!/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/chi/skewness/test/fixtures/julia/runner.jl | Julia | apache-2.0 | 1,595 |
#!/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/maxabs/benchmark/julia/benchmark.jl | Julia | apache-2.0 | 2,872 |
using ParallelAccelerator
@acc function loopIt()
A = Array{Int8}(10000,
10000)
B = Array{Int8}(10000, 10000)
C = Array{Int8}(10000, 10000)
D = Array{Int8}(10000, 10000)
for i = 1:10000
for j = 1:10000
@fuse 2 A[i, j] = Int8(0)
end
end
for i = 1:10000
for j = 1:10000
... | malekbr/julia-to-tiramisu | examples/tiramisu/for_loop.jl | Julia | bsd-2-clause | 2,062 |
#=
Copyright (c) 2015, Intel Corporation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaime... | IntelLabs/Sparso | test/correctness/context-test5.jl | Julia | bsd-3-clause | 14,109 |
using HSA
using FactCheck
type Fable
end
facts("The Macros") do
context("can provide deterministic destruction") do
finalized = false
function finalize_fable(f)
finalized = true
end
@use f = Fable() begin
finalizer(f, finalize_fable)
@fact fin... | JuliaGPU/HSA.jl | test/util_macros.jl | Julia | mit | 395 |
################################################# FILE DESCRIPTION #########################################################
# This file contains tests for the Vertex DataFrame.
############################################################################################################################
import Graft: ... | pranavtbhat/Graft.jl | test/vdata.jl | Julia | mit | 2,183 |
#=
This script load the workspace of Stokes' model for dynamical topography.
=#
#workspace() # Clean workspace memory
## Packages ##
##############
# Use Pkg.add("name_pkg") to install if not
# Use Pkg.update() to update the packages
# We need explicit call for the import pkgs. e.i. PyPlot.function()
using Grid # ... | Clemastecs/DynamTopo | main.jl | Julia | mit | 1,861 |
# !INPUT/OUTPUT PARAMETERS:
# sol : speed of light in atomic units (in,real)
# ptnucl : .true. if the nucleus is a point particle (in,logical)
# zn : nuclear charge (in,real)
# nst : number of states to solve for (in,integer)
# n : priciple quantum number of each state (in,integer(nst))
# l ... | f-fathurrahman/ffr-ElectronicStructure.jl | LAPW/solve_atom.jl | Julia | mit | 6,183 |
using Clang
includes = ["/usr/local/include",
"/usr/include",
"/usr/lib/gcc/x86_64-linux-gnu/4.8/include",
"/usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed"]
headers = ["/usr/local/cuda/include/nvrtc.h"]
# Customize how functions, constants, and structs are written
const skip_expr ... | hshindo/CUDA.jl | lib/gen_libnvrtc.jl | Julia | mit | 1,952 |
using Compose
using Test
include("misc.jl")
@testset "SVG Correctness Tests" begin
include("svg.jl")
end
include("immerse.jl")
# Run the examples
cd(joinpath(@__DIR__, "output"))
exampledir = joinpath(@__DIR__, "examples")
for ex in readdir(exampledir)
endswith(ex, ".jl") || continue
file = joinpath(exam... | dcjones/Compose.jl | test/runtests.jl | Julia | mit | 614 |
# Thu 08 Nov 2012 05:07:44 PM EST
#
# NeHe Tut 7 Mouse - Implement lights and rotate a textured cube with a joystick
#
# Q - quit
# L - turn lights on/off
# F - change texture filter (linear, nearest, mipmap)
# Hold joystick button A and move mouse up/down or /left/right - increase/decrease x-rotation speed or y-rotati... | rennis250/GLUT.jl | Examples/NeHe/tut7Joystick/tut7Joystick.jl | Julia | mit | 8,474 |
using SAD, Features, DocOpt, Stage
# ----------------------------------------------------------------------------------------------------------------
# main
# ----------------------------------------------------------------------------------------------------------------
usage = """C2 SAD Train/test script
Usage:
r... | mit-nlp/SAD.jl | test/c2.jl | Julia | mit | 2,238 |
function bayes_optimization(n, f, fdata, lb, ub, x, minf, params)
cf = cfunction(f, Cdouble, (Cuint, Ptr{Cdouble}, Ptr{Cdouble}, Ptr{Void}))
ret = ccall(
(:bayes_optimization, libbayesopt),
Cint,
(Cuint, Ptr{Void}, Ptr{Void},
Ptr{Cdouble}, Ptr{Cdouble},
Ptr{Cdouble}, Pt... | bicycle1885/BayesOpt.jl | src/opt.jl | Julia | mit | 421 |
############################################################################
type GLProgram
id ::GLuint
names ::Vector{Symbol}
nametype ::Dict{Symbol, GLenum}
uniformloc ::Dict{Symbol, Tuple}
function GLProgram(id::GLuint, names::Vector{Symbol}, nametype::Dict{Symbol, GLenum}, u... | AlainLich/GLAbstraction.jl | src/GLTypes.jl | Julia | mit | 7,324 |
using Test
using QuantumOptics
using LinearAlgebra, SparseArrays, Random
mutable struct test_operators{BL<:Basis,BR<:Basis} <: AbstractOperator{BL,BR}
basis_l::BL
basis_r::BR
data::Matrix{ComplexF64}
test_operators(b1::Basis, b2::Basis, data) = length(b1) == size(data, 1) && length(b2) == size(data, 2) ? new{t... | bastikr/QuantumOptics.jl | test/test_operators.jl | Julia | mit | 4,587 |
module sequenceCompare
export DTWDistance
# http://en.wikipedia.org/wiki/Dynamic_time_warping
function DTWDistance{T}(s::Array{T}, t::Array{T})
n, m = size(s,2), size(t, 2)
DTW = zeros(n+1,m+1)
#println("sizeof DTW: ", size(DTW))
DTW[:,1], DTW[1,:] = Inf, Inf
DTW[1,1... | abell25/trajectory_prediction | sequenceCompare.jl | Julia | mit | 2,874 |
module Utilities
using DynamicPPL: AbstractSampler, Sampler
using DynamicPPL: init, inittrans, reconstruct, reconstruct!, vectorize
using Distributions, Bijectors
using StatsFuns, SpecialFunctions
import Distributions: sample
export vectorize,
reconstruct,
reconstruct!,
Sample,
Chain,... | yebai/Turing.jl | src/utilities/Utilities.jl | Julia | mit | 416 |
color_name()::String = executor(data["faker"]["color"]["allcolor"])
safe_color_name()::String = executor(data["faker"]["color"]["name"])
hex_color()::String = executor(data["faker"]["color"]["code"])
rgb_color()::String = string(rand(1:255),",",rand(1:255),",",rand(1:255))
rgb_color_list()::String ... | codeneomatrix/Faker.jl | src/color.jl | Julia | mit | 411 |
# Diffusion maps
# --------------
# Diffusion maps,
# Coifman, R. & Lafon, S., Applied and Computational Harmonic Analysis, Elsevier, 2006, 21, 5-30
#### DiffMap type
immutable DiffMap{T <: Real} <: SpectralResult
t::Int
ɛ::Float64
K::AbstractMatrix{T}
proj::Projection{T}
DiffMap{T}(t::Int, ɛ::T, ... | JuliaPackageMirrors/ManifoldLearning.jl | src/diffmaps.jl | Julia | mit | 1,333 |
module EscherTodo
using FunctionalCollections
using Reactive
using Escher
# This is an example app to demonstrate Components
include("item.jl")
include("list.jl")
function load_list()
TodoList("Todo",
pvec([TodoItem(false, "Make presentation"),
TodoItem(false, "Don't lose it")]))
end
func... | shashi/EscherTodo.jl | src/EscherTodo.jl | Julia | mit | 1,133 |
abstract type AbstractFunJac{J2} end
mutable struct FunJac{F, F2, J, P, M, J2, uType, uType2, Prec, PS} <: AbstractFunJac{J2}
fun::F
fun2::F2
jac::J
p::P
mass_matrix::M
jac_prototype::J2
prec::Prec
psetup::PS
u::uType
du::uType
resid::uType2
end
FunJac(fun, jac, p, m, jac_pro... | JuliaLang/Sundials.jl | src/common_interface/function_types.jl | Julia | bsd-2-clause | 6,418 |
# Hard class group of Carlo
# Qx, x = PolynomialRing(FlintQQ, "x");
# f = x^4-x^3-378*x^2+2081*x-67;
# K, a = number_field(f);
# C = cyclotomic_extension(K, 7)
# K = absolute_field(C);
f = x^24-2*x^23-2266*x^22+15510*x^21+2122618*x^20-25022546*x^19-994971857*x^18+17780224498*x^17+204666064586*x^16-6330369896072*x^15+... | thofma/hecke | examples/Clgp.jl | Julia | bsd-2-clause | 674 |
include("SupportFunctions.jl")
function updateS(Y,A::Array{Float64,2},lambda,S::Array{Float64,2};maxIter=10000,threshold=1e-5)
H=A'*A
AtY=A'*Y
R=deepcopy(S)
Sp=S
L=0
try
L=eigmax(H)
catch
return (S,0,false)
error("Error in eigenvalue calculation")
end
At... | dahlend/CompressedSensing.jl | src/nGMCA.jl | Julia | mit | 5,564 |
# all test targets
available_targets = [
"align",
"phylo",
"intervals",
"seq",
"var",
"services",
"structure",
"tools",
"util"
]
if isempty(ARGS)
# run all available test targets
targets = available_targets
else
targets = ARGS
invalids = setdiff(targets, available_ta... | JuliaPackageMirrors/Bio.jl | test/runtests.jl | Julia | mit | 528 |
#=
There are six general cases for processing a/b (when b excludes 0)
and six special cases (where the denominator includes 0 as a bound)
and two exceptional cases (where the denominator is 0 or straddles 0)
b <= 0 b >= 0
a <= 0 LteLte LteGte
a <0< a ZerLte... | J-Sarnoff/BoundIntervals.jl | src/arith/plain/div.jl | Julia | mit | 2,507 |
using KroneckerMatrices
using Base.Test
#square matrix nonsquare factors
Q,R = 3,4
S,T = 4,3
Aouter = rand(Q,R)
Ainner = ones(S,T)
#square matrix, square factors
Q,R = 3,3
S,T = 4,4
Bouter = rand(Q,R)
Binner = ones(S,T)
#tests for square Kronecker Products
for (outer,inner) in zip(Any[Aouter Bouter],Any[Ainner Binne... | gajomi/KroneckerMatrices.jl | test/runtests.jl | Julia | mit | 1,610 |
# This file is auto-generated by AWSMetadata.jl
using AWS
using AWS.AWSServices: lookoutvision
using AWS.Compat
using AWS.UUIDs
"""
create_dataset(dataset_type, project_name)
create_dataset(dataset_type, project_name, params::Dict{String,<:Any})
Creates a new dataset in an Amazon Lookout for Vision project. C... | JuliaParallel/AWS.jl | src/services/lookoutvision.jl | Julia | mit | 38,485 |
# This file defines midlevel api wrappers. We include name normalization for methods that are
# applicable to different hdf5 api-layers. We still try to adhere close proximity to the underlying
# method name in the hdf5-library.
"""
HDF5.set_extent_dims(dset::HDF5.Dataset, new_dims::Dims)
Change the curren... | JuliaIO/HDF5.jl | src/api_midlevel.jl | Julia | mit | 7,720 |
"""
An objective function for the production model. As per its interface, it can define two functions:
- `objectiveTimeStep(m::Model, o::ProductionObjective, pm::PlantModel, d::DateTime)`: the cost for the time step `d`
(`d` indicates the beginning of the time step).
- `objectiveShift(m::Model, o::ProductionOb... | dourouc05/IndustrialProcessFlexibilisation.jl | src/model/ds/objective.jl | Julia | mit | 15,697 |
using DataFrames, Plots
pyplot()
ProjDir = dirname(@__FILE__)
cd(ProjDir) do
function euler_ex71(f::Function, y0::Float64, x::FloatRange{Float64})
y = Vector{Real}(length(x))
y[1] = y0
h = x.step/x.divisor
for i in 2:length(x)
k0 = h * f(x[i-1], y[i-1])
k1 = h * f(x[i-1] + h/2, y[i-1] ... | goedman/NMfE.jl | examples/ch07/IVP/euler_ex7.3.jl | Julia | mit | 976 |
using DelimitedFiles
# n = number of events
# prob = probability of incrementing counter
function random_count(n, prob; a=30, prob_calc=false)
v = 0
base = 1+1/a
output = zeros(n)
if prob_calc
prob = 1
v = 1
end
if rand() < prob
output[1] = 1/prob
end
for i = ... | leios/algorithm-archive | contents/approximate_counting/res/counting.jl | Julia | mit | 3,003 |
# Julia wrapper for header: /usr/local/include/libavutil/dict.h
# Automatically generated using Clang.jl wrap_c, version 0.0.0
export
av_dict_get,
av_dict_set,
av_dict_copy,
av_dict_free
function av_dict_get(m,key,prev,flags::Integer)
ccall((:av_dict_get,libavutil),Ptr{AVDictionaryEntry},(Ptr{AV... | JuliaPackageMirrors/VideoIO.jl | src/libav/AVUtil/v51/dict.jl | Julia | mit | 816 |
abstract MeshAdaptiveDirectSearch
type LTMADS <: MeshAdaptiveDirectSearch
n::Int64
D::Array{Int64,2}
tau::Float64
wminus::Int64
wplus::Int64
delta_m::Float64
delta_p::Float64
directionGenerator
LTMADS(n, D = [eye(n,n) -eye(n,n)]) = begin
# Default values taken from Audet2006:
new(D, 4, -1, +... | multidis/BlackBoxOptim.jl | spikes/mesh_adaptive_direct_search.jl | Julia | mit | 1,592 |
n = 2
func = sphere
mu = false
lambda = false
max_fevals = 2000
covarMatrixSampler = SparseCholeskyCovarSampler
utilitiesFunc = linear_utilities
trace = true | multidis/BlackBoxOptim.jl | spikes/test.jl | Julia | mit | 157 |
using FileIO
import Base.write, Base.show
function read_data(gg::HDF5.HDF5Group)::NWBData
_ancestry = read(gg,"ancestry")
#Check the last entry
_datatype = _ancestry[end]
_data = read(gg["data"])
if "timestamps" in names(gg)
_timestamps = read(gg["timestamps"])
start_time = first(_timestamps)
if _rate i... | grero/NeurodataWithoutBorders.jl | src/io.jl | Julia | mit | 4,970 |
export
CuArray, CuVector, CuMatrix, CuVecOrMat,
device, curand
type CuArray{T,N}
ptr::CuPtr
dims::NTuple{N,Int}
end
typealias CuVector{T} CuArray{T,1}
typealias CuMatrix{T} CuArray{T,2}
typealias CuVecOrMat{T} Union{CuVector{T},CuMatrix{T}}
(::Type{CuArray{T}}){T,N}(dims::NTuple{N,Int}) = CuArray{T,N... | hshindo/CUJulia.jl | src/array.jl | Julia | mit | 5,095 |
#! /usr/bin/env/julia
"""
_Lattice
Contains a description of the type *Lattice*, which is a container for the populations of a lattice boltzmann modell.
All
"""
immutable Lattice <: Particle
f_prop::Array{Float64, 1}
f_eq::Array{Float64, 1}
f_temp::Array{Float64, 1}
density::Float64
ve... | MagB93/LatticeBoltzmann | src/grid/lattice.jl | Julia | mit | 3,515 |
include("./types.jl")
include("./tree.jl")
include("./boost.jl")
# using Juno
# using Gallium
# Train a deepboost model on the given examples, using
# numIter iterations (which not necessarily means numIter trees)
function Train(train_examples::Vector{Example}, model::Model, tree_depth::Int64,
num_iter::Int64... | wangg12/DeepBoost.jl | deepboost_C.jl | Julia | mit | 1,716 |
# syntax: proto2
using Compat
using ProtoBuf
import ProtoBuf.meta
import Base: hash, isequal, ==
type UninterpretedOption_NamePart
name_part::AbstractString
is_extension::Bool
UninterpretedOption_NamePart(; kwargs...) = (o=new(); fillunset(o); isempty(kwargs) || ProtoBuf._protobuild(o, kwargs); o)
end #typ... | JuliaPackageMirrors/ProtoBuf.jl | src/google/descriptor_pb.jl | Julia | mit | 21,009 |
#!/usr/bin/env julia
#
# Benchmarking script for singular value problems
try
Pkg.installed("Benchmarks")
catch
Pkg.clone("https://github.com/johnmyleswhite/Benchmarks.jl")
end
try
Pkg.installed("PROPACK")
catch
Pkg.clone("https://github.com/andreasnoack/PROPACK.jl")
end
using Benchmarks
using Iterati... | JuliaLang/IterativeSolvers.jl | benchmark/benchmark-svd-florida.jl | Julia | mit | 4,250 |
# coding: utf-8
using DataFrames
doc=
"""
強化学習 & 逆強化学習
2017/07/18
"""
# ランダムな状態遷移
function get_random_state(num_state)
return rand(1:num_state)
end
# ランダムな行動選択
function get_random_action(num_action)
return rand(1:num_action)
end
# 可能な状態遷移
function get_possible_actions(D, state, num_sta... | kwnsiy/q_learning_example | q_learning.jl | Julia | apache-2.0 | 9,914 |
#Implementation of the port stemmer algorithm in Julia
# Type Word for containing the relevant indicess for the algorithm
type Word
b::String
k0::Int
k::Int
j::Int
end
function stem(s::String)
if length(s)>2
return stem(Word(s, 1, length(s),0))
else
return s
end
end
funct... | JuliaPackageMirrors/CorpusTools.jl | src/PortStemmer.jl | Julia | bsd-2-clause | 10,385 |
log_temperature(t::Real) = 1 / log(t)
constant_temperature(t::Real) = 1.0
function default_neighbor!(x::Array, x_proposal::Array)
@assert size(x) == size(x_proposal)
for i in 1:length(x)
@inbounds x_proposal[i] = x[i] + randn()
end
return
end
macro satrace()
quote
if tracing
... | zhmz90/Optim.jl | src/simulated_annealing.jl | Julia | mit | 3,698 |
using Requires
write_patchwork_prelude(io::IO) =
write(io, "<script>", Patchwork.js_runtime(), "</script>")
write_escher_prelude(io::IO) = begin
write(io, Escher.custom_elements())
write_patchwork_prelude(io)
end
# FIXME: figure out a way to make this work for Escher
#
# immutable EscherDisplay <: Base.D... | jiahao/Escher.jl | src/basics/lazyload.jl | Julia | mit | 1,960 |
"""
**IJulia** is a [Julia-language](http://julialang.org/) backend
combined with the [Jupyter](http://jupyter.org/) interactive
environment (also used by [IPython](http://ipython.org/)). This
combination allows you to interact with the Julia language using
Jupyter/IPython's powerful [graphical
notebook](http://ipytho... | JuliaLang/IJulia.jl | src/IJulia.jl | Julia | mit | 10,952 |
function create_graph(start_node, end_node)
@assert Base.length(start_node)==Base.length(end_node)
no_node = max(maximum(start_node), maximum(end_node))
no_arc = Base.length(start_node)
graph = simple_inclist(no_node)
for i=1:no_arc
add_edge!(graph, start_node[i], end_node[i])
end
... | jingzbu/TrafficAssignment.jl | src/misc.jl | Julia | mit | 1,672 |
#!/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/exp/scripts/fixtures/julia/runner.jl | Julia | apache-2.0 | 1,400 |
#ODBC API Function Definitions
#By Jacob Quinn, 2013
#In general, the ODBC functions are implemented to mirror the C header files (sql.h,sqlext.h,sqltypes.h,sqlucode.h)
#A few liberties are taken in utliizing standard Julia functions and idioms
#Format:
#function name
#URL reference
#short function description
#val... | mdcfrancis/ODBC.jl | src/ODBC_API.jl | Julia | mit | 46,271 |
# XML nodes
abstract type AbstractXMLNode end
#### Types of attributes
const XML_ATTRIBUTE_CDATA = 1
const XML_ATTRIBUTE_ID = 2
const XML_ATTRIBUTE_IDREF = 3
const XML_ATTRIBUTE_IDREFS = 4
const XML_ATTRIBUTE_ENTITY = 5
const XML_ATTRIBUTE_ENTITIES = 6
const XML_ATTRIBUTE_NMTOKEN = 7
const XML_ATTRIBUTE_NMTOKENS = 8... | JuliaIO/LightXML.jl | src/nodes.jl | Julia | mit | 9,108 |
gaussjacobi(n::Number, a::Number, b::Number) =
gaussjacobi(Int(n),Float64(a),Float64(b))
function gaussjacobi(n::Int, a::Float64, b::Float64)
#GAUSS-JACOBI QUADRATURE NODES AND WEIGHTS
if n < 0
error("gaussjacobi($n,$a,$b) not defined: n must be positive.")
elseif a == 0. && b == 0.
ga... | MikaelSlevinsky/FastGaussQuadrature.jl | src/gaussjacobi.jl | Julia | mit | 11,659 |
module Stat
import Gadfly
import StatsBase
import Contour
using Colors
using Compat
using Compose
using DataArrays
using DataStructures
using Hexagons
using Loess
import Gadfly: Scale, Coord, element_aesthetics, default_scales, isconcrete,
nonzero_length, setfield!
import KernelDensity
import Distribut... | Roger-luo/Gadfly.jl | src/statistics.jl | Julia | mit | 48,149 |
immutable SpaceFunctional{O<:Functional,S<:Space,T} <: Functional{T}
op::O
space::S
end
SpaceFunctional{T<:Number,S<:Space}(o::Functional{T},s::S)=SpaceFunctional{typeof(o),S,T}(o,s)
datalength(S::SpaceFunctional)=datalength(S.op)
for TYP in (:Functional,:Operator)
@eval function Base.con... | acarta/spatiotemp | ApproxFun/src/Operators/spacepromotion.jl | Julia | mit | 5,498 |
####################
# PullRequest Type #
####################
mutable struct PullRequest <: GitHubType
base::Union{Branch, Nothing}
head::Union{Branch, Nothing}
number::Union{Int, Nothing}
id::Union{Int, Nothing}
comments::Union{Int, Nothing}
commits::Union{Int, Nothing}
additions::Union{I... | WestleyArgentum/GitHub.jl | src/issues/pull_requests.jl | Julia | mit | 2,492 |
#######################################
## Conversion (assumes input isvalid)
#######################################
function natparam(g::GaussMP)::GaussNP
P = pinv(2g.mu2.data-g.mu1*g.mu1')
GaussianNatParam(P*g.mu1, -P)
end
function natparam(g::DGaussMP)::DGaussNP
P = 1./(2g.mu2-g.mu1.^2)
DiagGaussia... | tlienart/ExpFamily.jl | src/models/gaussian_ops.jl | Julia | mit | 5,576 |
export has_bounds, bound_constrained, unconstrained
export linearly_constrained, equality_constrained, inequality_constrained
export has_equalities, has_inequalities
"""
has_bounds(nlp)
has_bounds(meta)
Returns whether the problem has bounds on the variables.
"""
has_bounds(meta::NLPModelMeta) = length(meta.i... | dpo/NLPModels.jl | src/nlp/tools.jl | Julia | mit | 2,177 |
module MacroExpandJL
export macroexpand_jl
macroexpand_jl(io::IO, ex::Expr) = (show_unquoted(io, macroexpand(ex)); print(io, "\n"))
function macroexpand_jl(outfilename, infilename)
str = readall(infilename)
open(outfilename, "w") do file
println(file, "# Auto-generated by MacroExpandJL")
prin... | timholy/MacroExpandJL.jl | src/MacroExpandJL.jl | Julia | mit | 16,254 |
#= simple.jl
Philip Barrett, pobarrett@gmail.com
26may2016, Chicago
Defines basic Polygon operations:
* Vector Addition
* SetsetSum (of both Polygon pairs and arrays)
* Scalar multiplication
* Weighted setSum
=#
"""
add( poly::Polygon, pt::Vector )
Adds a vector to all points in a Polygon
"""
func... | squipbar/Polygons.jl | src/simple.jl | Julia | mit | 3,176 |
using FactCheck, MarketData
facts("signal") do
context("foo") do
@fact cl.values[1] => 105.22
end
end
| JuliaQuant/TradeModels.jl | test/signal.jl | Julia | mit | 116 |
# Synthesizer
abstract Envelope
type ADSREnvelope <: Envelope
A::TIME_TYPE #time
D::TIME_TYPE #time
S::AMP_TYPE #amp
R::TIME_TYPE #time
amp::AMP_TYPE #attack
ADSREnvelope(A,D,S,R,amp) = new(A,D,S,R,amp)
end
const ENVELOPE_BOX = ADSREnvelope(0,0,1,0,1)
const ENVELOPE_S... | gummif/Musical.jl | src/synth.jl | Julia | mit | 7,147 |
export
say, # debug output
@verbose_say, # define say according to verbose
timestr, # time string, useful for file names
floatstr, # short float string
share, # make a tuple of array to SharedArray
load_data, # load synthetic data
generat... | innerlee/Halfspace | src/common.jl | Julia | mit | 2,384 |
using Documenter, Hecke, Pkg
include(normpath(joinpath(Hecke.pkgdir, "docs", "Build.jl")))
Build.make(Hecke; strict=false, local_build=false, doctest=true, format = :mkdocs)
## Overwrite printing to make the header not full of redundant nonsense
## Turns
## Hecke.Order - Method
## into
## Order - Method
#
## To ... | thofma/Hecke.jl | docs/make.jl | Julia | bsd-2-clause | 2,493 |
"""
```
function thin_mh_draws(m::AbstractDSGEModel, params::Matrix{Float64}; jstep::Int64 = 1)
```
Allows for a custom thinning factor (jstep) to be specified.
If not, it pulls the jstep from the model
"""
function thin_mh_draws(m::AbstractDSGEModel, params::Matrix{Float64}; jstep::Int64 = 1)
jstep = jstep == 1 ? ... | FRBNY-DSGE/DSGE.jl | src/estimate/util.jl | Julia | bsd-3-clause | 6,331 |
### Julia OpenStreetMap Package ###
### MIT License ###
### Copyright 2014 ###
### Classify highways for cars ###
function roadways(highways::Dict{Int,Highway})
roads = Dict{Int,Int}()
for (key, highway) in highways
if haskey(ROAD_CLASSES, highway.class)
roads[... | tedsteiner/OpenStreetMap.jl | src/highways.jl | Julia | mit | 2,799 |
#=
Copyright (c) 2015, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the followi... | JuliaPackageMirrors/CompilerTools.jl | src/function-descriptions.jl | Julia | bsd-2-clause | 9,135 |
#!/usr/bin/env julia
using Luxor
using Test
using Random
Random.seed!(42)
function triangle_tests(fname)
Drawing(800, 800, fname)
origin()
background("white")
fontsize(10)
panes = Tiler(500, 500, 2, 2)
@layer begin
translate(first(panes[1]))
# equilateral
tri1 = [po... | cormullion/Luxor.jl | test/triangles.jl | Julia | mit | 2,527 |
immutable Linear <: Degree{1} end
function define_indices_d(::Type{BSpline{Linear}}, d, pad)
symix, symixp, symfx, symx = symbol("ix_",d), symbol("ixp_",d), symbol("fx_",d), symbol("x_",d)
quote
$symix = clamp(floor(Int, real($symx)), 1, size(itp, $d)-1)
$symixp = $symix + 1
$symfx = $s... | SloanLindsey/Interpolations.jl | src/b-splines/linear.jl | Julia | mit | 1,396 |
# NIfTI.jl
# Methods for reading NIfTI MRI files in Julia
module NIfTI
using CodecZlib, Mmap, MappedArrays, TranscodingStreams
import Base.getindex, Base.size, Base.ndims, Base.length, Base.write, Base64
export NIVolume, niread, niwrite, voxel_size, time_step, vox, getaffine, setaffine
include("parsers.jl")
include... | simonster/NIfTI.jl | src/NIfTI.jl | Julia | mit | 11,971 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.