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 |
|---|---|---|---|---|---|
"""
Description
===========
An instance of `Inversion` holds the current state of an inversion. This
includes the population, the current generation, the boundaries of the inversion
and the inversion parameters.
Fields
======
- `data::Matrix`: The data being inverted. Columns should consist of:
1. Period
2. ... | alexjohnj/genetic-mt1d | src/Inversion.jl | Julia | mit | 5,065 |
module frame_
export
frame
include("../src/libiup_h.jl")
using IUP
#------------------------example html/examples/C/frame.c ----------------------------------
# IupFrame Example
# Draws a frame around a button. Note that "FGCOLOR" is added to the frame but it is inherited by the button.
function fram... | joa-quim/IUP.jl | examples/frame_.jl | Julia | mit | 1,130 |
@doc doc"""
Nvim([address,] port)
Nvim(path)
Represents a particular NeoVim instance. Can be instantiated with any method
signature which would return a `TCPSocket` or `Pipe` when passed to `connect`.
""" ->
type Nvim{T}
recstream::T
sendstream::T
reqid::Int
end
function Nvim{T <: Base.AsyncStrea... | Sean1708/NeoVim.jl | src/nvim.jl | Julia | mit | 1,624 |
###############################################
## Reading and writing Julia data .jld files ##
###############################################
module JLD
using HDF5
# Add methods to...
import HDF5: close, dump, exists, file, getindex, g_create, g_open, name, names, read, size, write,
HDF5ReferenceObj, HD... | mbauman/HDF5.jl | src/jld.jl | Julia | mit | 29,590 |
function polymorphism_main()
uf = UnionFinder(convert(Uint16, 2))
union!(uf, convert(Uint16, 1), convert(Uint16, 2))
reset!(uf)
@test Uint16 == typeof(find!(uf, convert(Uint16, 1)))
@test Uint16 == typeof(size!(uf, convert(Uint16, 1)))
@test_throws union!(uf, convert(Int64, 1), convert(Int64, 2... | phil-mansfield/UnionFind.jl | test/polymorphism.jl | Julia | mit | 750 |
# This file is part of the ValidatedNumerics.jl package; MIT licensed
using ValidatedNumerics
using FactCheck
facts("Constructing intervals") do
setprecision(Interval, 53)
@fact ValidatedNumerics.parameters.precision --> 53
setprecision(Interval, Float64)
@fact ValidatedNumerics.parameters.precision ... | JuliaPackageMirrors/ValidatedNumerics.jl | test/interval_tests/construction.jl | Julia | apache-2.0 | 6,664 |
VERSION >= v"0.4.0-dev+6521" && __precompile__()
module KDTrees
import Base.show
using Compat
using Devectorize
export KDTree
export knn, inball
# Deprecated!
export k_nearest_neighbour, query_ball_point
warn(string("KDTrees.jl is deprecated in favor of NearestNeighbors.jl.",
... | JuliaPackageMirrors/KDTrees.jl | src/KDTrees.jl | Julia | mit | 585 |
using BDF, Lexicon
include("extract_docstrings.jl")
#Lexicon.save("../docs/API.md", BDF)
extract_docstrings(["../src/BDF.jl"], "../docs/API.md")
cd("../")
run(`mkdocs build`)
cd("prep-release")
| sam81/BDF.jl | prep-release/prepdoc.jl | Julia | mit | 194 |
function show{FSA <: FixedVector}(io::IO, a::Vector{FSA})
print(io, "Vector with: ", length(a), "x", FSA, "[")
for elem in a
print(io, "[")
print(io, join(elem, ", "))
print(io, "]")
end
println(io, "]")
end
(.+){T<:FixedArray, ND}(a::Array{T, ND}, x::T) = T[elem + x for elem in a]
immutable MaxFun <: Func... | cdsousa/FixedSizeArrays.jl | src/array_of_fixedsize.jl | Julia | mit | 695 |
#=
demo_HDP_MultinomialDirichlet.jl
A demo for Hierarchical Dirichlet Process mixture models with MultinomialDirichlet
Bayesian components. This demo uses auxiliary variable method for for inference.
28/07/2015
Adham Beyki, odinay@gmail.com
=#
using BIAS
srand(123)
## --- synthesizing the data --- ##
# synthesize... | adham/BIAS.jl | doc/examples/demo_HDP_MultinomialDirichlet.jl | Julia | mit | 2,352 |
using JSON,Images,ArgParse
const IMGH = 90
const IMGW = 60
const RIGHT = "mr"
const LEFT = "ml"
const UP = "up"
const DOWN = "down"
const NOOP = -78
const EOF = -2 # eof for reverse data
const OUTDIR ="outdir/"
function parsedoc(fname)
inf = JSON.parsefile(fname)
global taskname = inf["task"]
... | ereday/algorithm-learning | demo/demo.jl | Julia | mit | 5,426 |
export Adam
"""
Adam
Adam: A Method for Stochastic Optimization
See: http://arxiv.org/abs/1412.6980v8
"""
type Adam
alpha::Float64
beta1::Float64
beta2::Float64
eps::Float64
states::ObjectIdDict
end
Adam() = Adam(0.001, 0.9, 0.999, 1e-8, ObjectIdDict())
function (opt::Adam){T}(param:... | goto-keisuke/Merlin.jl | src/optimizers/adam.jl | Julia | mit | 1,619 |
#! /usr/bin/julia
# Rosetta Code, Carmichael 3 strong pseudoprimes
function carmichael{T<:Integer}(pmax::T)
0 < pmax || throw(DomainError())
car = T[]
for p in primes(pmax)
for h₃ in 2:(p-1)
m = (p - 1)*(h₃ + p)
pmh = mod(-p^2, h₃)
for Δ in 1:(h₃+p-1)
... | MichaeLeroy/rosetta-code | julia/completed/carmichael_three_pseudoprimes.jl | Julia | mit | 1,236 |
module Guide
using Compat
using Colors
using Compose
using DataStructures
using Gadfly
using Iterators
using JSON
import Gadfly: render, escape_id, default_statistic, jsdata, jsplotdata,
svg_color_class_from_label
# Where the guide should be placed in relation to the plot.
abstract GuidePosition
imm... | zhmz90/Gadfly.jl | src/guide.jl | Julia | mit | 41,514 |
using Markdown
mutable struct MapRayClassGrpNew{T} #<: Hecke.Map{T, Hecke.NfOrdIdlSet}
header::Hecke.MapHeader
modulus_fin::Hecke.NfOrdIdl
modulus_inf::Array{Hecke.InfPlc,1}
function MapRayClassGrpNew{T}() where {T}
return new{T}()
end
end
#
# Modify the map of the class group so that the chosen rep... | thofma/hecke | examples/RayClass.jl | Julia | bsd-2-clause | 9,246 |
using BasisMatrices
# construct 2d basis
basis = Basis(LinParams(15, -2, 2), LinParams(10, -1, 3))
S, (x, y) = nodes(basis)
# define function to approximate
func(x, y) = exp(-2*x) * sin(y)
f = func.(S[:, 1], S[:, 2])
### getting coefficient vector
## tensor form
bmt = BasisMatrix(basis, Tensor(), [x, y])
# bmt.val... | QuantEcon/BasisMatrices.jl | demo/basis_mat_formats.jl | Julia | bsd-3-clause | 7,389 |
module Jig
export @runtest,
@context,
jtest
macro runtest(pkg, file...)
for f in file
print_with_color(:blue, string(f))
print_with_color(:blue, ":")
println("")
include(Pkg.dir("$pkg/test/$f.jl"))
end
end
macro context(s)
print(" ")
print_with_color(:magenta,s)
print("... | jgoldfar/Jig.jl | src/Jig.jl | Julia | mit | 540 |
#
# Evaluates s-plane integrand for u (and possibly ux,uy) given params a,b.
#
function integrand!(u::Vector{Complex{Float64}}, ux::Vector{Complex{Float64}}, uy::Vector{Complex{Float64}}, s::Vector{Complex{Float64}}, a::Float64, b::Float64, x::Float64, y::Float64, derivs::Bool, n::Int)
@simd for i=1:n
# Pr... | ApproxFun/SIE.jl | src/FundamentalSolutions/integrand.jl | Julia | bsd-3-clause | 1,243 |
function SeisPWD(in;w1=10,w2=10,dz_in=1,dx_in=1,format="angle")
# dip estimation by Plane Wave Destruction
# see http://sepwww.stanford.edu/data/media/public/sep//prof/pvi.pdf Chapter 4.
d=0
d = copy(in)
n1,n2 = size(in)
#format = get(param,"format","angle") # output format: "angle" (in degrees wrt vertical) or ... | fercarozzi/Seismic.jl | src/Processing/SeisPWD.jl | Julia | mit | 2,382 |
using Base.Test
import LightTable: round3
pi
float(pi)
100pi
pi/10000
@test round3(1pi) == "3.142"
@test round3(100pi) == "314.159"
@test round3(pi/10000) == "0.000314"
@test round3(1/0.999) == "1.001"
@test round3(1/9.95) == "0.101"
@test round3(1/0.999) == "1.001"
# The rounder currently bails out on these
# ro... | ssfrr/CodeTools.jl | test/display.jl | Julia | mit | 351 |
# Julia wrapper for header: /usr/include/scip/pub_misc_linear.h
# Automatically generated using Clang.jl wrap_c
function SCIPconsGetRhs(scip, cons, success)
ccall((:SCIPconsGetRhs, libscip), Cdouble, (Ptr{SCIP_}, Ptr{SCIP_CONS}, Ptr{UInt32}), scip, cons, success)
end
function SCIPconsGetLhs(scip, cons, success)
... | SCIP-Interfaces/SCIP.jl | src/wrapper/pub_misc_linear.jl | Julia | mit | 1,201 |
module PotentialInference
importall BrmlFunctions
# Type definitions:
export Potential, DiscretePotential, ArrayPotential
abstract Potential
abstract DiscretePotential <: Potential
abstract ArrayPotential <: DiscretePotential
# Type Unions:
export IntOrIntArray
IntOrIntArray=Union(Integer,Array{Integer},Array{None... | davidbarber/JuliaProbabilisticInferenceEngine | src/PotentialInference/PotentialInference.jl | Julia | mit | 2,130 |
## Testing using traits for dispatch, hand-coded
################################################
## the definitions:
# @traitfn f2{X,Y<:Integer; D1{Y}, D4{X,Y}}(x::X,y::Y) = x + sin(y)
# @traitfn f2{S,T<:Integer; D1{S}, D1{T} }(s::S,t::T) = sin(s) - sin(t)
# @traitfn f2{X,Y<:FloatingPoint; D1{X}, D1{Y} }(x::X,y::Y)... | tonyhffong/Traits.jl | test/manual-traitdispatch.jl | Julia | mit | 6,617 |
module Tst
using Base.Test
import LsoBase
# include ./tst/*
LsoBase.includedir(dirname(@__FILE__)*"/tst")
"""
tst()
Run all tests.
"""
function all()
for exp in names(Tst, true) # iterate over exported members
if (exp != :Tst && exp != :__META__ && exp != :eval && exp != :all && !startswith(... | mirkobunse/lso | mod/Tst.jl | Julia | cc0-1.0 | 424 |
const cosmic_fl = "../data/CosmicCompleteExport.tsv"
| zhmz90/StarGene | src/stargene.jl | Julia | apache-2.0 | 54 |
facts("Plotting") do
fname = joinpath(dirname(@__FILE__), "../data", "test_Hz19.5-testing.bdf")
s = read_SSR(fname)
s = rereference(s, "Cz")
s = highpass_filter(s)
s = extract_epochs(s)
s = create_sweeps(s, epochsPerSweep = 2)
s = ftest(s)
context("Spectrum") do
p = plot_spectr... | JuliaPackageMirrors/EEG.jl | test/plotting/plots.jl | Julia | mit | 1,465 |
using LowRankModels
using Plotly
test_losses = Loss[
QuadLoss(),
L1Loss(),
HuberLoss(),
PeriodicLoss(1),
OrdinalHingeLoss(1,10),
WeightedHingeLoss()
LogisticLoss(),
]
#for test_iteration = 1:5
# Create the configuration for the model (random losses)
config = round(Int, abs(round(5*rand(length(test_los... | tkelman/LowRankModels.jl | test/obj_test.jl | Julia | mit | 1,304 |
type BSONError
_wrap_::Vector{Uint8}
function BSONError()
return new(Array(Uint8, 512))
end
end
export BSONError
const domainDescs = @compat Dict{Int64,String}(1 => "JSON", 2 => "READER")
const errorDescs = @compat Dict{Int64,Any}(1 => (@compat Dict{Int64,String}(
1 => "READ_CORRUPT_JS",
... | tkelman/LibBSON.jl | src/BSONError.jl | Julia | bsd-2-clause | 822 |
using HSA
using HSA.ExtFinalization
USE_CODEGEN = false
function check(message)
println("✓ $message")
end
rt = Runtime()
check("Initializing the hsa runtime")
gpus = HSA.all_agents(dev = HSA.DeviceTypeGpu)
if isempty(gpus)
println("No GPU Agent found")
exit(1)
end
check("Getting a gpu agent")
agent = gpus[1]
n... | JuliaGPU/HSA.jl | sample/vector_copy/vector_copy.jl | Julia | mit | 5,851 |
# Hock and Schittkowski problem number 100.
#
# Source:
# Problem 100 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 PPR-AN-7-4
#
# A. Montoison, Montr... | dpo/OptimizationProblems.jl | src/hs100.jl | Julia | mit | 1,005 |
module TimeZones
using Base.Dates
import Base.Dates: AbstractTime, days, hour, minute, second, millisecond
export TimeZone, FixedTimeZone, VariableTimeZone, ZonedDateTime,
TimeError, AmbiguousTimeError, NonExistentTimeError, DateTime,
# accessors.jl
hour, minute, second, millisecond,
# adjusters.jl
... | slundberg/TimeZones.jl | src/TimeZones.jl | Julia | mit | 1,754 |
function demo_naive_update()
# Update PCCF after each observed change
# just by recalculating mean and standard deviation values
#
observed_chps_locations = [1, 11+0.9, 21-0.5, 31+1.5, 41-1.2, 51+1.25, 61, 71-1.0]
#observed_chps_locations = [1, 10, 20, 30, 40, 50, 60, 70]
n_chp = length(observe... | av-maslov/Pccf | v.1.1_ijcnn2017/201610-pccf2-code/src_julia/1naive_update.jl | Julia | mit | 996 |
#############################################################
# Data Layers
#############################################################
include("layers/hdf5-data.jl")
#############################################################
# General Computation Layers
###########################################################... | rened/Mocha.jl | src/cuda/layers.jl | Julia | mit | 1,155 |
@doc """`sminreal(sys)`
Compute the structurally minimal realization of the state-space system `sys`. A
structurally minimal realization is one where only states that can be
determined to be uncontrollable and unobservable based on the location of 0s in
`sys` are removed.""" ->
function sminreal(sys::StateSpace)
A... | JuliaPackageMirrors/ControlSystems.jl | src/simplification.jl | Julia | mit | 1,315 |
Vega.tojs(VegaMark())
copy(VegaMark())
| spencerlyon2/Vega.jl | test/mark.jl | Julia | mit | 39 |
function quoteid(conn, str)
if conn.quoteidentifierchar == '\0'
conn.quoteidentifierchar = API.getinfostring(conn.dbc, API.SQL_IDENTIFIER_QUOTE_CHAR)[1]
end
# avoid double quoting
if str[1] == conn.quoteidentifierchar && str[end] == conn.quoteidentifierchar
return str
else
re... | JuliaDB/ODBC.jl | src/load.jl | Julia | mit | 5,613 |
# Copyright (c) 2013 Jasper den Ouden, under the MIT license,
# see doc/mit.txt from the project directory.
module Treekenize
import Base.readline
export treekenize, StrExpr #Function for making trees itself.
export none_incorrect
#Each element needs these to know what to do.
export head_expr, head_begin,head_end,h... | o-jasper/Treekenize.jl | src/Treekenize.jl | Julia | mit | 7,448 |
### ============== ### ============== ### ============== ###
### OUTPUT FOLDER STRUCTURE
### ============== ### ============== ### ============== ###
function set_output_data_structure(path, N, κ, ω)
parent_folder_path = "$(homedir())/art_DATA/$(path)"
folder_path = parent_folder_path * "/DATA/data_N_$(N)"
... | martinzh/CollectiveDynamics.jl | src/short_long_range_model.jl | Julia | mit | 14,989 |
#!/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/pareto-type1/logpdf/test/fixtures/julia/runner.jl | Julia | apache-2.0 | 2,055 |
module ReverseRegexes
export @rr_str, @rr_mstr
import Base: print, reverse, rsearch
type ReverseRegex
rx::Regex
end
type RTok{T}
args::Vector{Any}
end
RTok(tag::Symbol, args...) = RTok{tag}({args...})
tag{T}(::RTok{T}) = T
hastag{T}(::RTok{T}, tag::Symbol) = T == tag
hastag{T}(::RTok{T}, tag::Vector) = T i... | carlobaldassi/ReverseRegexes.jl | src/ReverseRegexes.jl | Julia | mit | 10,445 |
module Raytracing
using CG, Camera, SceneObjects;
export Ray, generateRay, intersect;
type Ray
origin::Vec4f;
direction::Vec4f;
end
function generateRay(camera::PinholeCamera, i::Int, j::Int)
u = -camera.w / 2 + camera.w * (i - 0.5) / camera.nx
v = +camera.h / 2 - camera.h * (j - 0.5) / camer... | fpoppinga/cg | raytracing.jl | Julia | mit | 2,948 |
import Base: copy, copyto!, ==
import RandomNumbers: AbstractRNG, seed_type
"""
```julia
WrappedRNG{R, T1, T2} <: AbstractRNG{T2}
WrappedRNG(base_rng, T2)
WrappedRNG(R, T2, args...)
```
Wrap a RNG which originally provides output in T1 into a RNG that provides output in T2.
# Examples
```jldoctest
julia> r = Xorshif... | sunoru/RNG.jl | src/wrapped_rng.jl | Julia | mit | 2,732 |
module Gilbert
using Distributions
import Params
using Util
export GilbertChannel, iterate!, interfere!, berawgn, capacity, transmission_successes
type GilbertChannel
# channel frequency, in Hz
freq :: Float64
# channel bandwidth, used here for increasing data locality hopefully
bandwidth :: Float64
... | maemre/Rasim.jl | src/Channel/Gilbert.jl | Julia | mit | 3,024 |
@testset "formatter" begin
@static if VERSION < v"1.4"
@test_broken !isempty(Atom.FORMAT_TEXT_KWARGS)
else
@test !isempty(Atom.FORMAT_TEXT_KWARGS)
end
end
| JunoLab/Atom.jl | test/formatter.jl | Julia | mit | 183 |
include("segbase.jl")
include("plot.jl")
| jakesnell/Seglib.jl | src/Seglib.jl | Julia | mit | 41 |
module SystemSolver
export Solver, forwardeuler, addbody!, init!, solve!
include("vector3d.jl")
include("celestial.jl")
import Base:show, +, -, *
import Vector3D: Vec3, +, -, *
import Celestial: CelestialBody, init!, distance, tomatrix, show
pprint(x) = show(IOContext(STDOUT, limit=false), "text/plain", x)
mutable s... | Caronthir/FYS3150 | Project3/julia/solver.jl | Julia | mit | 1,713 |
using PETSc
PETSc.PetscInitialize()
using FactCheck
import MPI
MPI.Init()
include("test_error.jl")
include("test_vec.jl")
include("test_mat.jl")
PETSc.C.PetscFinalize(Float64)
| jiahao/PETSc.jl | test/runtests.jl | Julia | mit | 178 |
#Install required packages
Pkg.add("Images")
Pkg.add("DataFrames")
using Images
using DataFrames
#typeData could be either "train" or "test.
#labelsInfo should contain the IDs of each image to be read
#The images in the trainResized and testResized data files
#are 20x20 pixels, so imageSize is set to 400.
#path shoul... | LarryBattleWork/Kaggle_Contest | contest1/src/tutorial.jl | Julia | mit | 2,376 |
#############################################################################
# diagm.jl
# Converts a vector of size n into an n x n diagonal
# All expressions and atoms are subtpyes of AbstractExpr.
# Please read expressions.jl first.
#############################################################################
impor... | JuliaPackageMirrors/Convex.jl | src/atoms/affine/diagm.jl | Julia | bsd-2-clause | 1,738 |
"""
Wrapper for Sundials `N_Vector` that
uses Julia `Vector{realtype}` as the data container.
Implements `DenseVector` interface and
manages automatic destruction of the referenced `N_Vector` when it is
no longer in use.
"""
immutable NVector <: DenseVector{realtype}
ref_nv::Ref{N_Vector} # refere... | JuliaPackageMirrors/Sundials.jl | src/nvector_wrapper.jl | Julia | bsd-2-clause | 3,279 |
#############################################################################
# rational_norm.jl
#
# Handles the k-norms for k > 1 where k is rational. Reduces the
# k-norm constraint to at most 2d ceil(log2(n + m)) + O(d) second
# order cone constraints. Here d is the dimension of the problem and k
# is converted to a... | ahwillia/Convex.jl | src/atoms/second_order_cone/rational_norm.jl | Julia | bsd-2-clause | 4,384 |
function allocate(
::Type{Vector{Any}},
nrows::Int,
ncols::Int,
reader::CSVReader,
)
return Array(Any, nrows * ncols)
end
function available_rows(output::Vector{Any}, reader::CSVReader)
return fld(length(output), length(reader.column_names))
end
function add_rows!(output::Vector{Any}, nrows::I... | johnmyleswhite/CSVReaders.jl | src/interface/vector_any.jl | Julia | mit | 2,376 |
#-------------------------------------------------------------------
#* 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/flux_mass_delta.jl | Julia | mit | 2,457 |
using Base.Test
import StatsBase: fit, predict
require("src/liblinear.jl")
import liblinear: ClassificationParams, ClassificationModel, RegressionModel
x_train = sparse([
0 0 1 0 1;
0 1 1 0 0;
1 0 0 0 1;
0 0 1 0 0;
0 1 0 1 0;
1 1 0 0 1
])
y_train = [0, 0, 0, 1, 1, 1]
x_test = sparse([
1 0 0 0 1;
0 0... | tuzzeg/liblinear.jl | test/test_sparse.jl | Julia | mit | 1,628 |
#=
Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5:
22=4, 23=8, 24=16, 25=32
32=9, 33=27, 34=81, 35=243
42=16, 43=64, 44=256, 45=1024
52=25, 53=125, 54=625, 55=3125
If they are then placed in numerical order, with any repeats removed, we get the following sequence of 15 distinct terms:
4, 8, 9, 16... | daniel-beard/JuliaProjectEuler | Solutions/p29.jl | Julia | mit | 660 |
function thresh(x, sorh, t)
y = zeros(x)
if sorh == "s"
tmp = abs(x) - t
tmp = (tmp + abs(tmp)) / 2
y = sign(x).*tmp
end
if sorh == "h"
n = length(x)
for i=1:n
if abs(x[i]) <= t
x[i] = 0.
end
end
y = copy(x)
end
return y
end
| aaronstanton/Seismic.jl | src/Solvers/thresh.jl | Julia | mit | 287 |
@testset "Power modulo" begin
R = ResidueRing(ZZ,7)
Rx,x = R["x"]
f = rand(Rx, 1:10)
g = x^4+x+1
e = fmpz(10)^20
@test powermod(f,e,g) == powermod(f,e%(7^degree(g)-1),g)
@test powermod(f,fmpz(0),g) == 1
end
| thofma/Hecke.jl | test/Misc/Powmod_test.jl | Julia | bsd-2-clause | 235 |
"""
Check that the dynamic program is solved
"""
function checkdp(model::RustModelCore)
V1=\(eye(model.pi[1])-model.beta*model.pi[1],model.u[:,1]-log(model.p[:,1]))
V2=\(eye(model.pi[2])-model.beta*model.pi[2],model.u[:,2]-log(model.p[:,2]))
norm(V1-V2)
end
#changing autoscale option might solve numerical issues s... | BenConnault/RustModels.jl | src/dynamicprogram.jl | Julia | mit | 4,595 |
# Takes an output name which will be made into a directory
# The dataframe and associated information exported out
# and appropriate plots made
# possibly a web happy report made
# this is then zipped up
#s
include(Pkg.dir("BismarkSummary","src","bismark-report.jl"))
test_bismark_report1 = joinpath(Pkg.dir(), "Bismark... | nw11/BismarkSummary.jl | examples/eg3.jl | Julia | mit | 919 |
using BinDeps, Compat
@BinDeps.setup
mpath = get(ENV, "MAGICK_HOME", "") # If MAGICK_HOME is defined, add to library search path
if !isempty(mpath)
push!(DL_LOAD_PATH, mpath)
push!(DL_LOAD_PATH, joinpath(mpath,"lib"))
end
libnames = ["libMagickWand", "CORE_RL_wand_"]
suffixes = ["", "-Q16", "-6.Q16", "-... | staticfloat/ImageMagick.jl | deps/build.jl | Julia | mit | 4,049 |
"""
Core SearchLight configuration / settings functionality.
"""
module Configuration
import YAML, Logging
using SearchLight
export env, Settings
# app environments
const DEV = "dev"
const PROD = "prod"
const TEST = "test"
haskey(ENV, "SEARCHLIGHT_ENV") || (ENV["SEARCHLIGHT_ENV"] = DEV)
"""
env() :: String... | essenciary/SearchLight.jl | src/Configuration.jl | Julia | mit | 4,186 |
using Compat
using Distributions
using PDMats
import Base.LinAlg: Cholesky
immutable NormalWishart <: Distribution
dim::Int
zeromean::Bool
mu::Vector{Float64}
kappa::Float64
#Tchol::Cholesky{Float64} # Precision matrix (well, sqrt of one)
T::Matrix{Float64}
nu::Float64
function Norma... | jaak-s/BayesianDataFusion.jl | src/normal_wishart.jl | Julia | mit | 1,115 |
function testJackknife(numtest, MCS, obs)
inform("Start testing Jackknife / $obs")
nsigma = 3
counts = zeros(Int, nsigma)
for itest in 1:numtest
sobs = obs()
for mcs in 1:MCS
sobs << randn()
end
jk = jackknife(sobs)
@test_approx_eq_eps mean(sobs) mean(jk) 1.0e-10
@test_appro... | yomichi/MCObservables.jl | test/Jackknife.jl | Julia | mit | 512 |
using GitHub, JSON, HTTP, MbedTLS, URIs
using Dates, Test, Base64
using GitHub: Branch, name
using GitHub.Checks
include("ghtype_tests.jl")
include("event_tests.jl")
include("read_only_api_tests.jl")
include("auth_tests.jl")
@testset "SSH keygen" begin
pubkey, privkey = GitHub.genkeys(keycomment="GitHub.jl")
... | JuliaWeb/GitHub.jl | test/runtests.jl | Julia | mit | 391 |
"Logger configuration"
type LoggerConfig <: Filterable
name::AbstractString
level::LEVEL
additive::Bool
appenders::AppenderReferences
parent::Nullable{LoggerConfig}
event::FACTORY
# Filterable
filter::FILTER
state::LifeCycle.State
#TODO: properties::Dict{Property, Bool}
end
t... | wildart/Log4jl.jl | src/logconfig.jl | Julia | apache-2.0 | 3,239 |
#=
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/Latte.jl | test/stdlib/test_tanh.jl | Julia | bsd-3-clause | 2,374 |
module Execution
using ..HSA
debug_print = HSA.debug_print
include("arguments.jl")
include("kernel.jl")
include("packet.jl")
include("hsa_kernel.jl")
end # module Execution
using .Execution
export @hsa
macro hsa(range, call)
# support plain integer for 1D ranges
if isa(range, Integer) || isa(range, Symbol)... | rollingthunder/HSA.jl | src/codegen/execution/Execution.jl | Julia | mit | 1,623 |
if length(ARGS) < 1
println("Usage: julia startup.jl <clustername>")
exit()
end
include("ccconsts.jl")
include("ccutils.jl")
uname = get_cluster_name()
println("Launching $cc_instnum with cluster name $uname")
if !isdefined(Main, :cc_ami) || (cc_ami == "")
println("Detecting AMI to use. Looking for AMIs ... | tanmaykm/julia_examples | common_crawl_indexer/hw/startup.jl | Julia | mit | 2,082 |
## NamedArrays.jl
## (c) 2013--2014 David A. van Leeuwen
## Julia type that implements a drop-in replacement of Array with named dimensions.
## This code is licensed under the MIT license
## See the file LICENSE.md in this distribution
VERSION >= v"0.4.0-dev+6521" && __precompile__()
module NamedArrays
using Compa... | JuliaPackageMirrors/NamedArrays.jl | src/NamedArrays.jl | Julia | mit | 757 |
tested_file = "RoesserModels.jl"
#########################################################################################
# Test Functions
function test_validmodel()
print_with_color(:blue, "Testing the creation of a valid Roesser model.\n")
A1 = randn(3,3)
A2 = randn(3,2)
A3 = randn(2,3)
A4 = randn(2,2)
... | forcaeluz/RoesserModels.jl | test/roessertests.jl | Julia | mit | 3,577 |
# provide some most commonly used options, leave rest as low level
# common options: Orthogonilization type, KSP type, PC type
# use PC context created as part of KSP
export KSP, petscview
###########################################################################
# solver context
type KSP{T}
p::C.KSP{T}
functio... | stevengj/PETSc.jl | src/ksp.jl | Julia | mit | 5,914 |
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
"""
Parameters
----------
distval
a charasteristic measure to skip element pair, 0..5 => near, 10+ => far
5 means that distance of slave element midpoint and point to project
is 5 times ... | JuliaPackageMirrors/JuliaFEM.jl | src/problems_contact.jl | Julia | mit | 1,991 |
"""
struct ProductSpace{S<:ElementarySpace, N} <: CompositeSpace{S}
A ProductSpace is a tensor product space of `N` vector spaces of type
`S<:ElementarySpace`. Only tensor products between `ElementarySpace` objects of
the same type are allowed.
"""
struct ProductSpace{S<:ElementarySpace, N} <: CompositeSpace{S}
... | Jutho/TensorToolbox.jl | src/spaces/productspace.jl | Julia | mit | 3,112 |
mutable struct FilterDesc
ptr::Cptr
function FilterDesc(::Type{T}, dims::Dims{N}) where {T,N}
ref = Ref{Cptr}()
@cudnn :cudnnCreateFilterDescriptor (Ptr{Cptr},) ref
desc = new(ref[])
push!(ALLOCATED, desc)
finalizer(desc) do x
@cudnn :cudnnDestroyFilterDescri... | hshindo/Merlin.jl | src/cuda/cudnn/filter.jl | Julia | mit | 745 |
# Supported domains: Real, Boolean, Ordinal, Periodic, Count
# The purpose of domains is to be able to impute over different possible values of `a` regardless of
# the loss that was used in the GLRM. The reason for doing this is to evaluate the performance of GLRMS.
# For instance, let's say we use PCA (quadratic loss... | zhmz90/LowRankModels.jl | src/impute_and_err.jl | Julia | mit | 6,431 |
"""
greenspline(cmd0::String="", arg1=nothing; kwargs...)
Reads randomly-spaced (x,y,z) triples and produces a binary grid file of gridded values z(x,y) by solving:
(1 - T) * L (L (z)) + T * L (z) = 0
Full option list at [`greenspline`]($(GMTdoc)greenspline.html)
Parameters
----------
- $(GMT.opt_R)
- **I**... | joa-quim/GMT.jl | src/greenspline.jl | Julia | mit | 4,306 |
#=
Working from left-to-right if no digit is exceeded by the digit to its left it is called an increasing number; for example, 134468.
Similarly if no digit is exceeded by the digit to its right it is called a decreasing number; for example, 66420.
We shall call a positive integer that is neither increasing nor decre... | daniel-beard/JuliaProjectEuler | Solutions/p112.jl | Julia | mit | 1,287 |
export Lemma
const SPACE = ' '
immutable Lemma
word::AbstractString
pos::Char
tagsense_count::Int
synset_offsets::Vector{Int}
id::Int
pointer_syms::Vector{AbstractString}
end
function Lemma(lexicon_line, id)
parts = split(lexicon_line, SPACE)
word = shift!(parts)
pos = shift!... | JuliaPackageMirrors/WordNet.jl | src/lemma.jl | Julia | mit | 767 |
###############################################
## Reading and writing Julia data .jld files ##
###############################################
VERSION >= v"0.4.0-dev+6521" && __precompile__()
module JLD
using HDF5, Compat
# Add methods to...
import HDF5: close, dump, exists, file, getindex, setindex!, g_create, g_op... | emoszkowski/JLD.jl | src/JLD.jl | Julia | mit | 39,579 |
module ArbFloats
import Base: convert, promote_rule, promote_type,
hash, string, show, showcompact,
(<),(<=),(==),(!=),(>=),(>),isless,isequal,
zero,one,ldexp,floor,ceil,
(+),(-),(*),(/),(%),(^),sqrt,hypot,
exp,expm1,log,log1p,log2,log10,
sin,cos,tan,cot,
asin,acos,atan,acot,atan2,
sinh... | J-Sarnoff/ArbFloats.jl | src/ArbFloats.jl | Julia | mit | 3,317 |
# okay, test to see if rejection sampling works
# a very simple rejection sampling algorithm
using Distributions
abstract type Sampler end
abstract type MCMCSampler <: Sampler end
abstract type RejectionSampler <: MCMCSampler end
type StandardRejectionSampler <: RejectionSampler
envelope:: Function
tries:: Abstr... | Bmillidgework/Misc-Maths | Misc/rejection_sampler.jl | Julia | mit | 907 |
# Initially adapted from PiecewiseAffineTransforms.jl
# https://github.com/dfdx/PiecewiseAffineTransforms.jl
global MESHWARP_POLY2SOURCE_MASK = zeros(Bool, 0, 0);
"""
`MESHWARP` - Apply piecewise affine transform to image using bilinear interpolation
warped_img, [bb.i, bb.j] = meshwarp(img, src, dst, trigs, offs... | JuliaPackageMirrors/ImageRegistration.jl | src/meshwarp.jl | Julia | mit | 10,111 |
using JSON
json(rootNode::RootNode) = map(to_dict, children(rootNode)) |> JSON.json
function to_dict(factGroup::FactsCollectionNode)
_children = factGroup |> children
childFactGroups = filter(child -> isa(child, FactsCollectionNode), _children)
childFacts = filter(child -> isa(child, FactNode), _children)
chi... | gdziadkiewicz/TestRunner.jl | src/TestRunnerJSON.jl | Julia | mit | 1,056 |
module TestCSR
include(Pkg.dir("SparseMatrices", "src", "SparseMatrices.jl"))
using FactCheck
I = [1, 2, 1]
J = [1, 1, 3]
V = [1, 1, 2]
Ar = SparseMatrices.SparseMatrixCSR(I, J, V, 2, 3)
A_full = [1 0 2; 1 0 0]
facts("Test SparseMatrixCSR") do
context("test A_mul_B!") do
context("CSR*StridedVector") ... | JuliaSparse/SparseMatrices.jl | test/csr.jl | Julia | mit | 1,698 |
module TestCat
using Base.Test
using DataFrames
#
# hcat
#
dvint = @data([1, 2, NA, 4])
dvstr = @data(["one", "two", NA, "four"])
df2 = DataFrame(Any[dvint, dvstr])
df3 = DataFrame(Any[dvint])
df4 = convert(DataFrame, [1:4 1:4])
df5 = DataFrame(Any[@data([1,2,3,4]), dvstr]... | JuliaPackageMirrors/DataFrames.jl | test/cat.jl | Julia | mit | 3,061 |
using Bandits
using Base.Test
tests = [
"utils",
"combinatorial_bandit_algorithms",
"bandit_algorithms",
"experiments"]
failed = false
nb_errors = 0
for t in tests
try
include("$(t).jl")
catch e
warn(e)
failed = true
nb_errors += 1
end
end
if failed
warn(... | RemyDegenne/Bandits | test/runtests.jl | Julia | mit | 399 |
#=
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/CFGs.jl | Julia | bsd-2-clause | 51,396 |
using HyperLogLog
@printf "Running tests\n"
for file in ["test/utils.jl", "test/HyperLogLog.jl"]
@printf " * %s\n" file
include(file)
end
| JuliaPackageMirrors/HyperLogLog.jl | run_tests.jl | Julia | mit | 142 |
### Julia OpenStreetMap Package ###
### MIT License ###
### Copyright 2014 ###
### Default Speed Limits in Kilometers Per Hour ###
const SPEED_ROADS_URBAN = Compat.@Dict(
1 => 95, # Motorway
2 => 72, # Trunk
3 => 48, # Primary
4 => 32, # Secondary
5 => 22, ... | JuliaPackageMirrors/OpenStreetMap.jl | src/speeds.jl | Julia | mit | 580 |
module SimpleOptimizers
include("derivative.jl")
include("hessian.jl")
include("newton_raphson.jl")
include("constrained_newton_raphson.jl")
include("BFGS.jl")
include("constrained_BFGS.jl")
include("nelder_mead.jl")
include("genetic_search.jl")
include("pattern_search.jl")
include("mesh_search.jl")
include("hooke_jee... | RJDennis/SimpleOptimizers.jl | src/SimpleOptimizers.jl | Julia | mit | 741 |
type T
f::Function
inF::Function
t::Task
T(f) = new(f)
end
function main()
amount = 2
tasks = T[]
for i = 1:amount
t = T(function(t) function() while true produce(); t.inF() end end end)
t.inF = function() produce(); produce(); produce() end
t.t = Task(t.f(t))
push!(tasks, t)
end
while... | tmptrash/jevo | tmp/consume.jl | Julia | mit | 611 |
using Symata
using Test
@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.0
den = 1.0
For( j=1, j <= N, Increment(j),
begin
num = If(j !... | goedman/NMfE.jl | test/ch07_jl_sym_fnc_ex.jl | Julia | mit | 3,494 |
const SET = Union{Set,Vector,Tuple}
bytes(r) = convert(Vector{UInt8}, r)
time_ms() = round(Int64, time() * 1000)
| JuliaDB/Accumulo.jl | src/types.jl | Julia | mit | 115 |
type Engine
ostream::IO
location::String
timeout::FloatingPoint
max_hb_misses::Int
# SSH tunnling stuff
end
| jakebolewski/Ciel.jl | src/engine.jl | Julia | mit | 130 |
using LPC
using Base.Test # can I use FactCheck instead ?
a, err, relf = lpc_burg(rand(10), 3)
@test false # TODO
| oyd11/LPC.jl | test/runtests.jl | Julia | mit | 121 |
using ThreshCluster
mydistance(a,b) = abs(a-b)
threshcrit = Simple_Threshold_Criteria(:size,x->x.size,mydistance,4)
type Fish
size
end
array_of_fish = [Fish(2),Fish(5),Fish(64),Fish(12)]
println("array_of_fish\n",array_of_fish)
clusters = make_simple_threshold_clusters(array_of_fish,threshcrit)
println(clusters)
| cuevasclemente/ThreshCluster.jl | tests/ThreshClustTest.jl | Julia | apache-2.0 | 320 |
# Determine the local system's time zone
# Based upon Python's tzlocal https://pypi.python.org/pypi/tzlocal
import Compat: @static, is_apple, is_unix, is_windows, readstring
using Mocking
"""
localzone() -> TimeZone
Returns a `TimeZone` object that is equivalent to the system's current time zone.
"""
function loc... | JuliaPackageMirrors/TimeZones.jl | src/local.jl | Julia | mit | 5,601 |
using CUSPARSE
using CUDArt
using Base.Test
m = 5
n = 5
k = 10
blockdim = 5
@testset "geam" begin
@testset for elty in [Float32,Float64,Complex64,Complex128]
A = sparse(rand(elty,m,n))
B = sparse(rand(elty,m,n))
alpha = rand(elty)
beta = rand(elty)
@testset "csr" begin
... | kshyatt/CUSPARSE.jl | test/geam.jl | Julia | mit | 3,076 |
using HSA
include("helpers.jl")
using FactCheck
facts("The Agents") do
rt = Runtime()
agents = Array(HSA.Agent,0)
context("Can be iterated over") do
context("with a callback returning true to continue") do
HSA.iterate_agents(a -> begin
push!(agents, a)
... | rollingthunder/HSA.jl | test/agent.jl | Julia | mit | 3,157 |
using FixedSizeArrays, ImmutableArrays
immutable BenchData <: FixedVector{Float64, 5}
gc_bytes::Float64
time_ns::Float64
gc_time_ns::Float64
gc_num_pause::Float64
gc_num_full_sweep::Float64
end
function Base.show(io::IO, b::BenchData)
print(io, """
bytes allocated : $(b.gc_bytes)
time_ns : $(b.time_ns)
... | mschauer/FixedSizeArrays.jl | bench/construction.jl | Julia | mit | 3,247 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.