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 PyPlot
using FFTW
linspace(a,b,n) = range(a,stop=b,length=n)
close("all")
## Uncomment for production
PyPlot.rc("font", family="serif")
PyPlot.rc("xtick", labelsize="x-small")
PyPlot.rc("ytick", labelsize="x-small")
PyPlot.rc("figure", figsize=(4,3))
PyPlot.rc("text", usetex=false)
nband = p.nband
Ks = zeros(... | antoine-levitt/wannier | plot_free_wannier.jl | Julia | mit | 14,441 |
@inline function throw_if_error(error_code::Cuint, str=nothing)
if error_code == 0
return
else
throw(get_error(error_code, str))
end
end
function get_error(error_code::Cuint, str=nothing)
if error_code == 1
return ErrorException("Unknown SymEngine Exception")
elseif error_co... | symengine/SymEngine.jl | src/exceptions.jl | Julia | mit | 659 |
# Main functions concerning "doubt coefficient" for work on MCL
# Berkeley 2015 - Maxime Legrand
#Pkg.add("Gadfly")
using Gadfly
include("../plot_tools.jl")
include("../matrix_tools.jl")
include("mcl.jl")
#####################################
# Step by step (customed algorithm) #
#####################################... | m-legrand/ucb15 | MCL_Julia/mcl_dc.jl | Julia | mit | 3,372 |
using HTTPClient.HTTPC
using JSON
using Compat
using Base.Test
const upload_file = joinpath(dirname(@__FILE__), "uploadfile.txt")
# get a request bin name
r=HTTPC.post("http://requestb.in/api/v1/bins", "")
@test r.http_code == 200
jdict = JSON.parse(bytestring(r.body))
@test haskey(jdict, "name")
RB = "http://reque... | mdcfrancis/HTTPClient.jl | test/runtests.jl | Julia | mit | 6,450 |
using DeepReshapes
using Base.Test
a = [1, 2, 3]
b = Real[1.0, 2, 6//2]
C = [1.0 2.0 3.0;
4.0 5.0 6.0]
D = [1.0 2.0 3.0 4.0]
E = (1, 2.0, 1//2)
F = (a, b, C, (D, E))
g = [1, (2, 3)]
h = [1 (2, 3)]
I = Vector[a, b]
# Untyped describe
@test describe(1, typed = false) == ()
@test describe(a, typed = false)... | lmshk/DeepReshapes.jl | test/runtests.jl | Julia | mit | 4,162 |
include("queue.jl")
include("buffered_input.jl")
# Position within the document being parsed
immutable Mark
index::Uint
line::Uint
column::Uint
end
function show(io::IO, mark::Mark)
@printf(io, "line %d, column %d", mark.line, mark.column)
end
# Where in the stream a particular token lies.
immutab... | peter1000/YAML.jl | src/scanner.jl | Julia | mit | 44,109 |
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
using JuliaFEM, Test, Statistics
### temperature patch tests, sl tet4, dl tet4, sl tet10, dl tet 10
tet4_meshfile = joinpath("test_problems_mortar_3d", "tet4.inp")
tet10_meshfile = joinpath("test_p... | JuliaFEM/JuliaFEM.jl | test/test_problems_mortar_3d.jl | Julia | mit | 20,788 |
## stieltjes
function stieltjes{L<:PeriodicLine,SS}(S::Space{SS,L},f,z::Number,s...)
S2=setdomain(S,Circle())
stieltjes(S2,f,mappoint(domain(S),Circle(),z),s...)+hilbert(S2,f,-1)*π
end
function hilbert{L<:PeriodicLine,SS}(S::Space{SS,L},f,z::Number)
S2=setdomain(S,Circle())
hilbert(S2,f,mappoint(d... | JuliaPackageMirrors/SingularIntegralEquations.jl | src/periodicline.jl | Julia | bsd-3-clause | 1,004 |
function absolute_error(y_true, y_pred)
@_dimcheck length(y_true) == length(y_pred)
return(abs.(y_true .- y_pred))
end
function percent_error(y_true, y_pred)
@_dimcheck length(y_true) == length(y_pred)
return((y_true .- y_pred) ./ y_true)
end
function log_error(y_true, y_pred)
@_dimcheck length(y_... | paulhendricks/Metrics.jl | src/regression.jl | Julia | mit | 3,756 |
# Julia wrapper for header: /opt/local/include/libavcodec/vda.h
# Automatically generated using Clang.jl wrap_c, version 0.0.0
@c Cint ff_vda_create_decoder (Ptr{vda_context}, Ptr{uint8_t}, Cint) libavcodec
@c Cint ff_vda_destroy_decoder (Ptr{vda_context},) libavcodec
| meggart/Movies | src/vda.jl | Julia | mit | 271 |
using cme257demo
using Base.Test
@test exprand() >= 0
@test demofun(1, 2) == 3
@test_throws MethodError demofun(3.0, 3.0)
| bnels/cme257demo.jl | test/runtests.jl | Julia | mit | 125 |
using HavenOnDemand
using Base.Test
# write your own tests here
@test 1 == 1
| Ismael-VC/HavenOnDemand.jl | test/runtests.jl | Julia | mit | 78 |
function ldaimpl(words::Matrix, k::Integer, max_iter::Integer)
"""
Train the Latent Dirichlet Allocation model on the corpus of
documents.
M = number of documents.
k = number of topics.
V = number of words.
"""
M, V = size(words)
# We first need to create vectors from our text c... | LanguageProcessingUnit/TopicModeling.jl | src/lda/lda.jl | Julia | mit | 1,360 |
tests = ["seeding",
"kmeans",
"kmedoids",
"affprop",
"dbscan",
"silhouette",
"varinfo"]
println("Runing tests:")
for t in tests
fp = "$(t).jl"
println("* $fp ...")
include(fp)
end
| axsk/Clustering.jl | test/runtests.jl | Julia | mit | 250 |
using Wavelets
using Images # for imread and imwrite
img = imread("lena.tiff")
x = permutedims(img.data, [ndims(img.data):-1:1])
L = 2
xts = wplotim(x, L, POfilter("db3"))
imwrite(xts, "lena_2d.png")
# convert with ImageMagick
run(`convert lena_2d.png transform2d_lena.jpg`)
| luboshanus/Wavelets.jl | example/transform2d.jl | Julia | mit | 281 |
export IGStocks, IGRiskfreeBonds, IGCash, Invest, InvestAlloc, project!
export InvestInfo
export meandiscrf, goingconcern!, prepend_c, slice_c
## Investment Groups: IG #########################################
## Investment groups may differ from asset groups as one
## asset group may drive several investment groups. ... | mkriele/MCInsurance.jl | src/Invest/Invest__Types.jl | Julia | mit | 6,935 |
is_url_char(c) = ((@assert UInt32(c) < 0x80); 'A' <= c <= '~' || '$' <= c <= '>' || c == '\f' || c == '\t')
is_mark(c) = (c == '-') || (c == '_') || (c == '.') || (c == '!') || (c == '~') ||
(c == '*') || (c == '\'') || (c == '(') || (c == ')')
is_userinfo_char(c) = isalnum(c) || is_mark(c) || (c == '%') ... | JuliaPackageMirrors/URIParser.jl | src/parser.jl | Julia | mit | 11,047 |
function initialize(::Type{MarkovChain},
mcmc::MCMC{T},
progress_channel::RemoteChannel;
attempts::Int64=1000) where T <: EpidemicModel
if attempts <= 0
error("Must have at least 1 initialization attempt")
end
bested = 0
max_lposterior = -Inf
loc... | jangevaa/Pathogen.jl | src/inference/initialize.jl | Julia | mit | 2,875 |
@constructor LIBROOT TSVDUnfold (bdat::Ptr{TH1D}, bini::Ptr{TH1D}, xini::Ptr{TH1D}, Adet::Ptr{TH2D}) TSVDUnfold1 (nothing, nothing, nothing, nothing )
@constructor LIBROOT TSVDUnfold (bdat::Ptr{TH1D}, Bcov::Ptr{TH2D}, bini::Ptr{TH1D}, xini::Ptr{TH1D}, Adet::Ptr{TH2D}) TSVDUnfold2 (nothing, nothing, nothing, nothing, no... | JuliaPackageMirrors/ROOT.jl | gen/tsvdunfold.jl | Julia | bsd-2-clause | 1,218 |
# An implementation of LSMR for the solution of the
# over-determined linear least-squares problem
#
# minimize ‖Ax - b‖₂
#
# equivalently, of the normal equations
#
# AᵀAx = Aᵀb.
#
# LSMR is formally equivalent to applying MINRES to the normal equations
# but should be more stable. It is also formally equivalent to ... | JuliaOptimizers/Krylov.jl | src/lsmr.jl | Julia | mit | 12,490 |
len = length
using PyCall,DataFrames,RCall
unshift!(PyVector(pyimport("sys")["path"]), "")
@pyimport ncdata
filename = "dsmacc_out.nc"
filename = "../methane.nc"
data = ncdata.get(filename)
specs = names!(DataFrame(data["spec"]),[Symbol(i)for i in data["sc"]])
rates = names!(DataFrame(data["rate"]),[Symbol(i)for i i... | wolfiex/RopaJL | centralityplots/centrality.jl | Julia | mit | 7,318 |
"""
Combine agent and stock level functions into a simulation framework
Justin Angevaare
May 2015
"""
| devrows/FishABM.jl | src/simulate.jl | Julia | mit | 108 |
# Hock and Schittkowski problem number 108.
#
# Source:
# Problem 108 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 QQR-AN-9-13
#
# A. Montoison, Mont... | dpo/OptimizationProblems.jl | src/hs108.jl | Julia | mit | 1,295 |
using RandomGraphs
using Graphs
using Base.Test
# Barabási–Albert scale-free graphs
n = 100
m = 2
let g = barabasi_albert_graph(n, m)
@test num_vertices(g) == n
@test num_edges(g) == n*m - sum(1:m)
@test !is_directed(g)
end
| arnim/RandomGraphs.jl | test/barabasi_albert.jl | Julia | mit | 234 |
using JuMP
using Xpress
using Plasmo
using PlasmoAlgorithms
graph = OptiGraph()
optimizer = Xpress.Optimizer
Plasmo.set_optimizer(graph, optimizer)
mp = @optinode(graph)
JuMP.set_optimizer(mp.model, optimizer)
@variable(mp,x[1:3]>=0)
@constraint(mp,x[1]+x[2]+x[3]<=500)
@objective(mp,Min,150x[1]+230x[2]+260x[3])
sp1... | bbrunaud/PlasmoAlgorithms.jl | examples/Benders/example2.jl | Julia | mit | 1,753 |
#! /usr/bin/julia
# Rosetta Code, Knuth's algorithm S
function makesofn(n::Int)
buf = Any[]
i = 0
function sofn(item)
i += 1
if i <= n
push!(buf, item)
else
j = rand(1:i)
if j <= n
buf[j] = item
end
end
... | MichaeLeroy/rosetta-code | julia/completed/knuth_algorithm_s.jl | Julia | mit | 649 |
const NCCL_UNIQUE_ID_BYTES = 128
# ncclDataType_t
const ncclInt8 = 0
const ncclChar = 0
const ncclUint8 = 1
const ncclInt32 = 2
const ncclInt = 2
const ncclUint32 = 3
const ncclInt64 = 4
const ncclUint64 = 5
const ncclFloat16 = 6
const ncclHalf = 6,
const ncclFloat32 = 7
const ncclFloat = 7
const ncclFloat64 = 8
const... | hshindo/Merlin.jl | src/cuda/nccl/types.jl | Julia | mit | 468 |
# Measure the performance of the transverse Mercator projections
import Geodesy
import Proj4
function perf_geodesy(n)
lla = Geodesy.LLA(1.0,1.0,0.0)
trans1 = Geodesy.UTMfromLLA(Geodesy.utm_zone(lla)..., Geodesy.wgs84)
trans2 = Geodesy.LLAfromUTM(Geodesy.utm_zone(lla)..., Geodesy.wgs84)
for i = 1:n
... | JuliaPackageMirrors/Geodesy.jl | perf/performance.jl | Julia | mit | 2,394 |
# Performs a baseline correction by averaging the spectrum recorded before the laser pulse
# and offsetting the rest of the spectrum accordingly
export fixOffset, fixProjectionOffset, fix2DTrace
function fixOffset{T<:Complex}(data::Array{T,2}, index::Int)
d2 = copy(data)
for i = 1:size(data)[1]
d2[i,:... | bryce-anderson/EprTools.jl | src/utils/spectcorrections.jl | Julia | mit | 1,877 |
export isexpr, isline, rmlines, unblock, namify, isdef, longdef, shortdef, @expand
assoc!(d, k, v) = (d[k] = v; d)
"""
isexpr(x, ts...)
Convenient way to test the type of a Julia expression.
Expression heads and types are supported, so for example
you can call
isexpr(expr, String, :string)
to pick up on al... | tkelman/MacroTools.jl | src/utils.jl | Julia | mit | 2,149 |
module Player
import GL
type State
position::GL.Vec3
orientation::GL.Vec3 # pitch, yaw, and roll in degrees
look_velocity::GL.Vec3
move_velocity::GL.Vec3
speed::Real
last_think::Real
end
State() = State(GL.Vec3(0,0,0), GL.Vec3(0,0,0), GL.Vec3(0,0,0), GL.Vec3(0,0,0), 100, 0)
function lookdir!(player::State, d... | jayschwa/Quake2.jl | src/Player.jl | Julia | mit | 2,685 |
using Base.Threads
include("update.jl")
function rw_map(xs, nsteps=10000)
for i in 1:nsteps
map!(update, xs, xs)
end
end
function rw_loop(xs, nsteps=10000)
num = length(xs)
for i in 1:nsteps
@inbounds for j in 1:num
xs[j] += update(xs[j])
end
end
end
function ... | yomichi/JuliaBook-Samples | src/rw_thread.jl | Julia | mit | 492 |
# small script to test how to perform the domain decomposition
# we try to compute fast solution without tampering with A directly,
# in this file we add the possibility to use Sparse MKL for the matrix
# vector multiplication
# Clean version of the DDM ode
using PyPlot
using Devectorize
using IterativeSolvers
using... | Forgotten/Fast_solver_Lippmann_Schwinger | tests/plasma_example.jl | Julia | mit | 5,321 |
function _precompile_()
ccall(:jl_generating_output, Cint, ()) == 1 || return nothing
precompile(MachO.r_extern, (MachO.relocation_info,))
precompile(MachO.getindex, (MachO.Sections, Int64,))
precompile(MachO.bytestring, (Base.AbstractIOBuffer{Array{UInt8, 1}}, UInt32,))
precompile(MachO.Type, (Type... | JuliaPackageMirrors/MachO.jl | src/precompile.jl | Julia | mit | 8,710 |
#############################################################################
# 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... | bodono/SCS.jl | test/options.jl | Julia | mit | 1,852 |
pkg_dict = Pkg.installed() # get dictionary of installed package names to version numbers
if !haskey(pkg_dict, "MPI")
Pkg.clone("MPI")
Pkg.build("MPI")
end
include("build_petscs.jl")
| jiahao/PETSc.jl | deps/build.jl | Julia | mit | 191 |
import Base: /
immutable Dimensions
width::Int64
height::Int64
Dimensions(width::Number, height::Number) = new(floor(Int64, width), floor(Int64, height))
end
immutable Point
x::Int64
y::Int64
Point(x::Number, y::Number) = new(floor(Int64, x), floor(Int64, y))
end
immutable Rectangle
poin... | behos/Thumbnailer.jl | src/types.jl | Julia | apache-2.0 | 590 |
function block_pmap(f, lsts...; err_retry=true, err_stop=false, fetch_results=true)
len = length(lsts)
np = nworkers()
retrycond = Condition()
results = Dict{Int,Any}()
function setresult(idx,v)
results[idx] = v
notify(retrycond)
end
retryqueue = Any[]
function retry(id... | JuliaPackageMirrors/Blocks.jl | src/pmap.jl | Julia | mit | 3,221 |
using Base.Test
using Lens
function f()
x = 10;
lens(:mylens,x=x)
y = 20
lens(:his,y)
z = 30
lens(:yourlens,z=z,y=y)
40
end
value, results = capture(f, [(:mylens,[:x])])
@test value == 40
@test get(results)[1] == 10
value, results = capture(f, :his)
@test get(results)[1] == 20
value, results = capture(... | JuliaPackageMirrors/Lens.jl | test/capture.jl | Julia | mit | 740 |
facts("TopListArchive") do
context("ArchivedIndividual") do
# test equality
@fact isequal(BlackBoxOptim.ArchivedIndividual([3.0, 2.0], 2.0), BlackBoxOptim.ArchivedIndividual([3.0, 2.0], 2.0)) --> true
@fact (BlackBoxOptim.ArchivedIndividual([3.0, 2.0], 2.0) == BlackBoxOptim.ArchivedIndividual([3.0, 2.0], ... | multidis/BlackBoxOptim.jl | test/test_archive.jl | Julia | mit | 6,608 |
#=
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... | malekbr/julia-to-tiramisu | test/abs.jl | Julia | bsd-2-clause | 2,219 |
include(joinpath(JULIA_HOME, Base.DATAROOTDIR, "julia", "build_sysimg.jl"))
println("Building JuliaBox Julia system image...")
build_sysimg("/opt/julia_packages/jimg/stable/sys", "native", "/home/juser/jimg.jl", force=true) | mdpradeep/JuliaBox | container/interactive/mkjimg.jl | Julia | mit | 224 |
# conversion methods for DataArrays and DataFrames
function rcopy{T,S<:VectorSxp}(::Type{DataArray{T}}, s::Ptr{S})
DataArray(rcopy(Array{T},s), isna(s))
end
function rcopy{S<:VectorSxp}(::Type{DataArray}, s::Ptr{S})
DataArray(rcopy(Array,s), isna(s))
end
function rcopy(::Type{DataArray}, s::Ptr{IntSxp})
i... | JuliaPackageMirrors/RCall.jl | src/convert-data.jl | Julia | mit | 2,653 |
module Neovim
using Compat
using MsgPack
import MsgPack: pack, unpack
import Sockets: connect
export NvimClient, nvim_connect, nvim_env, nvim_spawn, nvim_child, start_host
export Buffer, Tabpage, Window
export reply_result, reply_error
# types that have api methods (nvim itself + api defined types)
abstract type Nvi... | bfredl/Neovim.jl | src/Neovim.jl | Julia | mit | 1,264 |
# Indicator constraints
MOI.supports_constraint(::Optimizer, ::Type{<:MOI.VectorAffineFunction}, ::Type{<:MOI.IndicatorSet{MOI.ACTIVATE_ON_ONE, <:MOI.LessThan}}) = true
function MOI.add_constraint(o::Optimizer, func::MOI.VectorAffineFunction{T}, set::MOI.IndicatorSet{MOI.ACTIVATE_ON_ONE, LT}) where {T<:Real, LT<:MOI.... | SCIP-Interfaces/SCIP.jl | src/MOI_wrapper/indicator_constraints.jl | Julia | mit | 3,044 |
module Pivot
#=__precompile__()=#
using MbedTLS, Mux, HttpServer
export Endpoint,
Router,
TRouter,
Engine,
Routing,
handle!,
use!,
match,
run,
GET,
PUT,
POST,
DELETE,
PATCH
# package code goes here
include("verbs.jl")
include("utils.jl")
include("Endpoint.jl")
include("Router.jl")
include("... | ZehCnaS34/Pivot.jl | src/Pivot.jl | Julia | mit | 437 |
using ModernGL
using FileIO, MeshIO,Meshes, GLAbstraction, GLVisualize, Reactive, GLWindow
using GeometryTypes, ColorTypes, Colors
using Base.Test
w, renderloop = glscreen()
const TEST_DATA = RenderObject[]
const TEST_DATA2D = RenderObject[]
include(string("all_tests.jl"))
println(length(TEST_DATA))
grid = re... | staticfloat/GLVisualize.jl | test/runtests.jl | Julia | mit | 925 |
using DataStructures, Test
@testset "OrderedDict" begin
@testset "Constructors" begin
@test isa(OrderedDict(), OrderedDict{Any,Any})
@test isa(OrderedDict([(1,2.0)]), OrderedDict{Int,Float64})
@test isa(OrderedDict([("a",1),("b",2)]), OrderedDict{String,Int})
@test isa(OrderedDict(... | ScottPJones/DataStructures.jl | test/test_ordered_dict.jl | Julia | mit | 10,792 |
include("Header.jl")
"""
**SeisGeometry**
*Update headers with Geometry information beginning with shot and receiver coordinates (calculation of midpoints, absolute and vector offsets, azimuth, coordinate rotation, and binning of headers values)*
**IN**
* in: input filename (the .seish file is updated)
* ang=90 ... | aaronstanton/Seismic.jl | src/Utils/SeisGeometry.jl | Julia | mit | 2,410 |
using CLBLAS
const clblas = CLBLAS
import OpenCL
const cl = OpenCL
function testDirectCall()
device, ctx, queue = clblas.get_next_compute_context()
A = rand(Float32, 1)
B = rand(Float32, 1)
C = rand(Float32, 1)
println(A, B, C)
a = cl.cl_float(6.6)
b = cl.cl_flo... | JuliaPackageMirrors/CLBLAS.jl | examples/randomBuffer.jl | Julia | apache-2.0 | 2,743 |
#!/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/lognormal/kurtosis/test/fixtures/julia/runner.jl | Julia | apache-2.0 | 1,760 |
using Matfacgrf
using Base.Test
import Matfacgrf.residual
tolerance = 10e-10
function testResidual()
m, k, n = 10, 5, 12
A = sprand(m, n, .3)
W = rand(m, k)
H = rand(k, n)
cr = residual(A, W, H, 2)
rr = residual(A, W, H, 1)
tr = residual(A, W, H)
@test_approx_eq_eps sum(cr) tr tolerance... | jpfairbanks/Matfacgrf | test/utils.jl | Julia | bsd-2-clause | 1,130 |
@testset "Primes" begin
@testset "Next prime" begin
for T in [UInt32, UInt64, UInt128, Int32, Int64, Int128, BigInt, fmpz]
@test @inferred next_prime(T(0)) == T(2)
@test @inferred next_prime(T(2)) == T(3)
@test @inferred next_prime(T(3)) == T(5)
end
if Int == Int64
@test_throws In... | thofma/Hecke.jl | test/Misc/Primes.jl | Julia | bsd-2-clause | 2,995 |
export MType, zerotype, montes_initial, phi_expansion, valuationf, extend_valuation
type MType
phi
f
m
F
z
NewtonOp
ResOp
end
valuation{T <: Integer}(x::fmpz, y::T) = valuation(x, ZZ(y))
function phi_expansion(f::fmpz_poly, phi::fmpz_poly)
(lead(f) != 1) && (lead(phi) != 1) && error("must be monic")
... | fredrik-johansson/hecke | src/NfOrder/NfOrderMontes.jl | Julia | bsd-2-clause | 1,214 |
"""
Beta Uniform Mixture (BUM) Model
# Arguments
- π0 : Contributing fraction of the uniform distribution to the full model
- α, β : Parameters of the Beta distribution, Float64, default: 0.5, 3.0
# Return values
`MixtureModel`, as defined in the `Distributions` package, composed of
- a uniform distribution in t... | julian-gehring/MultipleTesting.jl | src/model.jl | Julia | mit | 1,217 |
export Problem
Float64OrVoid = Union{Float64, Void}
SumSquaresExprOrVoid = Union{SumSquaresExpr, Void}
type Problem
head::Symbol
objective::SumSquaresExpr
constraints::Array{EqConstraint, 1}
status::ASCIIString
optval::Float64OrVoid
function Problem(head::Symbol, objective::SumSquaresExprOrVoid, constrai... | JuliaPackageMirrors/LinearLeastSquares.jl | src/types/problems.jl | Julia | mit | 447 |
# ____ _____
# | _ \ _ _ _ __ __ _ _ __ ___ ___ |_ _| _ _ __ ___ ___
# | | | | | | | '_ \ / _` | '_ ` _ \ / _ \ | || | | | '_ \ / _ \/ __|
# | |_| | |_| | | | | (_| | | | | | | (_) | | || |_| | |_) | __/\__ \
# |____/ \__, |_| |_|\__,_|_| |_| |_|\___/ |_| \... | dls/DynamoDB.jl | src/dynamo.jl | Julia | mit | 4,625 |
#----------------------------------------------------------------------
# Termtris.jl
# https://github.com/IainNZ/Termtris.jl
# A falling block game that runs in your terminal, in Julia.
# By Iain Dunning, 2014
# MIT License
#----------------------------------------------------------------------
# A port of Tyler Neylo... | IainNZ/Termtris.jl | src/Termtris.jl | Julia | mit | 12,884 |
type MIDIEvent <: TrackEvent
dT::Int
status::UInt8
data::Array{UInt8,1}
end
function isstatusbyte(b::UInt8)
(b & 0b10000000) == 0b10000000
end
function isdatabyte(b::UInt8)
!isstatusbyte(b)
end
function isMIDIevent(b::UInt8)
!ismetaevent(b) && !issysexevent(b)
end
function channelnumber(m::M... | JuliaPackageMirrors/MIDI.jl | src/midievent.jl | Julia | mit | 1,132 |
module Solve
using Optim
import LujiaLt: Model, free_defm_indices, defm2dofs, dofs2defm,
grad, evaluate
import LujiaLt.Potentials: nndist, rdim
import LujiaLt.MDTools: NeighbourList, sites
export solve, quick_solve
"""
`preconditioner(m::Model, Y::Matrix)`
`preconditioner(m::Model, dof::Vector)`
Preco... | cortner/LujiaLt | src/solve.jl | Julia | mit | 4,235 |
using FactCheck
include("orderbook.jl")
include("blotter.jl")
include("trades.jl")
include("portfolio.jl")
include("account.jl")
include("utilities.jl")
exitstatus()
| JuliaQuant/FinancialBlotter.jl | test/runtests.jl | Julia | mit | 168 |
module MatrixDepot
using Compat # support v3 and v4
using GZip
using MatrixMarket
export
# main function
matrixdepot,
@addproperty, @rmproperty
include("ufreader.jl")
include("common.jl") # main functions
include("higham.jl") # test matrices
include("data.jl")
include("user.jl") # user define... | tkelman/MatrixDepot.jl | src/MatrixDepot.jl | Julia | mit | 433 |
"""
A linear Gaussian CPD, always returns a Normal
Assumes that target and all parents can be converted to Float64 (ie, are numeric)
P(x|parents(x)) = Normal(μ=a×parents(x) + b, σ)
"""
type LinearGaussianCPD <: CPD{Normal}
target::NodeName
parents::Vector{NodeName}
a::Vector{Float64}
b::Float64
σ::Fl... | JuliaPackageMirrors/BayesNets.jl | src/CPDs/linear_gaussian_cpd.jl | Julia | mit | 2,551 |
"""
test_reverse_mode_ad(forward, f, ȳ, x...; rtol=1e-6, atol=1e-6)
Check that the reverse-mode sensitivities produced by an AD library are correct for `f`
at `x...`, given sensitivity `ȳ` w.r.t. `y = f(x...)` up to `rtol` and `atol`.
"""
function test_reverse_mode_ad( f, ȳ, x...; rtol=1e-6, atol=1e-6)
# Pe... | yebai/Turing.jl | test/test_utils/ad_utils.jl | Julia | mit | 3,222 |
using Sundials
## f2 routine. Compute function f(x,y).
function f(x, y, ydot)
ydot[1] = y[2]
ydot[2] = -2.0*y[2]^2 / y[1]
end
x = linspace(0.0, 1.0, 11)
@show Sundials.cvode(f, [1.0, 1.0], x)
| goedman/NMfE.jl | examples/ch07/IVP/Sundials03.jl | Julia | mit | 202 |
using RobHood
#function main(portfilename)
portfilename="./YahooDatabase10.csv";
portfile = portfilename;
portfdat = readdlm(portfile,',');
portfolio = portfdat[:,1];
description = portfdat[:,2];
nS = length(portfolio);
nT,x,y,group = RobHood.readPortData(portfolio,nS);
nS,nT,... | cndesantana/RobHood.jl | test/runtests.jl | Julia | mit | 805 |
## port methods of series module of SymPy
## http://docs.sympy.org/0.7.2/modules/series.html
## simple methods (x, args) -> y (y coercion happens via PyCall)
series_sympy_meths = (#:limit
:gruntz,
:series, :Order, :O,
:residue,
:fo... | jverzani/SymPy.jl | src/series.jl | Julia | mit | 516 |
#!/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/beta/median/benchmark/julia/benchmark.jl | Julia | apache-2.0 | 2,930 |
@testset "Constructors" begin
h1 = SwissDict()
@test length(h1) == 0
@test isempty(h1) == true
@test h1.idxfloor == 1
@test length(h1.keys) == 16
@test length(h1.vals) == 16
@test length(h1.slots) == 1
@test eltype(h1) == Pair{Any, Any}
@test keytype(h1) == Any
@test valtype(h1) ... | JuliaLang/DataStructures.jl | test/test_swiss_dict.jl | Julia | mit | 9,547 |
module Meta
export quot, is_expr, is_fdef, split_fdef, subs_ex, @expect, @get!
macro expect(pred)
quote
$(esc(pred)) ? nothing : error(
$(string("expected: ", sprint(Base.show_unquoted, pred)", == true")))
end
end
# ---- Metaprogramming -----------------------------------------------------... | JuliaPackageMirrors/PatternDispatch.jl | src/Meta.jl | Julia | mit | 1,752 |
########################## Auxiliary functions #############################
function eye(tpe::Type,n::S) where {S <: Integer}
if tpe <: Number
return Matrix{tpe}(I,n,n)
end
end
eye(n::Integer) = eye(Float64,n::Integer)
function tracem(x::Array{T,2}) where {T <: Real}
# Computes the matrix-trace as defi... | RJDennis/SolveDSGE.jl | src/auxiliary_functions.jl | Julia | mit | 20,261 |
module DataArraysBenchmark
using DataArrays, Benchmark
# seed rng for more consistent timings
srand(1776)
const TEST_NAMES = [
"Vector",
"DataVector No NA",
"DataVector Half NA",
"Matrix",
"DataMatrix No NA",
"DataMatrix Half NA"
]
function make_test_types(genfunc, sz)
mat = genfunc(abs2(... | timholy/DataArrays.jl | benchmark/operators.jl | Julia | mit | 2,034 |
module Clustering
using ArrayViews
using Distances
using StatsBase
import Base: show
import StatsBase: IntegerVector, RealVector, RealMatrix, counts
export
# reexport from ArrayViews
view,
# reexport from StatsBase
sample, sample!,
# common
ClusteringResult,
... | innerlee/Clustering.jl | src/Clustering.jl | Julia | mit | 1,229 |
[RpcApi.SimpleOrganism(0x000000000002c460,:(function (o::Creature.Organism,)
local var_125::Bool = true
function func_96(var_95::String="CMsQ6J5t")
return var_95
end
local var_82::Int16 = -28253
function func_63(var_62::Int64=-5487471262987408691)
var_62 =... | tmptrash/jevo | store/stat/00-nb/2016-07-04 19.39/code.jl | Julia | mit | 32,179 |
function vcut(r::Float64, a::Float64, w::Float64, r0::Float64)
rcut = r0 + w
r < r0 ? 0. : a*exp(-w/(r - r0))/(r - rcut)^2
end
function vcut(r::AbstractVector{Float64}, a::Float64, w::Float64, r0::Float64)
Float64[vcut(r[i],a,w,r0) for i in 1:length(r)]
end
function findr0{T}(u ::AbstractVector{Fl... | johncsnyder/Element.jl | src/naobasis.jl | Julia | mit | 8,343 |
using Distributions
using JSON
a = 0
b = 1
d = Uniform( a,b )
x = linspace( .5, -100, 100 )
dmgf(t) = mgf(d, t )
y = map( dmgf, x )
println( y )
data = Dict([
("a", a),
("b", b),
("data", x),
("expected", y)
])
outfile = open("./test/fixtures/accessor.json", "w")
JSON.json(data)
write( outfile, JSON.json(data... | distributions-io/uniform-mgf | test/fixtures/test.accessor.jl | Julia | mit | 324 |
#############################################################################
# SCS.jl
# Wrapper around the SCS solver https://github.com/cvxgrp/scs
# See https://github.com/karanveerm/SCS.jl/
#############################################################################
# SCSSolverInterface.jl
# MathProgBase.jl interfa... | yuyichao/SCS.jl | src/SCSSolverInterface.jl | Julia | mit | 17,353 |
##########################
# FunctionCell Interface #
##########################
"""
kmeans(k, d=Distances.Euclidean() [;kwargs])
Constructs an untrained cell that when piped data inside, clusters the data using the
k-means algorithm where `k` is the desired number of clusters and `d` is the distance
that will be us... | zgornel/j4pr.jl | src/lib/ext/kmeans.jl | Julia | mit | 5,859 |
using RLESUtils, RunUtils, IFTTTUtils, FileUtils
const COMP = gethostname()
const DATA = "youtube8_test"
const I_START = 1
const I_END = 20
template_ge(i) =
"""
using GrammarExpts,Auslan_GE_Tree,RLESUtils,IFTTTUtils
auslan_ge_tree(;seed=$i, outdir=Pkg.dir("GrammarExpts/results/Auslan_GE_Tree_$DATA/seed$i"))
"""
no... | rcnlee/GrammarExpts.jl | modules/Auslan_GE_Tree/src/script.jl | Julia | apache-2.0 | 944 |
function _field_as_vector_space(K::NumField, Q::FlintRationalField)
BLoverK = absolute_basis(K)
d = absolute_degree(K)
m = identity_matrix(Q, d)
return BLoverK, m
end
function _field_as_vector_space(K::NfRel{nf_elem}, Q::AnticNumberField)
BLoverK = basis(K)
d = degree(K)
m = identity_matrix(Q, d)
retur... | thofma/hecke | src/Misc/Fields.jl | Julia | bsd-2-clause | 3,600 |
"""
Basic discrete univariate parameter state type
# Constructors
## BasicDiscUnvParameterState{NI<:Integer, NR<:Real}(value::NI, <optional arguments>)
Construct a basic discrete univariate parameter state with some ``value``.
### Optional arguments:
* ``diagnostickeys::Vector{Symbol}=Symbol[]``: the diagnostic ke... | JuliaStats/MCMC.jl | src/states/ParameterStates/BasicDiscUnvParameterState.jl | Julia | mit | 2,275 |
using Printf
using LinearAlgebra
using Random
include("PWGrid_v04.jl")
include("read_kpts.jl")
include("../common/gen_lattice.jl")
function test_main()
LatConst = 10.
LatVecs = gen_lattice_hexagonal( LatConst )
ecutwfc_Ry = 20.0
kpts_red = read_kpts("KPATH_HCP_60")
pw = PWGrid( ecutwfc_Ry*0.5, La... | f-fathurrahman/ffr-ElectronicStructure.jl | PW/pwgrid_04/main.jl | Julia | mit | 762 |
# #############################################################################
# #############################################################################
#Julia wrappers for C solvers, and ray solver
#This file contains the Julia wrappers and functions for running the internal solvers written in C (using the GSL... | amyascwk/CavChaos.jl | src/ray_solver.jl | Julia | mit | 6,699 |
# This file is auto-generated by AWSMetadata.jl
using AWS
using AWS.AWSServices: chime_sdk_messaging
using AWS.Compat
using AWS.UUIDs
"""
associate_channel_flow(channel_flow_arn, channel_arn, x-amz-chime-bearer)
associate_channel_flow(channel_flow_arn, channel_arn, x-amz-chime-bearer, params::Dict{String,<:Any... | JuliaCloud/AWS.jl | src/services/chime_sdk_messaging.jl | Julia | mit | 82,960 |
using Distributions
using JSON
n = 8
p = 0.2
d = Binomial( n,p )
x = linspace( -2, 2, 80 )
dmgf(t) = mgf(d, t )
y = map( dmgf, x )
println( y )
data = Dict([
("n", n),
("p", p),
("data", x),
("expected", y)
])
outfile = open("./test/fixtures/deepset.json", "w")
JSON.json(data)
write( outfile, JSON.json(data) ... | distributions-io/binomial-mgf | test/fixtures/test.deepset.jl | Julia | mit | 322 |
function differentiate_traces(d;dt=0.001,pow=-2,rot=0)
nt = size(d,1)
D = fft(d,1)
dw = 2.*pi/nt/dt
nw = Int(nt/2) + 1
eps = pow < 0 ? 10.0 : 0.0
for iw=1:nw
D[iw,:] *= exp(rot*1im)*((iw*dw) + eps)^pow
end
# symmetries
for iw=nw+1:nt
D[iw,:] = conj(D[nt-iw+2,:])
end
d = real(ifft(D,1))
return d
end
f... | JuliaPackageMirrors/Seismic.jl | src/Processing/SeisDiff.jl | Julia | mit | 607 |
"""
returns Core-type relperms for gas and liquid as a
function of the liquid saturation and their derivatives
with respect to the liquid saturation; it also returns
the stars model for the gas relperm in presence of foam.
inputs [unit] \\(default):
+ swc [-] \\(0.1)
+ sgr [-] \\(0.05)
+ krg0 [-] \\(0.9)
+ ... | simulkade/peteng | BL/BL_analytical.jl | Julia | mit | 8,400 |
using ConstantQ
using Base.Test
import ConstantQ: rawdata, _speckernel, _tempkernel, Frequency
import DSP: hamming, hanning
immutable DummyFrequency <: Frequency
end
let
freq = DummyFrequency()
@test_throws Exception nfreqs(freq)
@test_throws Exception freqs(freq)
end
let
GeometricFrequency(60, 61)
... | r9y9/ConstantQ.jl | test/runtests.jl | Julia | mit | 5,151 |
#=
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 | test/test_alias_2.jl | Julia | bsd-2-clause | 2,365 |
module Hydna
using HTTPClient.HTTPC
export
SendOptions,
EmitOptions,
send,
emit
type SendOptions
blocking::Bool
timeout::Float64
priority::Int8
SendOptions(; blocking=true,
timeout=0.0,
priority=0)=new(blocking, timeout, priority)
end
type Em... | jfd/Hydna.jl | src/Hydna.jl | Julia | bsd-2-clause | 2,476 |
# This file is auto-generated by AWSMetadata.jl
using AWS
using AWS.AWSServices: neptune
using AWS.Compat
using AWS.UUIDs
"""
add_role_to_dbcluster(dbcluster_identifier, role_arn)
add_role_to_dbcluster(dbcluster_identifier, role_arn, params::Dict{String,<:Any})
Associates an Identity and Access Management (IA... | JuliaCloud/AWS.jl | src/services/neptune.jl | Julia | mit | 166,354 |
# Gated-Feedback LSTM
type GFLSTMLayer # a single layer of a multi-layer RNN
# cell's input gate params
wix::NNMatrix
wih::NNMatrix
bi::NNMatrix
# cell's forget gate parameters
wfx::NNMatrix
wfh::NNMatrix
bf::NNMatrix
# cell's out gate parameters
... | zxsted/RecurrentNN.jl | src/gflstm.jl | Julia | mit | 7,372 |
module BadExpressions
using JuMP, BARON, Test
@testset "UnrecognizedExpressionException" begin
exception = BARON.UnrecognizedExpressionException("comparison", :(sin(x[1])))
buf = IOBuffer()
Base.showerror(buf, exception)
@test occursin("sin(x[1])", String(take!(buf)))
end
@testset "Trig unrecognized"... | joehuchette/BARON.jl | test/bad_expressions.jl | Julia | mit | 571 |
@inbounds for i = ix:ix-1+n
x[i] = $op( y[i], z[i] )
end
| JuliaPackageMirrors/FastArrayOps.jl | src/templates/arr2yz_foroop_inc1ieq.jl | Julia | mit | 62 |
include("xgboost_wrapper_h.jl")
using Compat
# TODO: Use reference instead of array for length
type DMatrix
handle::Ptr{Void}
_set_info::Function
function _setinfo{T<:Number}(ptr::Ptr{Void}, name::ASCIIString, array::Array{T, 1})
if name == "label" || name == "weight" || name == "base_margin"
... | LiaoPan/XGBoost.jl | src/xgboost_lib.jl | Julia | mit | 9,998 |
include("./artificial_data.jl")
using Distributions
using CellwiseEditingDifferentiation
using Lora
### Targets
hyperpars = Dict{Symbol, Any}(:λ=>fill(10.0, nsites))
prior = Dict{Symbol, Any}(:v=>Function[(m::Float64, v::Float64, a::Float64, b::Float64)->
vpcprior(m, v, a, b, hyperpars[:λ]... | scidom/CellwiseEditingDifferentiation.jl | examples/artificial_data/tmp/mcmc.jl | Julia | mit | 2,653 |
abstract Matrix
type LowRankMatrix{T<:Number} <: Matrix
## a rank-1 matrix type
# A = u*v'
# m is size of matrix
U::Array{T, 2}
V::Array{T, 2}
n::Int64
m::Int64
k::Int64
end
function LowRankMatrix{T<:Number}(U::Array{T, 2}, V::Array{T, 2})
@assert size(U)[2] == size(V)[1] # we're o... | Forgotten/PLR_Matrices | src/LowRankMatrices.jl | Julia | mit | 1,775 |
module Lorentz
using Vector2d
using Docile
#using ImmutableArrays
#import Base.convert
export run_Lorentz_gas
export run_many_particles
export Particle, Disc, collision_time, Plane
type Particle
x::Vector2D
v::Vector2D
end
immutable Disc
centre::Vector2D
radius::Float64
end
@doc """Compute *t... | dpsanders/BilliardModels.jl | src/FastLorentz.jl | Julia | mit | 11,618 |
"""
benchmark(pkg, baseline, candidate="HEAD") -> Tuple{BenchmarkGroup,BenchmarkGroup}
Runs the package benchmarks for the Git revisions `baseline` and `candidate` and returns the
results. Package are expected to have a "bench/benchmarks.jl" file which returns the
benchmark suite.
"""
function benchmark(pkg::Abstr... | invenia/PkgBenchmarks.jl | src/pkg.jl | Julia | mit | 1,617 |
using FactCheck, Images, Colors, FixedPointNumbers
facts("IO") do
workdir = joinpath(tempdir(), "Images")
if !isdir(workdir)
mkdir(workdir)
end
context("Gray png") do
a = rand(2,2)
aa = convert(Array{Ufixed8}, a)
fn = joinpath(workdir, "2by2.png")
Images.imwrite... | benmoran/Images.jl | test/io.jl | Julia | mit | 5,032 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.