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 |
|---|---|---|---|---|---|
using Base
using MatlabCompat
using MatlabCompat.Io
using MatlabCompat.ImageTools
import MatlabCompat.MathTools
import MatlabCompat.MathTools: max
using Base.Test
using Images
using FixedPointNumbers
using Tk
const TEST_FOLDER = dirname(@__FILE__)
const JANUS_PATH = joinpath(TEST_FOLDER, "janus.m");
const TESTMAT_PATH... | MatlabCompat/MatlabCompat.jl | test/runtests.jl | Julia | mit | 2,735 |
"""
This module implements a value iteration solver that uses the interface defined in POMDPs.jl
"""
module DiscreteValueIteration
using Printf
using POMDPs
using POMDPModelTools
using POMDPPolicies
using SparseArrays
import POMDPLinter: @POMDP_require, @req, @subreq, @warn_requirements
import POMDPs: Solver, solve, ... | sisl/DiscreteValueIteration.jl | src/DiscreteValueIteration.jl | Julia | mit | 559 |
export @default_nlscounters
"""
@default_nlscounters Model inner
Define functions relating NLS counters of `Model` to NLS counters of `Model.inner`.
"""
macro default_nlscounters(Model, inner)
ex = Expr(:block)
for foo in fieldnames(NLSCounters) ∪ [:sum_counters, :reset!]
foo == :counters && continue
... | dpo/NLPModels.jl | src/nls/utils.jl | Julia | mit | 612 |
@defstruct MemoryDataLayer Layer (
name :: AbstractString = "memory-data",
(tops :: Vector{Symbol} = Symbol[:data,:label], length(tops) > 0),
(batch_size :: Int = 0, batch_size > 0),
(data :: Vector{Array} = Array[], length(data) == length(tops)),
shuffle :: Bool = false,
transformers :: Vector = [],
)
@cha... | chezou/Mocha.jl | src/layers/memory-data.jl | Julia | mit | 3,117 |
#=
LCM Server: an LCM interface to Caesar.jl
=#
using Caesar
using LCMCore, CaesarLCMTypes
using TransformUtils, Rotations, CoordinateTransformations, Distributions
using LibBSON, Unmarshal
using RobotTestDatasets
# Does: using SynchronySDK
include(joinpath(dirname(@__FILE__), "synchronySDKIntegration.jl"))
"""
S... | dehann/Caesar.jl | examples/tobedeleted/highend/synchrony.jl | Julia | mit | 9,075 |
module TestData
using Base.Test
using DataArrays
#test_context("Data types and NA's")
#test_group("NA's")
@assert length(NA) == 1
@assert size(NA) == ()
@assert isna(3 == NA)
@assert isna(NA == 3)
@assert isna(NA == NA)
#test_group("DataVector creation")
dvint = @data [1, ... | alyst/DataArrays.jl | test/data.jl | Julia | mit | 8,035 |
import DataStructures
include("topological_sort.jl")
# workaround for slow tuples
immutable MyPair{T}
first::T
second::T
end
# workaround for julia issue #10208
Base.hash(x::MyPair{Int},h::UInt) = hash(x.first,hash(x.second,h))
# compact storage for an undirected graph
# neighbors of vertex i start at adjli... | yuyichao/ReverseDiffSparse.jl | src/coloring.jl | Julia | mit | 13,229 |
using Plots
#using Blink
plotlyjs();
#Blink.AtomShell.install()
include("./AdwinNaive.jl")
r, y = demo_adwin_naive();
chps = extractChps(r)
println(chps)
n = length(y)
max_y = maximum(y)
min_y = minimum(y)
max_r = maximum(r)
chps_to_plot = []
anim = @animate for i=1:n
p1 = plot(y[1:i], xlim = (1,n), ylim = (min_... | av-maslov/Pccf | src/detectors/Adwin3/makeGifAdwinOnline.jl | Julia | mit | 860 |
macro mustimplement(sig)
fname = sig.args[1]
arg1 = sig.args[2]
if isa(arg1,Expr)
arg1 = arg1.args[1]
end
:($(esc(sig)) = error(typeof($(esc(arg1))),
" must implement ", $(Expr(:quote,fname))))
end
export @mustimplement
macro returntype(expr)
esc(:(eltype([$expr ... | aleadev/Alea.jl | src/internal/base.jl | Julia | mit | 815 |
using ExtremeValueDistributions
using Base.Test
tests = ["generalizedextreme.jl", "generalizedpareto.jl"]
print_with_color(:blue, "Running tests:\n")
srand(345678)
for t in tests
test_fn = "$t.jl"
print_with_color(:green, "* $test_fn\n")
include(test_fn)
end
| sammorris81/ExtremeValueDistributions.jl | test/runtests.jl | Julia | mit | 275 |
function initializeBAMReader( filename::String )
stream = GZip.open(filename)
seek(stream, 0)
if !checkBAMMagicString( stream )
error("BAM magic string was not found!")
end
headerText = readBAMHeaderText( stream )
references = readBAMHeaderReferences( stream )
return( BAMReader( file... | PaulTheodorPyl/Genomic.jl | src/BAMReader.jl | Julia | mit | 5,654 |
#! /usr/bin/julia
# Rosetta Code, Bitmap/Read a PPM file
using Color, Images, FixedPointNumbers
const M_RGB_Y = reshape(Color.M_RGB_XYZ[2,:], 3)
function rgb2gray(img::Image)
g = red(img)*M_RGB_Y[1] + green(img)*M_RGB_Y[2] + blue(img)*M_RGB_Y[3]
g = clamp(g, 0.0, 1.0)
return grayim(g)
end
ima = imrea... | MichaeLeroy/rosetta-code | julia/completed/bitmap_read_ppm.jl | Julia | mit | 430 |
module MyModule
using Lib
include("another.jl")
include("subdir/yetanother.jl")
using BigLib: thing1, thing2
import Base.show
importall OtherLib
export MyType, foo
type MyType
x
end
foobuzz = 5
tt=1
export foobuzz, if
macro sayhello()
return :( println("Hello, world!") )
end
export dead,
theparot
func... | oxinabox/julia-vim-completions | samples/other.jl | Julia | cc0-1.0 | 485 |
###########
# Ket/Bra #
###########
typealias StateDict{N,T} Dict{StateLabel{N},T}
type Ket{P,N,T} <: DiracState{P,N}
ptype::P
dict::StateDict{N,T}
Ket(ptype, dict) = new(ptype, dict)
Ket(ptype, dict::StateDict{0}) = error("Cannot construct a 0-factor state.")
end
Ket{P,N,T}(ptype::P, dict::StateDict{... | JuliaQuantum/QuDirac.jl | src/state.jl | Julia | mit | 9,008 |
using IterativeSolvers
using FactCheck
facts("idfact") do
srand(1)
M = randn(4,5)
k = 3
F = idfact(M, k, 3)
@fact vecnorm(F.B*F.P-M) --> less_than_or_equal(2svdvals(M)[k+1])
end
| mschauer/IterativeSolvers.jl | test/factorization.jl | Julia | mit | 200 |
using Gadfly
plot(x=rand(20), y=rand(20), color=vcat(fill("A", 10), fill("B", 10)),
Guide.colorkey("Species"))
| Roger-luo/Gadfly.jl | test/explicit_colorkey_title.jl | Julia | mit | 119 |
using Gadfly
@doc """
PLOTDATA(x,y) plots the data points and gives the figure axes labels of
population and profit.
""" ->
function plotData(x, y)
# ====================== YOUR CODE HERE ======================
l1 = layer(x=x, y=y, Geom.point)
# ============================================================... | homuler/coursera-ml-julia | src/ex1/plotData.jl | Julia | mit | 337 |
export LPHRep
MOI.Utilities.@model(_MOIModel,
(), (MOI.EqualTo, MOI.LessThan,), (), (),
(), (MOI.ScalarAffineFunction,), (), ())
# We need the `SingleVariable` constraints to be bridged so we should say that
# they are not supported. We notably exclude `Integer` as we just ign... | blegat/Polyhedra.jl | src/lphrep.jl | Julia | mit | 8,339 |
#!/bin/env julia
const filename = "julia-vim-L2U-table"
# Keeping this from an old revision, just in case:
# Combining chars ranges, as obtained from https://en.wikipedia.org/wiki/Combining_character:
# ('\u0300' ≤ u ≤ '\u036F') ||
# ('\u1AB0' ≤ u ≤ '\u1AFF') ||
# ('\u1DC0' ≤ u ≤ '\u1DFF') ||
# ('\u20D0' ≤ u ≤ '\u20F... | myokoym/dotfiles | .vim/bundle/.neobundle/doc/generate_latex_symbols_table.jl | Julia | mit | 3,955 |
type Variable
id::Int
lb::Float64
ub::Float64
vtype::Char
function Variable(id::Int, lb::Float64, ub::Float64, vtype::Char)
ret = new(id, lb, ub, vtype)
check_feasiblility(ret)
ret
end
end
"""
- Check immediately after each assignment of `lb` or `ub` (if necessary).
- a... | colinfang/GurobiPresolver.jl | src/variable.jl | Julia | mit | 3,396 |
# This is a Cooley-Tukey FFT algorithm for any number type.
function fft_pow2{F}(x::Vector{F})
n = length(x)
T = mapreduce(eltype,promote_type,x)
@assert ispow2(n)
if n==1
return x
elseif n==2
return F[x[1]+x[2];x[1]-x[2]]
end
even,odd = fft_pow2(x[1:2:end-1]),fft_p... | acarta/spatiotemp | ApproxFun/src/Extras/fftBigFloat.jl | Julia | mit | 2,139 |
#=
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 follo... | JuliaPackageMirrors/ParallelAccelerator.jl | examples/black-scholes/black-scholes.jl | Julia | bsd-2-clause | 3,404 |
using JLD, JLD2, Test, Distributions, Random, StateSpaceRoutines, BenchmarkTools, ParallelDataTransfer, DistributedArrays, OffsetArrays, DistributedArrays.SPMD
addproc_num = 0 ## Set to 0 to not add workers
nparts_mill = false
nparts_mult = nparts_mill ? 10 : 1
run_timing = false
only_tpf = true
n_states1 = fals... | FRBNY-DSGE/StateSpaceRoutines.jl | test/parallel_tempered_particle_filter.jl | Julia | bsd-3-clause | 14,223 |
function chebyshev_nodes(n::S,domain = [1.0,-1.0]) where {S <: Integer}
if n <= 0
error("The number of nodes must be positive.")
end
nodes = zeros(n)
if isodd(n)
nodes[Int((n-1)/2)+1] = (domain[1]+domain[2])/2.0
end
for i = 1:div(n,2)
x = -cos((i-0.5)*pi/n)*(domain[1]-domain[2])/2.0
node... | RJDennis/ChebyshevApprox | src/chebyshev_nodes.jl | Julia | mit | 441 |
using Benchmark
function printresults(descriptions, df)
replications = df["Replications"][1]
results = zip(df["Elapsed"], df["Relative"], descriptions)
@printf("%8s%12s %s\n", "Elapsed", "Relative", "Description")
for (elapsed, relative, desc) in results
@printf("%8f%12f %s\n", elapsed, r... | JuliaLang/FunctionalCollections.jl | benchmark/bench.jl | Julia | mit | 621 |
using Distributions
using JSON
k = 2
lambda = 1.5
d = Erlang( k, 1/lambda )
x = linspace( .5, -100, 200 )
dmgf(t) = mgf(d, t )
y = map( dmgf, x )
println( y )
data = Dict([
("k", k),
("lambda", lambda),
("data", x),
("expected", y)
])
outfile = open("./test/fixtures/typedarray.json", "w")
JSON.json(data)
writ... | distributions-io/erlang-mgf | test/fixtures/test.typedarray.jl | Julia | mit | 350 |
require("../src/CXX.jl")
RequireCompleteType(d::pcpp"clang::Type") = ccall(:RequireCompleteType,Cint,(Ptr{Void},),d.ptr) > 0
function cxxsizeof(d::pcpp"clang::CXXRecordDecl")
executionEngine = pcpp"llvm::ExecutionEngine"(ccall(:jl_get_llvm_ee,Ptr{Void},()))
cgt = pcpp"clang::CodeGen::CodeGenTypes"(ccall(:clang_... | ihnorton/CXX.jl | test/llvmtest.jl | Julia | mit | 1,863 |
function markdown(doc::DocumentationChunk)
io = IOBuffer()
if doc.exported
@printf(io, "**Exported**\n\n")
end
if !isempty(doc.name)
@printf(io, "**Name**: %s\n\n", doc.name)
end
if !isempty(doc.description)
@printf(io, "**Description**: %s\n\n", doc.description)
end
if !isempty(doc.args)
@printf(io... | johnmyleswhite/Roxygen.jl | src/markdown.jl | Julia | mit | 1,174 |
import SymmetricDominance
using Base.Test
const sd = SymmetricDominance
const gdb = sd.GeneDB()
for _ = 1:2
sd.insert!(sd.WithNewAllele, gdb, 1, 0)
end
for i = 1:2, _ = 1:2
sd.insert!(sd.WithNewAllele, gdb, 2, i)
end
for i = 3:6, _ = 1:2
sd.insert!(sd.WithNewAllele, gdb, 3, i)
end
@test gdb.currentid == ... | skumagai/SymmetricDominance.jl | test/runtests.jl | Julia | mit | 5,461 |
#-----------------------------------------------------------------------
# MetadataTools
# https://github.com/IainNZ/MetadataTools.jl
#-----------------------------------------------------------------------
# Copyright (c) 2015: Iain Dunning
# Licensed under the MIT License
#--------------------------------------------... | IainNZ/MetadataTools.jl | src/pkg_graph.jl | Julia | mit | 5,425 |
using Latexify
using Markdown
using Test
#inline
@test latexify(:(x * y); env=:inline, cdot=false) == raw"$x y$"
@test latexify(:(x * y); env=:inline, cdot=true) == raw"$x \cdot y$"
@test latexify(:(x*(y+z)*y*(z+a)*(z+b)); env=:inline, cdot=false) ==
raw"$x \left( y + z \right) y \left( z + a \right) \left( z + b \... | korsbo/Latexify.jl | test/cdot_test.jl | Julia | mit | 2,130 |
using Media
import REPL
using Logging: with_logger
using .Progress: JunoProgressLogger
ends_with_semicolon(x) = REPL.ends_with_semicolon(split(x,'\n',keepempty = false)[end])
withpath(f, path) =
CodeTools.withpath(f, path == nothing || isuntitled(path) ? nothing : path)
const eval_channel_in = Channel(1)
const ev... | JunoLab/Atom.jl | src/eval.jl | Julia | mit | 5,462 |
module SimpleNeuralNetwork
import Base: repr, show
export NeuralLayer, NeuralNetwork, train!, predict, repr, show
function derivative(fun::Function; epsilon = 1e-3)
function (x)
(fun(x + epsilon) - fun(x - epsilon)) / (2*epsilon)
end
end
function sqr_cost(y_predict::Array, y::Array)
sqrt(sum((y_... | dboyliao/SimpleNeuralNetwork.jl | src/SimpleNeuralNetwork.jl | Julia | mit | 4,992 |
const psxy = plot
const psxy! = plot!
const psxyz = plot3d
const psxyz! = plot3d!
# ---------------------------------------------------------------------------------------------------
function common_plot_xyz(cmd0::String, arg1, caller::String, first::Bool, is3D::Bool, kwargs...)
arg2, arg3 = nothing, nothing
N_ar... | joa-quim/GMT.jl | src/psxy.jl | Julia | mit | 36,717 |
comps = UTF8String[]
for aa in [collect('A':'Z') collect('a':'z')]
append!(comps,Base.REPLCompletions.completions(string(aa),1)[1])
end
open("julia-omni.vim", "w") do fh
write(fh, "\" this file is a automatically generated list of default keywords. including functions etc defined in base\n")
write(fh, ... | oxinabox/julia-vim-completions | repl_complete_call/generate_completions.jl | Julia | cc0-1.0 | 393 |
################################################################################
#
# EllCrv/Finite.jl : Elliptic curves over finite fields
#
# This file is part of Hecke.
#
# Copyright (c) 2015, 2016: Claus Fieker, Tommy Hofmann
# All rights reserved.
#
# Redistribution and use in source and binary forms, with... | thofma/hecke | src/EllCrv/Finite.jl | Julia | bsd-2-clause | 17,785 |
using Test
using DandelionWebSockets: SendTextFrame, SendBinaryFrame
using DandelionWebSockets: ClientPingRequest, PongMissed, CloseRequest, SocketClosed
using DandelionWebSockets: FrameFromServer
using DandelionWebSockets.Proxy: ClientProtocolProxy
import DandelionWebSockets.Proxy: handle
struct ClientProtocolNotific... | dandeliondeathray/WebSocketClient.jl | test/client_protocol_proxy_test.jl | Julia | mit | 2,972 |
# This file is auto-generated by AWSMetadata.jl
using AWS
using AWS.AWSServices: cost_and_usage_report_service
using AWS.Compat
using AWS.UUIDs
"""
delete_report_definition()
delete_report_definition(params::Dict{String,<:Any})
Deletes the specified report.
# Optional Parameters
Optional parameters can be pa... | JuliaParallel/AWS.jl | src/services/cost_and_usage_report_service.jl | Julia | mit | 4,295 |
function readAnnotate!(annotationFile::String, snpID::Vector{String},
nSNP::Int, grpInfo::Vector{Int64},
offsetSize::Vector{Int64}, geneName::Vector{String})
annotatedata = readdlm(annotationFile, ',');
annotatedata = convert(Array{String, 2}, annotatedata);
annotate... | Tao-Hu/VarianceComponentTest.jl | src/readAnnotate!.jl | Julia | mit | 939 |
using Multilane
using JLD
using Multilane
using POMDPs
using MCTS
using DataFrames
using DataFramesMeta
using Plots
using StatPlots
# results = load("results_Aug_22_23_26.jld")
# results = load("combined_results_Aug_25_10_10.jld")
# results = load("combined_results_Aug_26_19_53.jld")
# results = load("combined_result... | zsunberg/Multilane.jl | scratch_old/aug_18_gap_study_plots.jl | Julia | mit | 1,340 |
using Multilane
using MCTS
using POMDPToolbox
using POMDPs
# using POMCP
using Missings
using DataFrames
using CSV
using POMCPOW
@everywhere using Missings
@everywhere using Multilane
@everywhere using POMDPToolbox
using Gallium
@show N = 1000
@show n_iters = 1000
@show max_time = Inf
@show max_depth = 40
@show val ... | zsunberg/Multilane.jl | scratch_18_03/allgaps.jl | Julia | mit | 8,259 |
# util/tokenize.jl
# ================
#
# A module defining types and methods for tokenizing strings.
#
# Useful in creating parsers.
#
# This file is a part of BioJulia. License is MIT: https://github.com/BioJulia/Bio.jl/blob/master/LICENSE.md
module Tokenize
using Compat
import Compat.String
export
Tokenizer,... | kdmurray91/Bio.jl | src/util/tokenize.jl | Julia | mit | 1,868 |
import Base: read
using GZip
using LightXML
"`Format` is used for write special `parse` (and `read`) methods on it."
abstract Format
"""Returns the `filename`.
Throws an `ErrorException` if the file doesn't exist, or a warning if the file is empty."""
function check_file(filename)
if !isfile(filename)
throw(Er... | JuliaPackageMirrors/MIToS.jl | src/Utils/Read.jl | Julia | mit | 1,942 |
Maybe(T::Type) = Union(T, Nothing)
# Float64 -> String, trimming trailing zeros when appropriate.
# This is largely taken from cairo's function _cairo_dtostr.
function fmt_float(x::Float64)
if x < 0.1
a = @sprintf("%0.18f", x)
else
a = @sprintf("%f", x)
end
n = length(a)
while a... | timholy/compose | src/util.jl | Julia | mit | 415 |
include("TriPMatrices.jl")
n = 6
D = [linspace(1,n,n);] + 5.0
Dl = [linspace(1,n,n);] + 1.0
Du = [linspace(1,n,n);] + 2.0
M = TriPMatrices.TridiagonalP(Dl, D, Du)
Mf = full(M)
S = TriPMatrices.SymTridiagonalP(D, Du)
Sf = full(S)
| pjabardo/TriPMatrices.jl | work/teste.jl | Julia | mit | 233 |
fp = dirname(@__FILE__)
@testset "Impulse responses of a VAR using a DSGE as a prior (wrapper function)" begin
jlddata = load(joinpath(fp, "../../reference/test_dsgevar_lambda_irfs.jld2"))
m = Model1002("ss10", custom_settings =
Dict{Symbol,Setting}(:add_laborshare_measurement =>
... | FRBNY-DSGE/DSGE.jl | test/forecast/wrappers_impulse_responses/dsgevar_lambda_impulse_responses.jl | Julia | bsd-3-clause | 11,884 |
"""
Returns: (n, perm) where n is the number of columns in
the beginning of `cols`, `perm` is one possible permutation of those
first `n` columns.
"""
function best_perm_estimate(perms, cols)
bestperm = nothing
bestmatch = 0
for p in perms
matched_cols = 0
l = min(length(cols), length(p.colu... | JuliaComputing/IndexedTables.jl | src/sortperm.jl | Julia | mit | 1,783 |
##############################################################################
##
## Reshaping
##
## Also, see issue # ??
##
##############################################################################
##############################################################################
##
## stack()
## melt()
##
#########... | JuliaPackageMirrors/DataFrames.jl | src/abstractdataframe/reshape.jl | Julia | mit | 14,236 |
module jradau5
function r_fcn(p_N ::Ptr{Int64},
p_X ::Ptr{Float64},
p_Y ::Ptr{Float64},
p_F ::Ptr{Float64},
p_RPAR::Ptr{Float64},
p_IPAR::Ptr{Int64},
j_out ::Ptr{Void}, # FIXME: needed?
j_fcn ::Ptr{Void})
... | StHante/jradau5.jl | jradau5.jl | Julia | mit | 6,790 |
function rsch_integ_rk4!(
E::Float64,
Z::Int64, l::Int64, rmesh, V, P, Q;
MAXVAL_STOP=1e6
)
Nr = size(rmesh,1)
# Calculate Vmid
Vmid = zeros(Float64, Nr-1)
for i in 1:Nr-1
rmid = 0.5*( rmesh[i] + rmesh[i+1] )
Vmid[i] = radial_interp(rmesh, V, rmid, i+1)
end
#@printf... | f-fathurrahman/ffr-ElectronicStructure.jl | dftatom/rsch_integ_rk4.jl | Julia | mit | 1,344 |
"""
A product map is diagonal and acts on each of the components of x separately:
`y = f(x)` becomes `y_i = f_i(x_i)`.
"""
abstract type ProductMap{T} <: CompositeLazyMap{T} end
components(m::ProductMap) = m.maps
VcatMapElement = Union{Map{<:SVector},Map{<:Number}}
ProductMap(maps::Tuple) = ProductMap(maps...)
Prod... | daanhb/Domains.jl | src/maps/product.jl | Julia | mit | 6,462 |
export NewtonPolygon, Line, Polygon
###############################################################################
#
# Types
#
###############################################################################
mutable struct Line
points :: Tuple{Tuple{Int, Int}, Tuple{Int, Int}}
slope :: fmpq
function Line(poin... | thofma/Hecke.jl | src/NumFieldOrd/NfOrd/MaxOrd/Polygons.jl | Julia | bsd-2-clause | 27,898 |
#!/usr/bin/julia
###############################################################################
#
# Kpax3 - Bayesian cluster analysis of categorical data
#
# Copyright (c) 2016-2018 Alberto Pessia <alberto.pessia@gmail.com>
#
# Kpax3 is free software: you can redistribute it and/or modify it under the
# terms of the ... | albertopessia/Kpax3.jl | tutorial/Kpax3_fasta_tutorial.jl | Julia | mit | 17,318 |
using Hiccup
import Hiccup.div
import HttpServer.mimetypes
export files
Base.joinpath() = ""
function validpath(root, path; dirs = true)
full = normpath(root, path)
@compat startswith(full, root) &&
(isfile(full) || (dirs && isdir(full)))
end
ormatch(r::RegexMatch, x) = r.match
ormatch(r::Nothing, x) = x
e... | PallHaraldsson/Mux.jl | src/examples/files.jl | Julia | mit | 1,434 |
function _accept(lp1::Float64,
lp2::Float64)
return rand() <= exp(lp1 - lp2)
end
| jangevaa/Pathogen.jl | src/inference/_accept.jl | Julia | mit | 100 |
# Ported to Julia by Andy Ferris, 2016, and re-released under an MIT license.
#/**
# * Copyright (c) Charles Karney (2008-2015) <charles@karney.com> and licensed
# * under the MIT/X11 License. For more information, see
# * http://geographiclib.sourceforge.net/
# ********************************************************... | JuliaPackageMirrors/Geodesy.jl | src/transverse_mercator.jl | Julia | mit | 26,108 |
using Gadfly
n = 10
plot(x=rand(n), y=rand(n), color=sinh(rand(n)), Scale.color_asinh)
| JuliaPackageMirrors/Gadfly.jl | test/scale_color_asinh.jl | Julia | mit | 88 |
#=!
جوليا به عنوان يک زبان تخصصي انجام محاسبات، توابع متنوعي در موضوع محاسبات آماري (statistics) را تعريف و در اختيار کاربر قرار ميدهد
علاوه بر اين توابع پايه، مجموعه کاملتري از قابليت ها در پکيجهاي جانبي جوليا تعريف شده اند، فهرست مهمترين پکيجهاي تخصصي ي آمار و احتمالات را ميتوان با مراجعه به آدرس https://github.com/J... | DANA-Laboratory/juliaRahamooz | src/no4.jl | Julia | mit | 5,374 |
using Base.Test
using Zlib
data = convert(Vector{UInt8}, rand(1:255, 1000000))
decompressed = decompress(compress(data))
@test data == decompressed
decompressed = decompress(compress(data, false, true), true)
@test data == decompressed
@test length(decompress(compress(""))) == 0
b = IOBuffer()
w = Zlib.Writer(b)
n... | ssfrr/Zlib.jl | test/runtests.jl | Julia | mit | 1,649 |
using LujiaLt.TightBinding
TB = LujiaLt.TightBinding
import LujiaLt: evaluate, grad
import LujiaLt.TaylorPotentials: TSiteForce, LinearSiteForce, RefNeigList
export TBModel, FrcHybridModel
"""
`type TBModel`
Encapsulates a TB model with clamped (Dirichlet) boundary conditions
"""
type TBModel <: QModel
# geom::... | cortner/LujiaLt | src/qmmodels.jl | Julia | mit | 3,112 |
module TikzPictures
export TikzPicture, PDF, TEX, SVG, save, tikzDeleteIntermediate, tikzCommand, TikzDocument, push!
import Base: push!
import LaTeXStrings: LaTeXString, @L_str, @L_mstr
export LaTeXString, @L_str, @L_mstr
using Compat
_tikzDeleteIntermediate = true
_tikzCommand = "lualatex"
# standalone workaround... | JuliaPackageMirrors/TikzPictures.jl | src/TikzPictures.jl | Julia | mit | 8,615 |
abstract masks_Forward_Backward
function BackwardD2( r2::Array{Float64} , M :: masks_Forward_Backward;)
error("not serving for a pure masks_Forward_Backward")
end
function LBackwardD2( r2::Array{Float64,1} , M :: masks_Forward_Backward;)
error("not serving for a pure masks_Forward_Backward")
end
function LBackwa... | zhujinxuan/Met_Basic_Types.jl | src/Dimen_Forward_and_Backward/All_Forwardors.jl | Julia | mit | 2,343 |
##############################################################################
#
# All Document types share a common metadata profile using DocumentMetadata
#
##############################################################################
type DocumentMetadata
language::DataType
name::UTF8String
author::UTF... | slundberg/TextAnalysis.jl | src/document.jl | Julia | mit | 7,754 |
#InspectDR: Heatmap tools
#-------------------------------------------------------------------------------
#==Constants
===============================================================================#
#==Main types
===============================================================================#
struct ColorScale
e:... | ma-laforge/InspectDR.jl | src/heatmap_tools.jl | Julia | mit | 1,544 |
#############################################################################
# SCS.jl
# Wrapper around the SCS solver https://github.com/cvxgrp/scs
# See http://github.com/JuliaOpt/SCS.jl
#############################################################################
# test/options.jl
# Tests the ability to pass options... | JuliaPackageMirrors/SCS.jl | test/options.jl | Julia | mit | 1,840 |
# Test mixed-type examples.
# For now both A and rhs will be converted to Float64.
A = random_matrix(Float16, [1, 2, 3, 4], 4, 4);
rhs = Array{Float32}([1., 4., 9., 16.]);
x = solve(A, rhs, sym=mumps_unsymmetric);
MPI.Barrier(comm);
relres = norm(A * x - rhs) / norm(rhs);
@test(relres <= 1.0e-12);
# Here, MUMPS will ... | dpo/MUMPS.jl | test/mumps_test_mixed.jl | Julia | mit | 1,764 |
function pulaymix!(vin::Array{Float64,1}, vout::Array{Float64,1},
beta::Float64, dvmat, vmat, iter::Int64, mixdim::Int64)
# output [vnew,df,dv]
Npoints = size(vin)[1]
#
# construct and modify vmat and dvmat
#
if iter <= mixdim
vmat[:,iter] = vin
dvmat[:,iter] =... | f-fathurrahman/ffr-ElectronicStructure.jl | PW/dft_02/pulaymix.jl | Julia | mit | 1,412 |
# it has unique keys
# leftChild has keys which are less than the node
# rightChild has keys which are greater than the node
# color is true if it's a Red Node, else it's false
mutable struct RBTreeNode{K}
color::Bool
data::Union{K, Nothing}
leftChild::Union{Nothing, RBTreeNode{K}}
rightChild::Union{Not... | JuliaLang/DataStructures.jl | src/red_black_tree.jl | Julia | mit | 11,561 |
module TestShow
using Base.Test
using NullableArrays
io = IOBuffer()
disp = TextDisplay(IOBuffer())
for typ in (Float64, Int, UInt, Char)
for l in (10, 100, 1000)
A1 = rand(typ, l)
M1 = rand(Bool, l)
X1 = NullableArray(A1)
Y1 = NullableArray(A1, M1)
show(io, X1)
s... | JuliaPackageMirrors/NullableArrays.jl | test/show.jl | Julia | mit | 1,121 |
module Lexicon
import Docile.Interface:
parsedocs,
macroname,
name
import Base:
start,
next,
done,
length,
push!,
run,
writemime,
==
using
Base.Meta,
Compat,
Docile,
Docile.Interface
export
@query,
query,
save,
update!,
doctest,
... | hayd/Lexicon.jl | src/Lexicon.jl | Julia | mit | 735 |
@testset "DictionarySorting" begin
@testset "Core Functionality" begin
forward = OrderedDict(zip('a':'z', 26:-1:1))
rev = OrderedDict(zip(reverse('a':'z'), 1:26))
@testset "sort" begin
d = copy(rev)
@test d == rev
@test sort(d) == forward
end
... | JuliaCollections/DataStructures.jl | test/test_sorting.jl | Julia | mit | 1,352 |
# Resolving Partial XYH constraints
using TransformUtils
using CoordinateTransformations
using DrakeVisualizer
import DrakeVisualizer: Triad
using Base: Test
# random testing and converstion to be moved out
tq = SE3(zeros(3),Quaternion(0.0,[1.0, 0,0]));
q1 = convert(AffineMap, tq);
q2 = convert(AffineMap, tq);
... | dehann/Caesar.jl | examples/marine/rov/highend/lcmserver/resolvingPartialXYH2.jl | Julia | mit | 2,878 |
__precompile__(true)
module VSL
export BRNGType, VSL_BRNG_MCG31, VSL_BRNG_R250, VSL_BRNG_MRG32K3A, VSL_BRNG_MCG59, VSL_BRNG_WH, VSL_BRNG_SOBOL,
VSL_BRNG_NIEDERR, VSL_BRNG_MT19937, VSL_BRNG_MT2203, VSL_BRNG_SFMT19937, VSL_BRNG_NONDETERM, VSL_BRNG_ARS5,
VSL_BRNG_PHILOX4X32X10
export B... | sunoru/VSL.jl | src/VSL.jl | Julia | mit | 1,567 |
using Distributions
# the dgp. tau quantile of epsilon is 0,
# so tau quantile of y is x*beta
function makeQIVdata(beta::Array{Float64,1}, tau::Float64, n::Int64)
alpha = [0.0, 0.5, 0.5, -1.0]
z = [ones(n,1) randn(n,3)]
P = chol([1.0 0.5; 0.5 1.0])
ev = randn(n,2)*P
epsilon = ev[:,1]
V = ev[:,2... | mcreel/ABCGMM | QIV/MonteCarlo/QIVmodel.jl | Julia | mit | 1,225 |
##
# File: sdo1.jl
#
# Purpose: Demonstrates how to solve a small mixed semidefinite and conic quadratic
# optimization problem using the MOSEK Julia API.
##
using Mosek
using Printf, SparseArrays
printstream(msg::String) = print(msg)
# Bound keys for constraints
bkc = [ MSK_BK_FX
MSK... | JuliaOpt/Mosek.jl | examples/sdo1.jl | Julia | mit | 3,578 |
import Base.size, Base.endof, Base.ndims, Base.convert
export Constant, AffineExpr, AffineConstant, Variable, SumSquaresExpr
export Value, Numeric, AffineOrConstant
export evaluate
export convert
export sum_squares
export endof, size, ndims
Value = Union{Float64, SparseMatrixCSC{Float64, Int64}}
Numeric = Union{Number... | JuliaPackageMirrors/LinearLeastSquares.jl | src/types/expressions.jl | Julia | mit | 4,308 |
"""Reduces a scenario set by aggregating all scenarios outside a specified risk region"""
function aggregate_scenarios(scenarios::Matrix{Float64}, Ω::AbstractRiskRegion)
num_risk = 0
num_non_risk = 0
dim, num_scen = size(scenarios)
new_scenarios = Array{Float64}(undef, dim, num_scen)
non_risk_sum = ... | STOR-i/EllipticalScenGen.jl | src/ScenarioReduction.jl | Julia | mit | 4,023 |
function maxdiff(x::Array, y::Array)
res = zero(x[1] - y[1])
@inbounds for i in 1:length(x)
delta = abs(x[i] - y[i])
if delta > res
res = delta
end
end
return res
end
| matthieugomez/Optim.jl | src/utilities/maxdiff.jl | Julia | mit | 219 |
using ParallelAccelerator
immutable newType
w::Vector{Float64}
b::Float64
end
@acc function evaluate(f::newType, X::AbstractMatrix)
if f.b != 0
X = X + f.b
end
return X
end
function main(m::Int, n::Int)
X = Array{Float64}(m, n)
W = Array{Float64}(m)
fill!(X, 5)
fill!(W, 3)
b =... | IntelLabs/ParallelAccelerator.jl | test/test_lda_evaluate.jl | Julia | bsd-2-clause | 406 |
export EthHdr, IpFlags, IpHdr,
UdpHdr, TcpFlags, TcpHdr,
IcmpHdr, DecPkt, decode_pkt
type EthHdr
dest_mac::AbstractString
src_mac::AbstractString
ptype::UInt16
EthHdr() = new("","",0)
end # type EthHdr
type IpFlags
reserved::Bool
dont_frag::Bool
more_frags::Bool
IpFlags()... | brandonkmiller/Pcap.jl | src/headers.jl | Julia | mit | 6,311 |
"""
Constitutive driver.
"""
function driver(stress,
ats,
matstat,
matpar,
time_history::Vector,
strain_history::Matrix,
stress_history::Matrix,
strain_control::Vector{Bool};
xtol::Real = 0.0,... | KristofferC/ConstLab.jl | src/driver.jl | Julia | mit | 3,204 |
_vsl_errors = Dict()
macro vsl_error(code)
_vsl_errors[code.args[2]] = code.args[1]
return esc(Meta.parse("const $code"))
end
struct VSLError <: Exception
errno :: Int32
message :: AbstractString
end
show(io::IO, E::VSLError) = print(io, string("VSL Error: ", strerror(E.errno), " -- ", E.message))
VSL_E... | sunoru/VSL.jl | src/errors.jl | Julia | mit | 2,162 |
module DotOverload
export getMember
export setMember!
export @dotted
macro dotted(ex::Expr)
function getExpression(ex, mem)
if (mem != nothing)
return Expr(:call, :getMember, ex, mem)
end
return ex
end
function treewalk(stuff)
# return whatever is not an expression
if (!isa(stuff, E... | sneusse/DotOverload.jl | src/DotOverload.jl | Julia | mit | 3,294 |
function loweringoperator(s::Real)
sizem = int(2*s)+1
ssq = s*(s+1)
result = zeros(sizem,sizem)
for i = 1:sizem-1
m = s - i
result[i+1,i] = (ssq-m*(m+1))^0.5
end
return result
end
function raisingoperator(s::Real)
sizem = int(2*s)+1
ssq = s*(s+1)
result = zeros(... | bryce-anderson/EprTools.jl | src/operators.jl | Julia | mit | 733 |
using Latexify
using Test
module MyModule
using Latexify
struct MyType
vec1
vec2
end
my_reverse(x) = x[end:-1:1]
@latexrecipe function f(t::MyType; reverse=false)
env --> :align
fmt := "%.2f"
return reverse ? (t.vec2, t.vec1) : (t.vec1, t.vec2)
end
struct MyVec
vec::AbstractVector
end
@lat... | korsbo/Latexify.jl | test/recipe_test.jl | Julia | mit | 3,597 |
# Hock and Schittkowski problem number 74.
#
# Source:
# Problem 74 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 PGR-AN-4-5
#
# A. Montoison, Montreal, ... | dpo/OptimizationProblems.jl | src/hs74.jl | Julia | mit | 979 |
module LDA
using Vega
include("kernel.jl")
include("lda.jl")
include("visualization.jl")
export lda, process, project
export linear, polynomial, laplacian, rbf
export print_2Ddecision
end # module
| remusao/LDA.jl | src/LDA.jl | Julia | mit | 201 |
function ML_get_f_g(featuresTP::Matrix{Float64}, labels::Vector{Float64}, W::Matrix{Float64}, index::Int64)
numFeatures = size(featuresTP)[1]
numClasses = div(length(W),numFeatures)
W=reshape(W,(numFeatures,numClasses))
class=labels[index]
x = featuresTP[:,index]
a=exp(x'*W)
aDb=a/sum(a)
g=x*aDb
g[:,round(In... | stefanks/EGR.jl | src/LossFunctions/lossML.jl | Julia | mit | 1,595 |
# This file is part of the ValidatedNumerics.jl package; MIT licensed
# Krawczyk method, following Tucker
# const D = differentiate
doc"""Returns two intervals, the first being a point within the
interval x such that the interval corresponding to the derivative of f there
does not contain zero, and the second is the... | JuliaPackageMirrors/ValidatedNumerics.jl | src/root_finding/krawczyk.jl | Julia | apache-2.0 | 3,225 |
###############################################################################
#
# Maximal abelian subfield for fields function
#
###############################################################################
function check_abelian_extensions(class_fields::Vector{Tuple{ClassField{MapRayClassGrp, GrpAbFinGenMap}, Ve... | thofma/Hecke.jl | src/FieldFactory/maximal_abelian_subextension.jl | Julia | bsd-2-clause | 9,231 |
#!/usr/bin/env julia
include("se_dseason.jl")
push!(PGFPlotsX.CUSTOM_PREAMBLE, raw"\usepackage{fontspec}")
push!(PGFPlotsX.CUSTOM_PREAMBLE, raw"\setmainfont{Asana-Math}")
pgfsave("../../images/se_dseason_81_19_kv.svg", plot_seasontypes("women", 1981, 2019))
pgfsave("../../images/se_dseason_81_19_m.svg", plot_seasontype... | klpn/static-dust | postdata/2020-06-22-normal/se_dseason_81_19.jl | Julia | bsd-3-clause | 342 |
include("../src/Cosmology.jl")
using Cosmology
using Base.Test
function test_approx_eq_rtol(va, vb, rtol, astr, bstr)
diff = maximum(abs(va - vb))
tol = rtol*max(maximum(abs(va)), maximum(abs(vb)))
if diff > tol
sdiff = string("|", astr, " - ", bstr, "| <= ", tol)
error("assertion failed: "... | kbarbary/Cosmology.jl | test/runtests.jl | Julia | mit | 4,406 |
# -*- coding: utf-8 -*-
# MD5 hash tests from:
# https://git.lysator.liu.se/nettle/nettle/blob/master/testsuite/md5-test.c
for (text, hash) in [
(
"",
"d41d8cd98f00b204e9800998ecf8427e"
),(
"a",
"0cc175b9c0f1b6a831c399e269772661"
),(
"abc",
"900150983cd24fb0d6... | JuliaPackageMirrors/Nettle.jl | test/hash_tests.jl | Julia | mit | 4,331 |
#
# Vadd
#
# Element wise addition of two vectors at a time in a chain (C=A+B; D=C+E; F=D+G)
# Asks the user to select a device at runtime
#
# History: Initial version based on vadd.c, written by Tim Mattson, June 2011
# Ported to C++ Wrapper API by Benedict Gaster, September 2011
# Updated to C++ Wrapper API v1.2 by T... | tkelman/OpenCL.jl | examples/hands_on_opencl/ex04/vadd_chain.jl | Julia | mit | 3,832 |
using SymPy: Sym, sqrt, conjugate, symbols, PI, simplify,
expand_func, rewrite, N
using LinearAlgebra
using Test
using SymPy.SpecialFuncs
using SpecialFunctions
@testset "SpecialFuns" begin
a, b, x, y = symbols("a, b, x, y")
n, m, θ, ϕ = symbols("n, m, theta, phi")
ν = symbols("nu", integer=... | JuliaPy/SymPy.jl | test/test-specialfuncs.jl | Julia | mit | 6,416 |
module Feature_Test
using SpikeSorting
if VERSION > v"0.7-"
using Test
else
using Base.Test
end
d=DetectNeg()
cluster=ClusterOSort();
align=AlignMax();
reduce=ReductionNone();
thres=ThresholdMeanN();
num_channels=1;
(buf,nums)=output_buffer(num_channels);
function make_voltage(num_channels)
v=rand(1:... | paulmthompson/SpikeSorting.jl | test/feature_test.jl | Julia | bsd-2-clause | 1,157 |
export cursor, focused, frameCount, frameRate
export height, noCursor, noSmooth, smooth, width
# start with arrow cursor by default, as expected
currCursor = GLFW.CreateStandardCursor(GLFW.ARROW_CURSOR)
function cursor(window)
GLFW.SetInputMode(window, GLFW.CURSOR, GLFW.CURSOR_NORMAL)
GLFW.SetCursor(window, currCur... | rennis250/Processing.jl | src/environment.jl | Julia | mit | 1,597 |
#= List of priors *********************************************** =#
#= Gaussian with var_gauss variance =#
function f_gauss(A,B,var_gauss=1)
VAR=inv((1./var_gauss)*eye(A)+A);
MEAN=B*VAR;
logZ=-0.5*log(det(var_gauss*eye(A)+A))*size(B,1)+trace(0.5*B'*B*VAR);
MEAN,VAR,logZ;
end
#= Clustering Prior =#
fun... | sphinxteam/LowRAMP.jl | src/Priors.jl | Julia | mit | 1,219 |
export PacketHeader
type PacketHeader
typ :: UInt8 # hsa_packet_type_t
barrier :: Bool
acquire_fence_scope :: UInt8 # hsa_fence_scope_t
release_fence_scope :: UInt8 # hsa_fence_scope_t
end
function PacketHeader(typ;
barrier::Bool = false,
acquire = FenceScopeNone,
release = FenceScopeNone
... | rollingthunder/HSA.jl | src/binding/custom/aql.jl | Julia | mit | 11,248 |
using DReal
# using Gadfly
## Function Approximation
## ======================
f(x) = sin(x) + 2x
npowers = 5
θ = [DReal.Var(Float64, -10.0, 10.0) for i = 1:npowers]
g(x) = sum([θ[i]*(x^i) for i = 1:(npowers - 1)]) + θ[npowers]
x = ForallVar(global_context(), Float64, -1000.0, 1000.0)
constraint = abs(g(x) - f(x)) <... | zenna/DReal.jl | test/funcapprox.jl | Julia | mit | 393 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.