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 |
|---|---|---|---|---|---|
# *****************************************************************************
# Written by Ritchie Lee, ritchie.lee@sv.cmu.edu
# *****************************************************************************
# Copyright ã 2015, United States Government, as represented by the
# Administrator of the National Aeronautics... | rcnlee/GrammarExpts.jl | modules/APLSummaryConverter/test/runtests.jl | Julia | apache-2.0 | 2,428 |
export
namfrm,
ncpos,
ncposr,
nearpt,
npedln,
npelpt,
nplnpt,
nvc2pl,
nvp2pl
"""
namfrm(frname)
Look up the frame ID code associated with a string.
### Arguments ###
- `frname`: The name of some reference frame
### Output ###
The SPICE ID code of the frame.
### References ... | helgee/SPICE.jl | src/n.jl | Julia | mit | 7,385 |
using BayesianDataFusion
#using BayesianDataFusion.ParallelMatrix
using Base.Test
using Compat
######### test hilbert sorting #######
rows = [1:4; 1:4; 1:4; 1:4]
cols = [1,1,1,1, 2,2,2,2, 3,3,3,3, 4,4,4,4]
r2, c2 = sort_hilbert(rows, cols)
######### test block order ########
@test BayesianDataFusion.block_order( [... | jaak-s/BayesianDataFusion.jl | test/parallel_matrix.jl | Julia | mit | 3,385 |
# genetics.jl
# This script defines the "alogirthm" used to solve the problem in the form of genes
# Genes are defined in a tree structure, referencing their parents.
###### Example Genetics ######
# Create All Genes
# Define all Proteins Generated by Genes
# Proteins are all functions
# Note: protein lifetime lengt... | voutasaurus/metalbolicAlgorithm | genetics.jl | Julia | apache-2.0 | 1,307 |
package java.lang;
import java.util.Random;
public final class Math {
/**
* Don't let anyone instantiate this class.
*/
private Math() {}
/**
* The <code>double</code> value that is closer than any other to
* <i>e</i>, the base of the natural logarithms.
*/
public static fin... | HarvardPL/cryptoerase | sig-src/java/lang/Math.jl | Julia | bsd-3-clause | 34,880 |
using Test, SndLib, WAV
wavDir = "wavDir/"
sf = 48000
nbits = 32
frequency = 1000
phase = 0
level = 60
dur = 1
rampDur = 0.01
maxLevel = 101
channelOpts = ["mono", "right", "left", "diotic"]
for channel in channelOpts
pt = pureTone(frequency=frequency, phase=phase, level=level, dur=dur,
rampDur... | sam81/SndLib.jl | test/test_pureTone.jl | Julia | mit | 558 |
srvrscript = joinpath(dirname(@__FILE__), "srvr.jl")
srvrcmd = `$(joinpath(JULIA_HOME, "julia")) $(srvrscript)`
println("spawining $srvrcmd")
srvrproc = spawn(srvrcmd)
include("clnt.jl")
println("stopping server process")
kill(srvrproc)
addprocs(1)
@spawnat 2 include("srvrfn.jl")
tic()
for idx in 1:NCALLS
arg1,a... | mdpradeep/JuliaWebAPI.jl | test/runtests.jl | Julia | mit | 591 |
import ImageView.display
type RasterImage{T,N,A<:AbstractArray} <: AbstractImageDirect{T,N}
data::A
properties::Dict
end
RasterImage(data::AbstractArray,props::Dict) = RasterImage{eltype(data),ndims(data),typeof(data)}(data,props)
RasterImage(raster::Raster) = RasterImage{eltype(raster.data),ndims(raster.data... | wkearn/GIS.jl | src/display.jl | Julia | mit | 596 |
using BNPMix
using Base.Test
sampler = SliceStepOut(0.2, 50)
sigma = 0.5
numdata = 10000
function logDensity(x::Float64)
return - (x+1)^2/(2*4) - (x-1)^2/(2*4)
end
mean = 0.0
var = 0.0
for i in 1:numdata
#sample(sampler, logDensity, sigma)
sigma = sample(sampler, logDensity, sigma)
mean += sigma
var += sig... | BigBayes/BNPMix.jl | test/sliceStepOutTest.jl | Julia | mit | 496 |
@testset "lsmr" begin
lsmr_tol = 1.0e-5
for FC in (Float64,)
@testset "Data Type: $FC" begin
for npower = 1 : 4
(b, A, D, HY, HZ, Acond, rnorm) = test(40, 40, 4, npower, 0) # No regularization.
(x, stats) = lsmr(A, b)
r = b - A * x
resid = norm(A' * r) / norm(b)
... | JuliaOptimizers/Krylov.jl | test/test_lsmr.jl | Julia | mit | 3,232 |
# This file is auto-generated by AWSMetadata.jl
using AWS
using AWS.AWSServices: transfer
using AWS.Compat
using AWS.UUIDs
"""
create_access(external_id, role, server_id)
create_access(external_id, role, server_id, params::Dict{String,<:Any})
Used by administrators to choose which groups in the directory shou... | JuliaParallel/AWS.jl | src/services/transfer.jl | Julia | mit | 74,911 |
module ColorTypes
using Color, FixedPointNumbers, Compat, Base.Cartesian
import Color: Fractional, _convert
import Base: ==, abs, abs2, clamp, convert, div, isfinite, isinf,
isnan, isless, length, one, promote_array_type, promote_rule, zero,
trunc, floor, round, ceil, bswap,
mod, rem
export ARGB, BGR, RG... | rened/Images.jl | src/colortypes.jl | Julia | mit | 25,603 |
using Base.Test, Lumberjack
#import Mocking: mend TODO
modes = ["debug", "info", "notice", "warning", "err", "crit", "alert", "emerg"]
configure(; modes=[modes..., "invalid-syslog-level"])
Lumberjack.add_truck(LumberjackTruck(Syslog(:local0, "julia")))
# Syslog uses an external call to logger to do its legwork. Becau... | WestleyArgentum/Lumberjack.jl | test/test-syslog.jl | Julia | mit | 989 |
# This code demonstrates the use of SolveDSGE for solving rational expectations models
# to second-order accuracy. The demonstration models are the first and second examples
# from Schmitt-Grohe and Uribe (2004)
#-------------------------------------------------------------------------------------------#
# Bring the... | RJDennis/SolveDSGE | test/old/second_order_example.jl | Julia | mit | 7,951 |
cubox(p::CudaPtr) = cubox(p.ptr)
cubox(a::CdArray) = cubox(rawpointer(a))
cubox{T}(x::T) = T[x]
function launch(f::CuFunction, grid::CudaDims, block::CudaDims, args::Tuple; shmem_bytes::Int=4, stream=null_stream)
gx = get_dim_x(grid)
gy = get_dim_y(grid)
gz = get_dim_z(grid)
tx = get_dim_x(block)
... | lucasb-eyer/CUDArt.jl | src/execute.jl | Julia | mit | 1,417 |
function cuda_geometry(:: ActivationFunction, output :: Blob)
len = length(output)
x_block = round(Int64, ceil(float64(len)/512));
return ((x_block,512), (len,))
end
############################################################
# Rectified-Linear
############################################################
funct... | ilo10/Mocha.jl | src/cuda/neurons.jl | Julia | mit | 4,188 |
@defstruct ChannelPoolingLayer Layer (
name :: String = "channel-pooling",
(bottoms :: Vector{Symbol} = Symbol[], length(bottoms) > 0),
(tops :: Vector{Symbol} = Symbol[], length(tops) == length(bottoms)),
(kernel :: Int = 1, kernel > 0),
(stride :: Int = 1, stride > 0),
(pad :: NTuple{2, Int} = (0,0), all(... | shyamalschandra/Mocha.jl | src/layers/channel-pooling.jl | Julia | mit | 4,538 |
using Benchmark
################################################################################
# Benchmark to see whether loop is faster than matrix operation
#
# | Row | Function | Average | Relative | Replications |
# |-----|--------------|-----------|----------|--------------|
# | 1 | "relu_loop" | 0.0283... | appapantula/Mocha.jl | benchmarks/loop-vs-whole.jl | Julia | mit | 1,654 |
mean_beta(a, b) = a / (a + b)
meanlog_beta(a, b) = digamma(a) - digamma(a + b)
mean_mirror(a, b) = mean_beta(b, a)
meanlog_mirror(a, b) = meanlog_beta(b, a)
function expected_logpi!{Tw <: Integer}(pi::Vector{Float64}, vm::VectorModel, w::Tw, min_prob::Float64=1e-3)
r = 0.
x = 1.
senses = 0
pi[:] = vm.counts[:, w] ... | buriy/AdaGram.jl | src/stick_breaking.jl | Julia | mit | 1,268 |
function handle_msg(w::InputWidget, msg)
if msg.content["data"]["method"] == "backbone"
recv(w, msg.content["data"]["sync_data"]["value"])
end
end
function handle_msg{T}(w::Button{T}, msg)
try
if msg.content["data"]["method"] == "custom" &&
msg.content["data"]["content"]["event... | stevengj/Interact.jl | src/IJulia/handle_msg.jl | Julia | mit | 875 |
module Cells
import Base.*
export Cell, Simplex, UFCSimplex, val2val, spatialDimension, getVertexCoords
export TensorProductCell, getCellTopology, *
abstract Cell
abstract Simplex{T<:Val} <: Cell
immutable UFCSimplex{T<:Val} <: Simplex{T} end
immutable TensorProductCell{C1<:Cell, C2<:Cell} <: Cell end
*{C1<:Cel... | rckirby/JFiniteElements.jl | src/Cells.jl | Julia | mit | 4,399 |
## Imported math functions
## make vectorized version while we are at it
for fn in (:sin, :cos, :tan, :sinh, :cosh, :tanh, :asin, :acos, :atan,
:asinh, :acosh, :atanh, :sec, :csc, :cot, :asec, :acsc, :acot,
:sech, :csch,
:coth, :acoth,
:atan2,
:radians2degrees, :de... | JuliaPackageMirrors/SymPy.jl | src/math.jl | Julia | mit | 8,696 |
# plots kernel density summary of data, with 90% acceptance region, mean and median.
using KernelDensity, Plots
function npdensity(z)
#pyplot()
n = size(z,2)
p = zeros(n)
for i = 1:n
x = z[:,i]
y = kde(x)
q05 = quantile(x,0.05)
Plots.plot(range(minimum(x), stop=q05, leng... | mcreel/Econometrics | src/NP/npdensity.jl | Julia | mit | 1,015 |
using Push
using Test
# Load the base configuration used by all tests.
cfg_path = joinpath(dirname(@__FILE__), "configuration/boolean.cfg")
cfg = Push.load_configuration(cfg_path)
# EQUALS.
s = Push.run("(FALSE FALSE BOOLEAN.=)", cfg)
@test s.boolean == [true]
s = Push.run("(FALSE TRUE BOOLEAN.=)", cfg)
@test s.boole... | ChrisTimperley/Push.jl | test/test_boolean.jl | Julia | mit | 2,707 |
function compute_dimensions(partition, blocks)
dimensions = Vector{Int}()
dims = 0
next_idx = 1
for block_idx in blocks
while next_idx < block_idx
# sum up dimensions of skipped blocks
dims += length(partition[next_idx])
next_idx += 1
end
appen... | JuliaReach/Reachability.jl | src/ReachSets/ContinuousPost/BFFPSV18/compute_dimensions.jl | Julia | mit | 412 |
##
# Utility methods
#########################################################
## save an object to a file with the given path
function as_serialized(obj, path::String)
iob = IOBuffer()
serialize(iob, obj)
open(path, "w") do io
write(io, takebuf_array(iob))
end
path
end
## load an object b... | JeffBezanson/julia_examples | common_crawl_indexer/ccutils.jl | Julia | mit | 1,059 |
module Mickey
export mickey_stream, mickey_init
rtaps = [97,96,95,94,92,91,90,89,88,87,82,81,80,79,72,71,67,66,65,64,63,61,60,58,56,54,52,50,46,45,42,41,38,37,28,25,22,21,20,19,16,13,12,9,6,5,4,3,1,0]
rtaps += 1
comp0 = BitArray([0,0,0,1,1,0,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,0,0,0,0,0,0,1,0,... | Khrodor/Cryptic.jl | src/Mickey.jl | Julia | mit | 2,972 |
# ps3000setadvtriggerchannelconditions
export ps3000setadvtriggerchannelconditions, PS3000TriggerState, TriggerConditions
baremodule PS3000TriggerState
const CONDITION_DONT_CARE = 0x0000
const CONDITION_TRUE = 0x0001
const CONDITION_FALSE = 0x0002
end
immutable TriggerConditions
a :: Int16
b :: Int16
... | cstook/PicoScope.jl | src/ps3000SetAdvTriggerChannelConditions.jl | Julia | mit | 1,254 |
# TableHDU & ASCIITableHDU methods
# Table type conversions:
#
# fits_tform_letter(::DataType) -> Char
# Given Julia array eltype, what FITS table letter code should be used
# when defining a table column? For example, to store an array of UInt32,
# use the TFORM letter 'V'.
# CFITSIO_COLTYPE[::Int] -> Dat... | JuliaPackageMirrors/FITSIO.jl | src/table.jl | Julia | mit | 16,305 |
function filter_desc{T}(a::CuArray{T}, format=CUDNN_TENSOR_NCHW)
csize = Cint[size(a,i) for i=ndims(a):-1:1]
p = Ptr{Void}[0]
cudnnCreateFilterDescriptor(p)
cudnnSetFilterNdDescriptor(p[1], datatype(T), format, ndims(a), csize)
p[1]
end
| hshindo/CUDA.jl | src/cudnn/filter.jl | Julia | mit | 257 |
## This downloads and populates the spec test files
using Mustache
using YAML
using Test
ghub = "https://raw.githubusercontent.com/mustache/spec/72233f3ffda9e33915fd3022d0a9ebbcce265acd/specs/{{:spec}}.yml"
specs = ["comments",
"delimiters",
"interpolation",
"inverted",
"parti... | jverzani/Mustache.jl | test/mustache_specs.jl | Julia | mit | 3,112 |
export CyclotomicExt, cyclotomic_extension
################################################################################
#
# Type definition
#
################################################################################
mutable struct CyclotomicExt
k::AnticNumberField
n::Int
Kr::Hecke.NfRel{nf_elem}
Ka... | thofma/Hecke.jl | src/RCF/cyclo.jl | Julia | bsd-2-clause | 14,319 |
using Sampling
using Base.Test
function test_binomsampler(s, params::(Int, Float64), ns::Int, tol::Float64)
# s: the sampler to be tested
# params: the binomial parameters, in the form of (n, p)
# n: the number of samples to be generated
# tol: the tolerance of deviation
n, p = params
if p == ... | lindahua/Sampling.jl | test/binomial.jl | Julia | mit | 1,551 |
using Combinatorics
using Base.Test
import Combinatorics: partitions, prevprod
@test collect(partitions(4)) == Any[[4], [3,1], [2,2], [2,1,1], [1,1,1,1]]
@test collect(partitions(8,3)) == Any[[6,1,1], [5,2,1], [4,3,1], [4,2,2], [3,3,2]]
@test collect(partitions(8, 1)) == Any[[8]]
@test collect(partitions(8, 9)) == []... | randy3k/Combinatorics.jl | test/partitions.jl | Julia | mit | 1,931 |
@testset "Misc/MPolyFactor" begin
check_fac(esum, a) = check_fac(esum, esum, a)
function check_fac(low, hi, a)
f = factor(a)
g = f.unit
esum = 0
for i in f.fac
g *= i[1]^i[2]
esum += i[2]
end
@test g == a
@test low <= esum <= hi
end
QA, A = Polyno... | thofma/Hecke.jl | test/NumField/NfAbs/MPolyFactor.jl | Julia | bsd-2-clause | 2,111 |
@inline function policy(m::KrusellSmith,
net_return::Float64, wage::Float64,
l_in::Vector{Float64}, g::Vector{Float64}, KF::Array{Float64,2};
damp::Float64 = 0.8, tol::Float64 = 1e-5)
@assert 0 <= damp <= 1
nw::Int64 = get_s... | FRBNY-DSGE/DSGE.jl | src/models/heterogeneous/krusell_smith/steady_state.jl | Julia | bsd-3-clause | 7,994 |
using LibExpat
using Calendar
using Base.Test
include("../src/s3_types.jl")
macro testxml (oname)
quote
# println("\n\n"); tic()
xom = xp_parse(readall($(string(oname)) * ".xml"))
# print("XOM : "); println(xom)
o = $(esc(oname))(xom)
# toc()
print ($(string(oname)) *... | WestleyArgentum/AWS.jl | test/testxml.jl | Julia | mit | 989 |
#
# Helper module for Remote Terminal application. It
# contains shorthands (macroses) for more simple
# remote server configuring and requests.
#
# @author DeadbraiN
# TODO: add somehow REPL help tips for these functions
module Terminal
import RpcApi
import Config
import Client
import Helper
import Connectio... | tmptrash/jevo | src/net/Terminal.jl | Julia | mit | 5,073 |
# Top level test script for Stan.jl
using ClassicalLaminateTheory
using Base.Test
println("Running tests for ClassicalLaminateTheory-j0.3/4-v1.0.0:")
tests = [
"test_clt1.jl",
"test_clt2.jl",
"test_clt3.jl",
"test_clt4.jl"
]
println("Running tests:")
for my_test in tests
println("\n * $(my_test) *")
... | goedman/ClassicalLaminateTheory.jl | test/runtests.jl | Julia | mit | 353 |
# Most existing packages use kron(...) to compute the khatri-rao product. However,
# this appears roughly 2x slower than using for loops in Julia as demonstrated in this
# simple script.
####################################################################################
using BenchmarkTools
using TensorBase
function... | JuliaTensors/TensorBase.jl | perf/A_kr_B.jl | Julia | mit | 1,596 |
using DataFrames
module TextAnalysis
using Languages
using DataFrames
using BinDeps
using Compat
importall Base
import DataFrames.DataFrame
export AbstractDocument, Document
export FileDocument, StringDocument, TokenDocument, NGramDocument
export GenericDocument
export Corpus,... | slundberg/TextAnalysis.jl | src/TextAnalysis.jl | Julia | mit | 2,512 |
using Images
using DataFrames
using FileIO
## THERE ARE 250 different sketches, with 80 sketches each
dataSetFolder = "/raided/datasets/sketches_png/png/"
df = DataFrame(Any, 0, 1234322)
listOfImgs = open(dataSetFolder * "filelist.txt")
imgPaths = readlines(listOfImgs)
close(listOfImgs)
writetable("/ra... | Maast3r/DrawSomethingAI | cleanImages.jl | Julia | mit | 1,499 |
using ApproxFun
function lanczos(w,N)
x = Fun(identity,domain(w))
f1=Fun(1./sqrt(sum(w)),domain(x))
P = Array(typeof(f1),N + 1)
β = Array(eltype(w),N)
γ = Array(eltype(w),N)
P[1] = f1
v = x.*P[1]
β[1] = sum(w.*v.*P[1])
v = v - β[1]*P[1]
γ[1] = sqrt(sum(w.*v... | acarta/spatiotemp | ApproxFun/examples/Lanczos.jl | Julia | mit | 1,052 |
isreal(::Type{<:Real}) = true
isreal(::Type{<:Complex}) = false
isreal(::Type{T}) where {T} = isreal(eltype(T))
const StaticTypes = Union{Number,<:StaticVector{N} where N,<:NTuple{N,Any} where N}
"What is the euclidean dimension of the given type (if applicable)?"
euclideandimension(::Type{T}) where {T <: Number} =... | daanhb/Domains.jl | src/util/common.jl | Julia | mit | 6,201 |
#!/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/weibull/logcdf/test/fixtures/julia/runner.jl | Julia | apache-2.0 | 2,200 |
using AMQPClient
const VIRTUALHOST = "/"
const HOST = "127.0.0.1"
function receive()
# 1. Create a connection to the localhost or 127.0.0.1 of virtualhost '/'
connection(; virtualhost=VIRTUALHOST, host=HOST) do conn
# 2. Create a channel to send messages
channel(conn, AMQPClient.UNUSED_CHANNEL... | rabbitmq/rabbitmq-tutorials | julia/receive_logs.jl | Julia | apache-2.0 | 1,276 |
export extend, NfToNfMor, automorphisms, automorphism_group
struct NfMorSet{T}
field::T
end
function show(io::IO, S::NfMorSet{T}) where {T}
print(io, "Set of automorphisms of ", S.field)
end
parent(f::NfToNfMor) = NfMorSet(domain(f))
function parent(f::NumFieldMor)
@assert domain(f) == codomain(f)
return Nf... | thofma/Hecke.jl | src/Map/NumberField.jl | Julia | bsd-2-clause | 15,668 |
export codemirror
@api codemirror => CodeMirror <: Widget begin
arg(code::String="")
kwarg(name::Symbol=:_code)
kwarg(readonly::Bool=false)
kwarg(language::String="julia")
kwarg(theme::String="elegant")
kwarg(linenumbers::Bool=true)
kwarg(tabsize::Int=4)
end
broadcast(c::CodeMirror) =
... | jiahao/Escher.jl | src/library/codemirror.jl | Julia | mit | 599 |
# This file is auto-generated by AWSMetadata.jl
using AWS
using AWS.AWSServices: drs
using AWS.Compat
using AWS.UUIDs
"""
create_replication_configuration_template(associate_default_security_group, bandwidth_throttling, create_public_ip, data_plane_routing, default_large_staging_disk_type, ebs_encryption, pit_poli... | JuliaParallel/AWS.jl | src/services/drs.jl | Julia | mit | 44,579 |
# InvFourierLayerState
immutable InvFourierLayerState <: AbstractScatteredLayerState
blobs::Vector{Mocha.Blob}
layer::InvFourierLayer
end
function InvFourierLayerState(
backend::Mocha.CPUBackend,
layer::InvFourierLayer,
inputs::Vector{Mocha.Blob},
diffs::Vector{Mocha.Blob})
... | lostanlen/WaveletScattering.jl | src/invfourierlayerstate.jl | Julia | mit | 1,161 |
#=
tic()
fh = open("gene_all")
gene_list = Set{ASCIIString}()
for line in readlines(fh)
push!(gene_list, line[1:end-1])
end
toc()
=#
info("gene list done")
fh2 = open("variant_summary.txt")
readlines(fh2)
#=
for line in readlines(fh2)
#if startswith(line, "#")
# continue
#else
gene_symbol = split... | zhmz90/Daily | learn/julia/read.jl | Julia | mit | 464 |
using FactCheck
include(Pkg.dir("BioFeatures", "src","Features.jl"))
# makedata
df1 = DataFrame( region_id = ["R1","R1","R2"], start = [1,100,1], stop = [50,300,600] )
df2 = DataFrame( region_id = ["R2","R2","R3"], start = [700,1000,60], stop = [800,1200,500] )
df3 = DataFrame( region_id = ["R4","R4","R5"])
df4 = Da... | nw11/BioFeatures.jl | test/features-test.jl | Julia | mit | 1,134 |
using Colors
using Images
using Boltzmann
using MNIST
using ImageView
using Base.Test
function run_mnist()
X, y = testdata() # test data is smaller, no need to downsample
normalize_samples!(X)
binarize!(X;threhold=0.01)
TrainSet = X[:,1:10000]
ValidSet = []
HiddenUnits = 256;
Epochs = 15;... | sphinxteam/Boltzmann.jl | test/testweightdecay.jl | Julia | mit | 1,321 |
@testset "Multigrid.DomainDecomposition" begin
@testset "testDDPoisson.jl" begin
include("testDDPoisson.jl")
end
@testset "testDDParallel_Poisson.jl" begin
include("testDDParallel_Poisson.jl")
end
end | JuliaInv/Multigrid.jl | test/DomainDecomposition/runtests.jl | Julia | mit | 222 |
using Distributions
using JSON
lambda = 1.1
d = Exponential( 1/lambda )
x = linspace( -1, 1, 25 )
dmgf(t) = mgf(d, t )
y = map( dmgf, x )
println( y )
data = Dict([
("lambda", lambda),
("data", x),
("expected", y)
])
outfile = open("./test/fixtures/matrix.json", "w")
JSON.json(data)
write( outfile, JSON.json(d... | distributions-io/exponential-mgf | test/fixtures/test.matrix.jl | Julia | mit | 327 |
using BinDeps
@BinDeps.setup
version = v"0.21.3"
libgit2 = library_dependency("libgit2",
validate = (name, handle) -> begin
major, minor, patch = Cint[0], Cint[0], Cint[0]
ccall(dlsym(handle, :git_libgit2_version), Void,
(Ptr{Cint}, Ptr{Cint}, Ptr{Cint}), major, minor, patch)
... | jakebolewski/LibGit2.jl | deps/build.jl | Julia | mit | 1,649 |
#################### PDMatDistribution ####################
typealias PDMatDistribution Union{InverseWishart, Wishart}
function unlist(d::PDMatDistribution, X::AbstractArray)
n = dim(d)
y = similar(X, Int(n * (n + 1) / 2))
k = 0
for i in 1:n, j in i:n
k += 1
y[k] = X[i, j]
end
y
end
function reli... | JuliaPackageMirrors/Mamba.jl | src/distributions/pdmatdistribution.jl | Julia | mit | 1,179 |
# *****************************************************************************
# Written by Ritchie Lee, ritchie.lee@sv.cmu.edu
# *****************************************************************************
# Copyright ã 2015, United States Government, as represented by the
# Administrator of the National Aeronautics... | rcnlee/GrammarExpts.jl | modules/CASJson2DataFrame/src/time_series_features1.jl | Julia | apache-2.0 | 9,733 |
using Gadfly
set_default_plot_size(12inch, 3inch)
hstack(
plot(x=[2,3,4],y=[2,3,4],Geom.point,intercept=[0],slope=[1],Geom.abline),
plot(x=[2,3,4],y=[2,3,4],Geom.point,intercept=[0],Geom.abline),
plot(x=[2,3,4],y=[2,3,4],Geom.point,slope=[1],Geom.abline),
plot(x=[2,3,4],y=[2,3,4],Geom.point,intercept=... | dcjones/Gadfly.jl | test/testscripts/hvabline.jl | Julia | mit | 407 |
# BAM Record
# ==========
type BAMRecord
# fixed-length fields (see BMA specs for the details)
block_size::Int32
refid::Int32
pos::Int32
bin_mq_nl::UInt32
flag_nc::UInt32
l_seq::Int32
next_refid::Int32
next_pos::Int32
tlen::Int32
# variable length data
data::Vector{UInt... | richardreeve/Bio.jl | src/align/hts/bam/record.jl | Julia | mit | 7,912 |
versioninfo()
# If needed:
#Pkg.add("DifferentialEquations")
#Pkg.add("PyPlot")
#Pkg.add("Plots")
using Plots
gr()
using DifferentialEquations
b = 0.25
c = 5.0
y0 = [pi - 0.1; 0.0]
function pend(t, y, dy)
dy[1] = y[2]
dy[2] = (-b * y[2]) - (c * sin(y[1]))
end
function f_pend(y, t)
return [y[2], (-b *... | Naereen/notebooks | Runge-Kutta_methods_for_ODE_integration_in_Julia.jl | Julia | mit | 5,947 |
const c=299792458.
const mu0=4*pi*1e-7
const mur=1
const eps0=1./(mu0*c^2)
const epsr=1
using PyPlot
function urc(Q,f,f0)
w=f/f0
I=1/sqrt(1+Q^2*(w-1/w)^2)
return I
end
const a=2.9#3.11
const b=3.7#3.62
const d=8.7#4.84
const df=2e6
const nf=1
const f=[274e6]#[224e6]#[208e6]#[382e6]#linspace(f0,f1,nf)#ar... | manuamador/IEEE-EMC2015 | Code/fig4.jl | Julia | mit | 7,720 |
@testset "Run Function Tests" begin
@test isdefined(Julz, :run) == true
run_examples = Dict(
"main" => "done.\n",
"example_task" => "404\n"
)
output_file_name = "output.jl"
for (cur_task, cur_output) in run_examples
if isfile(output_file_name) ; rm(output_file_name) ; end
originalSTDOUT ... | djsegal/julz | test/functions/commands/run_test.jl | Julia | mit | 945 |
type Lattice{T <: Real, I <: Int} <: AbstractLattice
celerities::Matrix{I}
weights::Vector{T}
inversion::Vector{I}
# Creates inversion list automatically
function Lattice(celerities::Matrix{I}, weights::Vector{T})
@assert(size(celerities, 2) == length(weights))
inversion = Int64[-1 ... | UCL/LatBo.jl | src/lb/lattice.jl | Julia | mit | 2,043 |
import ThirdWay: ActivationPoint, Event
import Base.Collections.heappop!
facts("ActivationPoint") do
context("jitter is randomized") do
jitters = Set([ActivationPoint(0.0, 1).jitter for _ in 1:10])
@fact length(jitters) > 1 --> true
end
context("(+) increments the time") do
ap = ... | jbn/ThirdWay.jl | test/test_schedule.jl | Julia | mit | 10,717 |
module MPS
using LinearAlgebra
using TensorOperations
using LinearMaps
using KrylovKit
export MPSTensor, bond_dim, bond_dim_L, bond_dim_R, phys_dim, mps_tensor, mps_tensor_shape,
rand_MPSTensor_unitary, rand_MPSTensor,
MPS_TM, TM_dense, eyeTM, TM_dense_op_nn,
applyTM_op_nn_l, applyTM_l, applyT... | FuTen/puMPS.jl | src/MPS.jl | Julia | mit | 25,296 |
using Distributions
using PyPlot
using HDF5,JLD
function p_f_th(limite,sigma,n)
pf=(exp(-limite^2/2/sigma^2)).^n
return pf
end
#champ
E=load("Emb30.jld","E")
moy_f=vec(mean(mean(E,1),3))
nf=100
freq=linspace(20e6,2e9,nf)
#tirage des fonctions
a=vcat(int(linspace(1,26,26)),int(linspace(1,26,... | manuamador/Box | FS_MC2.jl | Julia | mit | 1,402 |
{"type": "News/IPF Relevance", "date": "2018-04-03T23:01:20.898Z", "ifp": "Will Kim Jong-un meet the head of government from any G7 nation in-person", "news_story": "cc12da9148d8b1a381de4f15cd439e1ec5729d9bc21dbd2e8560593f4e9439a1", "similarity": 0.8997437885512235, "matched_sentence": "This combo of file photos shows ... | usc-isi-i2/etk | examples/ranking_pipeline/Will Kim Jong-un meet the head of government from any G7 nation in-personres-1.jl | Julia | mit | 3,155 |
module FTUtils
export ftdiff, ftaxis, ft, ift, psd, ssb
function ftdiff(N::Int, dx::Real)
return 1/(N*dx)
end
function ftaxis(N::Int, dx::Real, ssb::Bool=false)
f = (collect(0:N-1)-fld(N,2)) * ftdiff(N,dx)
if ssb
f = f[Int(fld(N,2))+1:end]
end
return f
end
function ft(y::Vector{T}, dt::... | ngedwin98/DataAnalysis.jl | src/FTUtils.jl | Julia | mit | 768 |
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
using Logging
if haskey(ENV, "JULIAFEM_LOGLEVEL")
ENV["JULIAFEM_LOGLEVEL"] == "DEBUG" && Logging.configure(level=DEBUG)
end
"""
This is JuliaFEM -- Finite Element Package
"""
module JuliaFEM
i... | JuliaPackageMirrors/JuliaFEM.jl | src/JuliaFEM.jl | Julia | mit | 4,752 |
#=== device apis ===#
@ocl_func(clCreateSubDevices, CL_int,
(CL_device_id, CL_device_partition_property, CL_uint, Ptr{CL_device_id}, Ptr{CL_uint}))
@ocl_func(clRetainDevice, CL_int, (CL_device_id,))
@ocl_func(clReleaseDevice, CL_int, (CL_device_id,))
#=== memory object apis ===#
@ocl_func(clCreateImage... | tkelman/OpenCL.jl | src/api/opencl_1.2.0.jl | Julia | mit | 2,833 |
facts("DB") do
const mock_db = DB(
Dict{Char, Dict{AbstractString, Lemma}}(),
Dict{Char, Dict{Int, Synset}}(),
Dict{Tuple{Int,AbstractString}, AbstractString}()
)
context("path_to_data_file") do
expected = joinpath("MockDB", "dict", "data.verb")
@fact WordNet.path_to_data... | JuliaPackageMirrors/WordNet.jl | test/test_db.jl | Julia | mit | 644 |
#
# 1D bound state energies for a QM particle in an infinite well and potential V(x)
#
## Definition of the orthonormal basis states
@everywhere function φ(i) return function (x) sin(π*i*x) end end
## Coupling strength
@everywhere λ = 1.0*π^2/4.0
## Definition of the centered harmonic potential V(x)
@everywhere f... | lmelwyn/julia-demo | qmbs1d.jl | Julia | bsd-2-clause | 1,643 |
## MFCC.jl
## (c) 2013-2015 David A. van Leeuwen, (c) 2005--2012 Dan Ellis
## Recoded from / inspired by melfcc from Dan Ellis's rastamat package.
module MFCC
export powspec, audspec, postaud, lifter
export mfcc, deltas, warp, sdc, znorm, znorm!, stmvn
export feasave, feaload, feasize
export feacalc
using DSP
using... | davidavdav/MFCC.jl | src/MFCC.jl | Julia | bsd-2-clause | 473 |
export DefiniteIntegral,DefiniteLineIntegral
abstract CalculusFunctional{S,T} <: Operator{T}
@functional CalculusFunctional
##TODO: Add ConcreteOp
macro calculus_functional(Op)
ConcOp=parse("Concrete"*string(Op))
WrappOp=parse(string(Op)*"Wrapper")
return esc(quote
abstract $Op{SSS,TTT} <: Calcu... | JuliaPackageMirrors/ApproxFun.jl | src/Operators/functionals/CalculusFunctional.jl | Julia | bsd-3-clause | 3,305 |
# This example demonstrates the use of the medium-level R-ncdf-like interface
#
# First of all we create an array with top-of the atmosphere radiation data
using NetCDF
include("toa.jl")
# Define longitudes and latitudes, day and timesteps
lat=[-89:89]
lon=[0:359]
day=1
tim=[0:23]
# Create radiation array
rad = flo... | koldunovn/NetCDF.jl | examples/low.jl | Julia | mit | 2,240 |
function PrepRD()
println("RD")
end | ranjanan/JuliaTutorial.jl | src/PrepRD.jl | Julia | mit | 37 |
module TestTreasuryRates
using Base.Test
using EconDatasets
using Dates
@test convertFedDate(Date(2014, 10,23)) == "10/23/2014"
end
| JuliaFinMetriX/EconDatasets.jl | test/readTreasuryRates.jl | Julia | mit | 135 |
@constructor LIBROOT TChain () TChain1 ( )
@constructor LIBROOT TChain (name::Ptr{UInt8}, title::Ptr{UInt8}, ) TChain2 (nothing, "", )
@method LIBROOT TChain AddFile Int_t (name::Ptr{UInt8}, nentries::Long64_t, tname::Ptr{UInt8}, ) AddFile1 (nothing, kBigNumber, "", )
@method LIBROOT TChain LoadTree Long_t (entry::Lo... | JuliaPackageMirrors/ROOT.jl | gen/tchain.jl | Julia | bsd-2-clause | 438 |
# AbstractMatrix wrapper around Petsc Mat
export Mat, petscview, SubMat
"""
A Petsc matrix.
Unlike Vecs, the Petsc implementation keeps track of the local assembly
state, so the Julia type does not have to.
`verify_assembled`: if true, verify all processes are assembled, if false,
only ... | JaredCrean2/PETSc.jl | src/mat.jl | Julia | mit | 41,802 |
### A Pluto.jl notebook ###
# v0.14.7
using Markdown
using InteractiveUtils
# ╔═╡ e166839c-7451-471f-b10f-3cc8d3d751f3
begin
using PlutoUI, Plots, LinearAlgebra, Statistics, DelimitedFiles, Clustering, DataFrames
import Random, CSV
plotly()
end
# ╔═╡ d6b500f1-5d54-4cdb-8d74-56e8a9ab367e
# For binder, uncomment th... | ivanslapnicar/GIAN-Applied-NLA-Course | src/Module C - Applications/L16 Principal Component Analysis.jl | Julia | mit | 13,699 |
# This file is auto-generated by AWSMetadata.jl
using AWS
using AWS.AWSServices: detective
using AWS.Compat
using AWS.UUIDs
"""
accept_invitation(graph_arn)
accept_invitation(graph_arn, params::Dict{String,<:Any})
Accepts an invitation for the member account to contribute data to a behavior graph. This
operat... | JuliaParallel/AWS.jl | src/services/detective.jl | Julia | mit | 21,235 |
using OnlineStats, Plots, PlotThemes, Colors, Random, CSV
gr()
theme(:juno)
Random.seed!(123)
logo_colors = hcat(
RGB(135/255, 222/255, 183/255), # not in logo
RGB(64/255, 191/255, 169/255),
RGB(64/255, 169/255, 191/255),
RGB(64/255, 124/255, 191/255),
RGB(64/255, 79/255, 191/255),
)
# #---------... | joshday/OnlineStats.jl | docs/src/assets/images.jl | Julia | mit | 3,455 |
module Transforms
using ..Util, ..WaveletTypes
export fwt, iwt, dwt!, fwtc, iwtc
# includes:
# GENERAL TRANSFORM FUNCTIONS
# PO FILTER TRANSFORMS
# LIFTING TRANSFORMS
# FWT, Forward Wavelet Transform
# IWT, Inverse Wavelet Transform
# DWT, Discrete Wavelet Transform
# FWTC, Forward Wavelet Transform, Column-wise... | luboshanus/Wavelets.jl | src/transforms.jl | Julia | mit | 19,346 |
#using Laplacians
function buildAPI(fileName, mod)
noDocString = "No documentation found."
v = names(mod)
fh = open(fileName,"w")
x = 0
for i in 1:length(v)
sym = v[i]
x = eval(mod,sym)
println(string(x))
println(fh, "### ", string(sym))
#= if (isa(x,Fun... | JuliaPackageMirrors/Laplacians.jl | docs/test.jl | Julia | mit | 1,293 |
module NeuralNet
abstract AbstractLayer
@inline function sigmoid(i::Matrix{Float64})
@inbounds @fastmath begin
expmi = similar(i)
for j in eachindex(expmi)
expmi[j] = exp(-i[j])
end
@simd for j in eachindex(expmi)
expmi[j] = 1.0/(expmi[j]+1.0)
end
... | tomaklutfu/NeuralNet.jl | src/NeuralNet.jl | Julia | mit | 7,863 |
print("Hello world. walls")
include("PRM.jl")
#using Distributions
glvisualize()
pfont = Plots.Font("sans-serif", 8, :left, :left, 0.0, RGB{U8}(0.0, 0.0, 0.0))
glvisualize(titlefont = pfont, guidefont = pfont)
####################################
# Randomly Generate Clutter (obstacles)
#########################... | nouyang/janson299r | wk11/walls_experiment.jl | Julia | mit | 17,304 |
using Distributed
addprocs(1)
using LMCLUS
@everywhere using LMCLUS
using Test
@testset "Clustering (Parallel)" begin
@test nprocs() == 2
p = LMCLUS.Parameters(5)
p.random_seed = 4572489057
testDataFile = joinpath(dirname(@__FILE__),"testData")
ds = readdlm(testDataFile, ',')
res1 = lmclus(ds... | wildart/LMCLUS.jl | test/lmclus_p_test.jl | Julia | mit | 453 |
module CelesteHTTPIO
using Celeste
using FITSIO
using TranscodingStreams
import Celeste.SDSSIO: SDSSIO, SDSSImageDesc, NetworkIoStrategy, readFITS
using HTTP
struct HTTPStrategy <: NetworkIoStrategy
host::String
remote_strategy::SDSSIO.IOStrategy
end
function readFITS(s... | jeff-regier/Celeste.jl | contrib/http/httpio.jl | Julia | mit | 783 |
###############################################################################
##
## Asses convergence
##
##############################################################################
function assess_convergence(δx,
x,
maxabs_gr,
ssr... | JuliaPackageMirrors/LeastSquaresOptim.jl | src/utils/utils.jl | Julia | mit | 4,347 |
using BlockArrays, FillArrays, OffsetArrays, Test, Base64, StaticArrays, ArrayLayouts
import BlockArrays: BlockIndex, BlockIndexRange, BlockSlice
@testset "Blocks" begin
@test Int(Block(2)) === Integer(Block(2)) === Number(Block(2)) === 2
@test Block((Block(3), Block(4))) === Block(3,4)
@testset "Block it... | KristofferC/BlockArrays.jl | test/test_blockindices.jl | Julia | mit | 14,122 |
import Base.Test.@test
using NetCDF
#First delete any existing nc-files
for fn in ("nc1.nc","nc2.nc","nc3.nc")
if (isfile(fn))
rm(fn)
end
end
# Test Medium level Interface
# Test Dimension Creation
d1 = NcDim("Dim1",2;values=[5.0,10.0],atts={"units"=>"deg C"});
d2 = NcDim("Dim2",[1:10]);
d3 = NcDim("Dim3",20;a... | koldunovn/NetCDF.jl | test/runtests.jl | Julia | mit | 4,280 |
mutable struct DummyStream <: Base.LibuvStream
buffer::Base.GenericIOBuffer
status::Int
handle::Any
end
let kws = [], msgs =[]
ds = DummyStream(IOBuffer(), 0, 0)
for s = 0:9, h in [Base.C_NULL, Ptr{UInt64}(3)]
ds.handle = h
ds.status = s
kwarg, msg = WebSockets._uv_status_tu... | JuliaWeb/WebSockets.jl | test/show_test.jl | Julia | mit | 7,211 |
@testset "Fitness" begin
@testset "hat_compare() Float64" begin
@test hat_compare(1.0, 2.0) == -1
@test hat_compare(-1.0, 1.0) == -1
@test hat_compare(2.0, 1.0) == 1
@test hat_compare(-2.0, -3.0) == 1
@test hat_compare(1.0, 1.0) == 0
@test hat_compare(0.0, 0.0) == 0... | JuliaPackageMirrors/BlackBoxOptim.jl | test/test_fitness.jl | Julia | mit | 14,830 |
using SimJulia
function and_callback(ev::AbstractEvent)
println("Both events are triggered: $(value(ev))")
end
function or_callback(ev::AbstractEvent)
println("One of both events is triggered: $(value(ev))")
end
function or_callback_succeed(ev::AbstractEvent, ev2::AbstractEvent)
println("One of both events is ... | BenLauwens/SimJulia.jl | test/operators.jl | Julia | mit | 1,744 |
# Create a parabolic velocity inlet
abstract VelocityIOlet <: IOLetStreaming
type ParabolicVelocityIOlet{T} <: VelocityIOlet
# Direction of the inlet
normal :: Vector{T}
# Center of the inlet
center :: Vector{T}
# Radius of the inlet
radius :: T
# Maximum speed
maxspeed :: T
functio... | UCL/LatBo.jl | src/lb/iolet.jl | Julia | mit | 4,411 |
# Tests for the linear discriminant classifier
function t_lindisc()
Ac = j4pr.DataGenerator.fish(20) # classification dataset
tol = 1e-6; # tolerance when comparing results
Wclass = j4pr.lindisc(rand(),rand())
# Test classification
Test.@test try
wt1 = Ac |> Wclass
wt2 = j4pr.strip(Ac) |> Wclass
result = ... | zgornel/j4pr.jl | test/t_lindisc.jl | Julia | mit | 846 |
using ImageMagick, Images, ColorTypes, FixedPointNumbers, FileIO
using FactCheck
using Compat
ontravis = haskey(ENV, "TRAVIS")
facts("IO") do
workdir = joinpath(tempdir(), "Images")
isdir(workdir) && rm(workdir, recursive=true)
mkdir(workdir)
context("Binary png") do
a = rand(Bool,5,5)
... | JuliaPackageMirrors/ImageMagick.jl | test/constructed_images.jl | Julia | mit | 7,111 |
# *****************************************************************************
# Written by Ritchie Lee, ritchie.lee@sv.cmu.edu
# *****************************************************************************
# Copyright ã 2015, United States Government, as represented by the
# Administrator of the National Aeronautics... | rcnlee/GrammarExpts.jl | modules/DecisionTreeVis/src/DecisionTreeVis.jl | Julia | apache-2.0 | 5,153 |
@testset "non_convex" begin
@testset "non_convex_small_sigma" begin
# Setup problem
P = sparse([2. 5.; 5. 1.])
q = [3.; 4]
A = sparse([-1 0; 0 -1; -1 -3; 2 5; 3 4])
u = [0.; 0.; -15; 100; 80]
l = -Inf * ones(length(u))
options = Dict(:verbose => false, :sig... | bstellato/OSQP.jl | test/non_convex.jl | Julia | apache-2.0 | 1,236 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.