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
bigfib(n) = ((BigInt[1 1; 1 0])^n)[2,1] bigfib(20)
ihnorton/Gallium.jl
examples/testprograms/bigfib.jl
Julia
mit
51
module OCV using Cxx using FixedSizeArrays using GeometryTypes import Distances: euclidean import Base: convert include("../deps/deps.jl") const cv_headerpath = joinpath(dirname(opencv_core),"../include") function __init__() addHeaderDir(cv_headerpath, kind = C_System) ...
Keno/OCV.jl
src/OCV.jl
Julia
mit
2,045
module Issue34 using Interpolations, Base.Test A = rand(1:20, 100, 100) # In #34, this incantation throws itp = interpolate(A, BSpline(Quadratic(Flat)), OnCell) # Sanity check that not only don't throw, but actually interpolate for i in 1:size(A,1), j in 1:size(A,2) @test_approx_eq itp[i,j] A[i,j] end end
SloanLindsey/Interpolations.jl
test/issues/runtests.jl
Julia
mit
315
# Algorith integration rules # # References: # # - J. Berntsen, T.O. Espelid and A. Genz. "An adaptive algorithm for the # approximate calculation of multiple integrals". ACM Trans. Math. Soft., # 17, 437-451, 1991. # # - J. Berntsen and T.O. Espelid. "On the construction of higher degree # three-dimensional...
pabloferz/NIntegration.jl
src/rules.jl
Julia
mit
7,285
using jInv.InverseSolve export getHessian """ function H = getHessian(...) builds and returns Hessian matrix of misfit functions. Input: sig - model pMis - misfit param (supported: single, array of misfit params, remote references) d2F - Hessian of distance (supported: single, array, remote references) Out...
JuliaInv/jInv.jl
src/InverseSolve/getHessian.jl
Julia
mit
1,825
export SynthRule, Synthesizer, SynthesizerOptions, DecodeRule, define!, dnaSize!, resultSize!, decodeAsContextArray, decode, decodeAt abstract SynthRule typealias StateDict Dict{Symbol, Any} immutable DecodePars{C, A, S} ctx::C dnaFragment::A result::A resultSe...
unbornchikken/julia-ml-proto
genome/Synthesizer.jl
Julia
apache-2.0
4,186
module TestIO using Base.Test using DataFrames, Compat #test_group("We can read various file types.") data = joinpath(dirname(@__FILE__), "data") filenames = ["$data/blanklines/blanklines.csv", "$data/compressed/movies.csv.gz", "$data/newlines/embedded_os9.csv", ...
maximerischard/DataFrames.jl
test/io.jl
Julia
mit
10,916
### quadgk.jl # # Copyright (C) 2019 Mosè Giordano. # # Maintainer: Mosè Giordano <mose AT gnu DOT org> # Keywords: uncertainty, error propagation, physics # # This file is a part of Measurements.jl. # # License is MIT "Expat". # ### Commentary: # # This file integration with QuadGK.jl. # ### Code: # Helper functions ...
giordano/Measurements.jl
src/quadgk.jl
Julia
mit
2,492
# Library routines function agexp(r, x, y) ccall((:agexp, libSPTK), Cdouble, (Cdouble, Cdouble, Cdouble), r, x, y) end gexp(r, x) = ccall((:gexp, libSPTK), Cdouble, (Cdouble, Cdouble), r, x) glog(r, x) = ccall((:glog, libSPTK), Cdouble, (Cdouble, Cdouble), r, x) mseq() = ccall((:mseq, libSPTK), Cint, ()) # solv...
JuliaPackageMirrors/SPTK.jl
src/lib.jl
Julia
mit
2,349
module Graphics using Unitful import Unitful: Length, fm, pm, nm, μm, m, inch, ustrip import Cairo import Devices: bounds, layer, datatype using ..Points import ..Rectangles: Rectangle, width, height import ..Polygons: Polygon, points using ..Cells import FileIO: File, @format_str, load, save, stream # https://www.w...
ajkeller34/Devices.jl
src/backends/graphics.jl
Julia
mit
4,523
function lufac(a::Matrix{Float64}) upper = zeros(size(a)) upper[1,:] = a[1,:] lower = Matrix{Float64}(I, size(a,1), size(a,1)) n = size(a, 1) for k in 1:n-1 if abs(upper[k,k] > 1e-10) for i in k+1:n # L component for j in 1:i-1 total = 0.0 for l in 1:j-1 ...
goedman/NMfE.jl
src/nmlib/lufac.jl
Julia
mit
752
### Compute mean recursively given previous mean and new sample Base.mean!(lastmean::RealVector, k::Integer, x::RealVector) = (lastmean[:] = ((k-1)*lastmean+x)/k) Base.mean(s::VariableNState{Univariate}) = mean(s.value) Base.mean(s::VariableNState{Multivariate}, i::Integer) = mean(s.value[i, :]) Base.mean(s::Variab...
JuliaPackageMirrors/Lora.jl
src/stats/mean.jl
Julia
mit
407
#------------------------------------------------------------------- #* EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC. #* #* This LIBRARY is free software; you can distribute it and/or modify #* it under the therms of the ALSOC FREE LICENSE as available at #* http://www.enq.ufrgs.br/alsoc. #* #* EMSO Copyrig...
DANA-Laboratory/EMSOModelLibrary.jl
JuliaEMSOModels/streams/sink.jl
Julia
mit
4,242
# Julia wrapper for header: /usr/include/scip/cons_cumulative.h # Automatically generated using Clang.jl wrap_c function SCIPincludeConshdlrCumulative(scip) ccall((:SCIPincludeConshdlrCumulative, libscip), SCIP_RETCODE, (Ptr{SCIP_},), scip) end function SCIPcreateConsCumulative(scip, cons, name, nvars, vars, dur...
SCIP-Interfaces/SCIP.jl
src/wrapper/cons_cumulative.jl
Julia
mit
6,763
using Gadfly, DataFrames @doc """ PLOTDATA Plots the data points X and y into a new figure PLOTDATA(x,y) returns the layer of Gadfly, which plots the data points with blue color for the positive examples and yellow for the negative examples. X is assumed to be a Mx2 matrix. """ -> function plotData(X, y) ...
homuler/coursera-ml-julia
src/ex2/plotData.jl
Julia
mit
746
################################################################################ # # Lattice database # ################################################################################ export number_of_lattices, lattice_name, lattice, lattice_automorphism_group_order, lattice_database struct LatticeDB path:...
thofma/hecke
src/QuadForm/Database.jl
Julia
bsd-2-clause
12,620
using DSGE, ModelConstructors, Distributed using Nullables, DataFrames, OrderedCollections, Dates ############################# # To use: # Just run in the Julia REPL # include("run_default.jl") # Note that the estimation # step will take 2-3 hours. ############################# ############## # Model Setup #########...
FRBNY-DSGE/DSGE.jl
examples/run_default.jl
Julia
bsd-3-clause
3,304
# one-column version function op_H( LF, Potentials, v::Array{Float64,1} ) # V_loc = Potentials.Ionic + Potentials.Hartree + Potentials.XC # return -0.5*op_nabla2( LF, v ) + V_loc .* v end # multi-column version function op_H( LF, Potentials, v::Array{Float64,2} ) # Npoints = size(v)[1] Ncol...
f-fathurrahman/ffr-ElectronicStructure.jl
LF/dft_3d_p_v2/op_H.jl
Julia
mit
1,200
isdefined(:OptionsMod) || @eval import Options using OptionsMod using Base.Test # basic functionality oo = Options(:a, true, :b, 7) @test length(oo.key2index) == 2 @test oo[:a] == true @test oo[:b] > 6 @test oo[:c] == nothing @test sprint(show, oo) == "a = true, b = 7 ($CheckError)" # other constructors oo2 = Options...
JuliaLang/Options.jl
test/runtests.jl
Julia
mit
1,662
#Is this usable data? function isconcrete{T<:Number}(x::T) !isna(x) && isfinite(x) end function isconcrete(x::MathConst) return true end function isconcrete(x) !isna(x) end function hasna(xs) return false end function hasna(xs::AbstractDataArray) for x in xs if isna(x) re...
Roger-luo/Gadfly.jl
src/misc.jl
Julia
mit
13,189
## User should just use TransferFunction immutable SisoRational <: SisoTf num::Poly{Float64} den::Poly{Float64} function SisoRational(num::Poly{Float64}, den::Poly{Float64}) if all(den == zero(den)) error("Zero denominator") elseif all(num == zero(num)) # The numerato...
JuliaPackageMirrors/ControlSystems.jl
src/types/sisotf.jl
Julia
mit
3,912
function my_handler(myendpoints::Dict{Int64,Array{NamedTuple{(:route, :toexec, :urlparams),Tuple{Union{String,Regex},Function,Union{Nothing,Dict{Int64,String}}}},1}},tonumber::Dict{String,Char},formats::Dict{String,Function},cleanurl::Function,constantheaders::Array{Pair{String,String},1}) function myqueryparams(inp...
codeneomatrix/Merly.jl
src/core.jl
Julia
mit
3,941
using Conda using Compat using PyCall backend = "theano" try keras = pyimport("keras") if VersionNumber(keras[:__version__]) >= v"2.0.2" Compat.@info("Using Keras $(keras[:__version__]) -> $(keras[:__path__])") global backend = keras[:backend][:backend]() else Compat.@error("Invali...
invenia/Keras.jl
deps/build.jl
Julia
mit
1,333
include("helpers/listing.jl") hello_str = "\"Hello, World\"" isinstalled(pkg) = try Pkg.installed(pkg) != nothing catch e false end md_str = """ md\"\"\" ## This is a heading *italic*, **bold** and `monospace`. - one - two - three Code: ```julia function foo() 42 end foo() ``` \"\"\" """ function main(windo...
JuliaPackageMirrors/Escher.jl
examples/user-guide/content.jl
Julia
mit
2,835
module EMLPIDs using DanaTypes using DotPlusInheritance using Reexport @reexport using ...types.EMLtypes import EMLtypes.length include("PIDs/PID.jl") include("PIDs/FirstOrder.jl") include("PIDs/StepSignal.jl") include("PIDs/ConstantSignal.jl") end
DANA-Laboratory/EMSOModelLibrary.jl
JuliaEMSOModels/controllers/PIDs.jl
Julia
mit
257
# curly A{a,b...} in the context of *using* a parametric type # declaring a parametric function or parametric type are separately # considered in lintfunction and linttype, respectively. function lintcurly( ex::Expr, ctx::LintContext ) if ex.args[1] == :Ptr && length(ex.args)==2 && ex.args[2] == :Void ret...
tkelman/Lint.jl
src/curly.jl
Julia
mit
1,190
## Penn Treebank PTB_LOCATION = joinpath(homedir(), "TREEBANK_3") function wsj_section_path(sec::Int) if sec < 0 || sec > 24 error("section num must be between 0 and 24") end joinpath(PTB_LOCATION, "parsed", "mrg", "wsj", @sprintf("%02d", sec)) end function wsj_trees(sec::Int, recursive=true) ...
dellison/CompLing.jl
src/corpus/ptb.jl
Julia
mit
741
#!/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/invgamma/cdf/test/fixtures/julia/runner.jl
Julia
apache-2.0
2,224
const _pkg_root = dirname(dirname(@__FILE__)) const _pkg_assets = joinpath(_pkg_root,"assets") !isdir(_pkg_assets) && mkdir(_pkg_assets) deps = [ "https://cdn.jsdelivr.net/gh/piever/InteractResources@0.4.0/bulma/main.min.css" => "bulma.min.css", "https://cdn.jsdelivr.net/gh/piever/InteractResources@0.4.0/bulm...
JuliaLang/Interact.jl
deps/build.jl
Julia
mit
452
""" distance(tree::Tree, node1::Int64, node2::Int64) Distance between two `Node`s on a `Tree` """ function distance(tree::Tree, node1::Int64, node2::Int64) path = branchpath(tree, node1, node2) dist = 0. for i in path dist += tree.branches[i].length end...
jangevaare/Phylogenetics.jl
src/distance.jl
Julia
mit
835
using JuMP function is_approx_integer(x::Float64) return abs(x - round(x)) < 1e-8 end function realize(tbl::Table, drawctx::ParentDrawContext) model = Model() m, n = size(tbl.children) abswidth = drawctx.box.width absheight = drawctx.box.height c_indexes = @compat Tuple{Int, Int, Int}[] ...
rened/Compose.jl
src/table-jump.jl
Julia
mit
6,176
# Julia wrapper for header: /usr/local/ffmpeg/2.4/include/libavutil/hash.h # Automatically generated using Clang.jl wrap_c, version 0.0.0 export av_hash_alloc, av_hash_names, av_hash_get_name, av_hash_get_size, av_hash_init, av_hash_update, av_hash_final, av_hash_final_bin, av_hash...
Keno/VideoIO.jl
src/ffmpeg/AVUtil/v54/hash.jl
Julia
mit
1,749
module TestGemv using ParallelAccelerator @acc gemv_t(A,y) = A*y @acc gemv_t2(A,y) = A'*y function test() A = [1. 2. 3.; 4. 5. 6.] y = [1.,2.,3.] y2 = [1.,2.] z = gemv_t(A,y) return z end function test2() A = [1. 2. 3.; 4. 5. 6.] y = [1.,2.] z = gemv_t2(A,y) return z end end usi...
malekbr/julia-to-tiramisu
test/gemv_test.jl
Julia
bsd-2-clause
486
module ClusterManagers export launch, manage, kill, init_worker, connect import Base: launch, manage, kill, init_worker, connect if VERSION >= v"0.5.0-dev+4047" worker_arg = `--worker $(Base.cluster_cookie())` else worker_arg = `--worker` end # PBS doesn't have the same semantics as SGE wrt to file accumulat...
JuliaPackageMirrors/ClusterManagers.jl
src/ClusterManagers.jl
Julia
mit
476
using MATLAB using Test include("engine.jl") include("matfile.jl") include("matstr.jl") include("mxarray.jl")
JuliaLang/MATLAB.jl
test/runtests.jl
Julia
mit
111
@testset "minres_qlp" begin minres_qlp_tol = 1.0e-6 for FC in (Float64,) @testset "Data Type: $FC" begin # Cubic spline matrix. A, b = symmetric_definite(FC=FC) (x, stats) = minres_qlp(A, b) r = b - A * x resid = norm(r) / norm(b) @test(resid ≤ minres_qlp_tol) @test(s...
JuliaOptimizers/Krylov.jl
test/test_minres_qlp.jl
Julia
mit
2,219
import Base: >>> export bubble, stopbubbling, addinterpreter, constant, pairwith, sampler, plugsampler, trigger!, watch!, subscribe #= Note: Maybe use immutable MessageException <: Exception error::Exception backtrace::String end ...
pabloferz/Escher.jl
src/basics/signal.jl
Julia
mit
9,509
#!/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/frechet/entropy/test/fixtures/julia/runner.jl
Julia
apache-2.0
1,740
# # The type of the query output. # # Output cardinality. immutable OutputMode optional::Bool plural::Bool end OutputMode() = OutputMode(false, false) setoptional(omode::OutputMode, optional::Bool=true) = OutputMode(optional, omode.plural) setplural(omode::OutputMode, plural::Bool=true) = OutputMode...
rbt-lang/rbt-proto
jlnext/src/type/output.jl
Julia
apache-2.0
3,029
using Base.Meta """ Finds ISPC kernels in `func`, extracts them, and replaces them with calls to the compiled ISPC functions. """ function make_ispc_main(func::Expr) substitute(func) do expr if isa(expr, Expr) && expr.head == :call func = expr.args[1] if func == GlobalRef(ISPC, :is...
damiendr/ISPC.jl
src/extract.jl
Julia
apache-2.0
3,260
using ParallelAccelerator @acc function kmeans() numCenter = 5 iterNum = 30 points = rand(20,10000) D,N = size(points) # number of features, instances centroids = rand(D, numCenter) for l in 1:iterNum dist :: Array{Array{Float64,1},1} = [ Float64[sqrt(sum((points[:,i].-centroids[:,j])....
malekbr/julia-to-tiramisu
examples/tiramisu/kmeans.jl
Julia
bsd-2-clause
1,133
const BigFloats = Union{BigFloat,Complex{BigFloat}} function fft(x::AbstractVector{F}) where F<:Fun n,T = length(x),mapreduce(eltype,promote_type,x) if ispow2(n) return fft_pow2(x) end ks = range(zero(real(T)),stop=n-one(real(T)),length=n) Wks = exp(-im*convert(T,π)*ks.^2/n) xq,wq = x.*Wks,conj([ex...
ApproxFun/ApproxFun.jl
src/Extras/fftGeneric.jl
Julia
bsd-3-clause
5,804
using OffsetArrays # # #=========================================================================# function bc1(meqn::Int, mbc::Int, mx::Int, xlower::Float64, dx::Float64, q::OffsetArray{Float64,2}, maux::Int, aux::OffsetArray{Float64,2}, t::Float64, dt::Float64, mthbc::Array{Int,1}) #=======...
alsam/jlclaw
src/acoustics_1d_example1/bc1.jl
Julia
mit
2,919
using Mimi @defcomp grosseconomy begin regions = Index() #Note that a regional index is defined here YGROSS = Variable(index=[time, regions]) #Gross output K = Variable(index=[time, regions]) #Capital l = Parameter(index=[time, regions]) #Labor tfp =...
JuliaPackageMirrors/Mimi.jl
examples/tutorial/02-two-region-model/gross_economy.jl
Julia
mit
1,319
using StructJuMP, JuMP using StructJuMPSolverInterface include("select_solver.jl") ############# # A sample model ############# scen = 1 m = StructuredModel(num_scenarios=scen) @variable(m, -100<=x[1:4]<=100) @NLobjective(m, Min, 0.1*x[1]^2 + 0.2*x[2]^2 + 0.3*x[3]^2 + 0.4*x[4]^2 + + 1.1*x[1]*x[2] + 2.1*x[1]*x[3]...
joehuchette/StructJuMP.jl
examples/pips/parmodel_eqieq.jl
Julia
mit
2,119
module XmlToDict using LightXML using DataStructures export xmlparse_string, @x2d_str, XmlDictAccessor, getindex function handle_node(xelem:: XMLElement; strip_text=true, wrapper_text=false) elem = OrderedDict{String,Any}() for a in attributes(xelem) elem["@"*name(a)] = value(a) end ...
elcritch/XmlToDict.jl
src/XmlToDict.jl
Julia
mit
1,992
function op_V_loc( pw::PWGrid, V_loc, psi::Array{ComplexF64,2} ) # Ns = pw.Ns Ω = pw.Ω Npoints = prod(Ns) Ncols = size(psi)[2] ctmp = zeros(ComplexF64, Npoints, Ncols) idx = pw.gvecw.idx_gw2r for ic = 1:Ncols ctmp[idx,ic] = psi[:,ic] end # get values of psi in real s...
f-fathurrahman/ffr-ElectronicStructure.jl
PW/dft_02/op_V_loc.jl
Julia
mit
1,157
# syntax: proto3 using Compat using ProtoBuf import ProtoBuf.meta import Base: hash, isequal, == type __enum_NullValue <: ProtoEnum NULL_VALUE::Int32 __enum_NullValue() = new(0) end #type __enum_NullValue const NullValue = __enum_NullValue() type Struct fields::Dict{AbstractString,Any} # map entry Str...
JuliaPackageMirrors/ProtoBuf.jl
src/google/struct_pb.jl
Julia
mit
2,346
facts("constructors") do ticker_str = "TICKER" # context("inner constructor from TimeArray") do # fts = FinancialSeries.FinancialTimeSeries( # ohlc, FinancialSeries.Stock(FinancialSeries.Ticker(ticker_str))) # @fact values(fts.series["Open"])[1] => roughly(104.88) # end # context("from TimeArray c...
JuliaQuant/FinancialSeries.jl
test/financialtimeseries.jl
Julia
mit
2,263
using LibBSON, Mongo, Base.Test @testset "Mongo" begin client = MongoClient() collection = MongoCollection(client, "foo", "bar") oid = BSONOID() @testset "variables" begin @test collection.client == client @test collection.db == "foo" @test collection.name == "bar" end @tes...
pzion/Mongo.jl
test/runtests.jl
Julia
bsd-2-clause
2,927
using SparseArrays function sparserecttest(lib::Polyhedra.Library) # Sparse H-representation, cartesian product # -1 ≤ x_1 ≤ 1 # 2 ≤ x_2 ≤ 3 h1 = HalfSpace(sparsevec([1], [ 1]), 1) ∩ HalfSpace(sparsevec([1], [-1]), 1) h2 = HalfSpace(sparsevec([1], [ 1]), 3) ∩ HalfSpace(sparseve...
blegat/Polyhedra.jl
test/sparserect.jl
Julia
mit
819
using Contour using Base.Test include("verify_vertices.jl")
tkelman/Contour.jl
test/runtests.jl
Julia
mit
61
const MACHEP = 1.2e-16 const DWARF = 1.0e-38 function jacFcnDefault!(m::Int, n::Int, x::Vector{Float64}, fvec::Vector{Float64}, fjac::Matrix{Float64}, eps_::Float64, wa::Vector{Float64}, fcn!::Function) for j = 1:n temp = x[j] step = max(eps_ * eps_, eps_ * abs(temp)) x[j] += step fcn!(m, n, x, wa) ...
pazzo83/JQuantLib
src/math/lmdif2.jl
Julia
mit
10,783
using PairwiseListMatrices using Base.Test print(""" Test PairwiseListMatrices ======================= """) let list = [1,-2,3], list_diag_triu = [ 1 -2 0 3 ], list_diag_tril = [ 1 0 -2 3 ], list_triu = [ 0 1 -2 0 0 3 0 ...
Elin-/PairwiseListMatrices.jl
test/runtests.jl
Julia
mit
10,093
module HDFSBlobs using Blobs using Elly import Base: open import Blobs: @logmsg, open, load, save, locality export open, locality, load, save, HDFSBlobIO immutable HDFSBlobIO{T} <: BlobIO{T} uri::AbstractString # the HDFS URI prefix with server credentials and location (e.g.: "hdfs://userid@localhost:9000") e...
tanmaykm/Blobs.jl
examples/hdfs_fileio.jl
Julia
mit
3,657
linear(x::Vector, y::Vector) = (x' * y)[1] polynomial(x::Vector, y::Vector, d::Real) = (x' * y + 1)[1] ^ d laplacian(x::Vector, y::Vector, sigma::Real) = exp(-norm(x - y) / sigma ^ 2) rbf(x::Vector, y::Vector, sigma::Real) = exp(-norm(x - y, 1) / sigma ^ 2)
remusao/KSVM.jl
src/kernel.jl
Julia
mit
259
#!/usr/bin/julia println( sum(filter( x -> (x % 3 == 0) || (x % 5 == 0), 1:999 ) ) )
HackspaceJena/project-euler
e0001/euler0001.jl
Julia
mit
126
function numericRoot(residFnc::Function, measurement, parameters, x0::Vector{Float64}) return (nlsolve( (res, X) -> residFnc(res, measurement, parameters, X), x0 )).zero end function shuffleXAltD(X::Vector{Float64}, Alt::Vector{Float64}, d::Int, p::Vector{Int}) # n = length(X) Y = deepcopy(Alt) for i in...
dehann/IncrementalInference.jl
src/SolverUtilities.jl
Julia
mit
7,762
function surf(gr::Graph, z::Array{cmgl.Float, 2}; stl::String="", opt::String="") cmgl.surf(gr.ptr, Data(z).ptr, stl, opt) end function surf(gr::Graph, x::Array{cmgl.Float}, y::Array{cmgl.Float}, z::Array{cmgl.Float, 2}; stl::String="", opt::String="") cmgl.surf_xy(gr.ptr, Data(x).ptr, Data(y).ptr, Data(z).p...
thomastaudt/MathGL.jl
src/2dplot.jl
Julia
mit
8,799
using PureSeq using Base.Test ## BamReader # test forward reads reader = BamReader("data/small.bam", :forward, ReferenceContigs_hg38) @test position(reader) == 10544 advance!(reader) @test position(reader) == 11247 close(reader) # test reverse reads reader = BamReader("data/small.bam", :reverse, ReferenceContigs_hg...
slundberg/PureSeq.jl
test/runtests.jl
Julia
mit
3,499
# represents s*log(ε) + c as ε -> 0 struct LogNumber <: Number s::ComplexF64 c::ComplexF64 end @inline logpart(z::Number) = zero(z) @inline finitepart(z::Number) = z @inline logpart(l::LogNumber) = l.s @inline finitepart(l::LogNumber) = l.c Base.promote_rule(::Type{LogNumber}, ::Type{<:Number}) = LogNumb...
ApproxFun/RiemannHilbert.jl
src/LogNumber.jl
Julia
mit
4,550
# And 2xN matrix of N landmark xy positions as variable nodes in factor graph function addSimMapFG!(fg::FactorGraph, lms::Array{Float64,2}) for i in 1:size(lms,2) newLandm!(fg,string('l',i), vectoarr2(lms[:,i]), 0.001*eye(2)) end nothing end # assume all the landmarks are already loaded into the Gro...
dehann/RoME.jl
src/SimulationUtils.jl
Julia
mit
1,803
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 =...
JuliaPackageMirrors/ParallelAccelerator.jl
test/test_lda_evaluate.jl
Julia
bsd-2-clause
406
# 24x3 array data = [ 0.837698 0.49452 2.54352 -0.294096 -0.39636 0.728619 -1.62089 -0.44919 1.20592 -1.06458 -0.68214 -1.12841 2.14341 0.7309 0.644968 -0.284139 -1.133 1.98615 1.19879 2.55633 -0.526461 -0.032277 0.11701 -0.24...
tinybike/JointMoments.jl
test/data.jl
Julia
mit
13,772
# Hicks-Moorsteen-Bjurek (HMB) total factor productivity index as defined in Bjurek (SJE, 1996) immutable HMB{S<:AbstractDataEnvelopment,T<:RS} In0::Union{FDH,DEA} In1::Union{FDH,DEA} Out0::Union{FDH,DEA} Out1::Union{FDH,DEA} K::Int64 function HMB{S,T}(X0::Array,Y0::Array,X1::Array,Y1::Array) where {S<:Abs...
kepiej/NEPA
src/HMB.jl
Julia
mit
1,993
using Gurobi function print_help() println(""" Usage perf.jl [arg] [name] [arg] --new Begin a new benchmark comparison --compare Run another benchmark and compare to existing [name] A name for the benchmark test Examples git checkout master ...
JuliaOpt/Gurobi.jl
perf/perf.jl
Julia
mit
1,106
""" sphtriangulate(cmd0::String="", arg1=nothing, kwargs...) Delaunay or Voronoi construction of spherical lon,lat data Full option list at [`sphtriangulate`]($(GMTdoc)sphtriangulate .html) Parameters ---------- - **A** | **area** :: [Type => Bool] Compute the area of the spherical triangles (Qd) or polygons ...
joa-quim/GMT.jl
src/sphtriangulate.jl
Julia
mit
2,311
import MathOptInterface const MOI = MathOptInterface const MOIU = MOI.Utilities import MathProgBase const MPB = MathProgBase.SolverInterface MOIU.@model( Model, (MOI.ZeroOne, MOI.Integer), (MOI.EqualTo, MOI.GreaterThan, MOI.LessThan, MOI.Interval), (), (), (), (MOI.ScalarAffineFunction, MO...
JuliaOpt/AmplNLWriter.jl
src/MOI_wrapper.jl
Julia
mit
15,727
module Corpus include("ngrams.jl") #include("words.jl") include("letters.jl") include("cli.jl") export cli # function cli(args) Cli.run(args) end end
openbohemians/corpus-julia
src/Corpus.jl
Julia
apache-2.0
173
typealias Float Float64 const gPDEDiffEst = 1e-6 const gPDEBdyReflect = true const gJDiffEst = 1e-5 const gOptTol = 1e-5 const gOptNMax = 15 const gOptNSubMax = 100 const gOptAbsErrTest = false const gOptShowTrace = true const gOptStoreTrace = true const gSetVerbose = true macro lintpragma( s ) end
jgoldfar/isp-julia-mwe
src/globSettings.jl
Julia
apache-2.0
304
################################################################################ # # Free part of the unit group # ################################################################################ @doc Markdown.doc""" regulator(x::Array{T, 1}, abs_tol::Int) -> arb Compute the regulator $r$ of the elements in $x$,...
thofma/hecke
src/NfOrd/Unit/Regulator.jl
Julia
bsd-2-clause
1,123
using FANN using Base.Test net = ANN([1, 1, 1], [:sigmoid_symmetric, :linear], b=0.1, errorfunc=:linear) nw = FANN.nweights(net) @test nw == 4 FANN.weights!(net, Float64[1, 2, 3, 4]) w = FANN.weights(net) @test w == Float64[1, 2, 3, 4]
gasagna/FANN.jl
test/test-getset-weights.jl
Julia
bsd-3-clause
239
compiler_env, script, output, base_sysimage = ARGS if VERSION < v"0.7-" error("Unsupported Julia version $VERSION") end const Pkg = Base.require(Base.PkgId(Base.UUID("44cfe95a-1eb2-52ea-b672-e2afdf69b78f"), "Pkg")) Pkg.activate(compiler_env) @info "Loading PackageCompiler..." using PackageCompiler @info "In...
JuliaLang/pyjulia
src/julia/compile.jl
Julia
mit
2,803
abstract Shape{T} <: FieldVector{T} immutable Cube{T} <: Shape{T} a::T end immutable Sphere{T} <: Shape{T} r::T end immutable SphericalCap{T} <: Shape{T} a::T c::T function SphericalCap(a, c) if a < 0 || c ≤ 0 throw(ArgumentError("All lengths should be positive.")) end...
pabloferz/GeometricTransforms.jl
src/geomtypes-0.5.jl
Julia
mit
2,986
@doc """ PROJECTDATA Computes the reduced data representation when projecting only on to the top k eigenvectors Z = projectData(X, U, K) computes the projection of the normalized inputs X into the reduced dimensional space spanned by the first K columns of U. It returns the projected examples in Z....
homuler/coursera-ml-julia
src/ex7/projectData.jl
Julia
mit
961
using AHN using Base.Test using Compat include("atomic_tests.jl")
Ismael-VC/AHN.jl
test/runtests.jl
Julia
mit
68
#! /usr/bin/julia # Rosetta Code, Terminal control/Coloured text using AnsiColor function showbasecolors() for color in keys(Base.text_colors) print_with_color(color, " ", string(color), " ") end println() end function showansicolors() for fore in keys(AnsiColor.COLORS) print(@sprint...
MichaeLeroy/rosetta-code
julia/completed/terminal_control_color.jl
Julia
mit
857
#!/usr/bin/env julia # Lets add workers programatically, and see if they distribute to different cores. p = nworkers() println("Workers allocated ", p) println("Total workers ", workers()) println("Total processes ", nprocs()) @everywhere function print_cpus() run(`ps -eo pid,psr,pcpu,cmd` |> `grep julia`) end ...
iancze/ParallelTest.jl
start_workers.jl
Julia
mit
530
export cg function cg{T1,T2}(A::SparseMatrixCSC{T1,Int},b::Array{T2,1}; kwargs...) x = zeros(promote_type(T1,T2),size(A,2)) # pre-allocate return cg(v -> At_mul_B!(1.0,A,v,0.0,x),b;kwargs...) # multiply with transpose of A for efficiency end cg(A,b::Vector;kwargs...) = cg(x -> A*x,b;kwargs...) """ x,flag,err,ite...
JuliaPackageMirrors/KrylovMethods.jl
src/cg.jl
Julia
mit
3,115
add_assert_scope(:ModLattice) @attributes mutable struct ModAlgAss{S, T, U} base_ring::S dim::Int isirreducible::Int # 0 not know # 1 true # 2 false degree_splitting_field::Int # same as above algebra::U action_of_gens::Vector{T} action_of_ba...
thofma/Hecke.jl
src/ModAlgAss/ModAlgAss.jl
Julia
bsd-2-clause
7,340
module Mongo include("../deps/deps.jl") using LibBSON import Base.show, Base.convert, Base.start, Base.next, Base.count, Base.find, Base.done ccall( (:mongoc_init, libmongoc), Void, () ) atexit() do ccall((:mongoc_cleanup, libmongoc), Void, ()) end typealias NakedDict Union{...
JuliaPackageMirrors/Mongo.jl
src/Mongo.jl
Julia
bsd-2-clause
440
module Lasso using Compat module Util # Extract fields from object into function locals # See https://github.com/JuliaLang/julia/issues/9755 macro extractfields(from, fields...) esc(Expr(:block, [:($(fields[i]) = $(from).$(fields[i])) for i = 1:length(fields)]...)) end export @extractfields ...
JuliaPackageMirrors/Lasso.jl
src/Lasso.jl
Julia
mit
11,417
@testset "Specific data structures" begin @testset "Timing" begin @testset "Basic case" begin date = DateTime(2017, 01, 01, 08) t = Timing(timeBeginning=date, timeHorizon=Day(2), timeStepDuration=Hour(1)) s = Shifts(t, date, Hour(8)) m = Model(solver=CbcSolver(logLevel=0)) hrm = Timi...
dourouc05/IndustrialProcessFlexibilisation.jl
test/model_ds.jl
Julia
mit
63,968
is_url_char(c) = ((@assert c < 0x80); 'A' <= c <= '~' || '$' <= c <= '>' || c == 12 || c == 9) is_mark(c) = (c == '-') || (c == '_') || (c == '.') || (c == '!') || (c == '~') || (c == '*') || (c == '\'') || (c == '(') || (c == ')') is_userinfo_char(c) = isalnum(c) || is_mark(c) || (c == '%') || (c == ';')...
tkelman/URIParser.jl
src/parser.jl
Julia
mit
10,854
# write your own tests here include("singlethreaded.jl")
JuliaPackageMirrors/ReadWriteLocks.jl
test/runtests.jl
Julia
mit
57
# Challenge Problem 4. # The functions below read in a DataFrame object and modify # the contents of one column based on whether or not a value # appears in a column of a different DataFrame. The current # performance can be improved considerably. Find a way to # improve the performance using one (or several) of the # ...
bcbi/julia_tutorials
performance_optim/problems4and5.jl
Julia
mit
2,319
# This is an implementation of the CMSA-ES as described in the paper: # H. Beyer and B. Sendhoff, "Covariance Matrix Adaptation Revisited – # the CMSA Evolution Strategy", 2008 # #type CMSA_ES <: PopulationOptimizer # decomposer::Function # Function that decomposes covar matrix into sqrtC # # # Constants that w...
JuliaPackageMirrors/BlackBoxOptim.jl
spikes/covar_matrix_self_adaptation_es.jl
Julia
mit
10,246
function modifier(ability) return floor((ability - 10) / 2) end function ability() return rand(3:18) end mutable struct DNDCharacter strength::Int dexterity::Int constitution::Int intelligence::Int wisdom::Int charisma::Int hitpoints::Int end function DNDCharacter() strength =...
exercism/xjulia
exercises/practice/dnd-character/.meta/example.jl
Julia
mit
677
# Challenge Problem 4. # You are given 100,000-by-20,000 a matrix, `A`, and your task is # to compute the means, standard deviations, and variances of each # column in the matrix. The code below accomplishes this, but # can be optimize in a few ways. # # The code's current run time is about 4 minutes # on an Intel(R) C...
bcbi/julia_tutorials
performance_optim/probs4_5_6.jl
Julia
mit
4,078
using NumericalMethodsforEngineers, Test a = [0. 0. 16.; 0. 4. 5.; 8. -4. 22.] b = Float64[4, 2, 5] c = a \ b c |> display println("\nCholesky factorization using banded storage\n") println("Banded Coefficient Matrix:") a |> display println("\nRight Hand side:") b |> display cholin!(a) println("\nL in Band Form:")...
goedman/NMfE.jl
examples/ch02/f-02-04.jl
Julia
mit
392
using JuliaFEM, LinearAlgebra, Test datadir = first(splitext(basename(@__FILE__))) @testset "Test that mesh coloring provides a good coloring" fn = joinpath(datadir, "cube_tet4.inp") mesh = JuliaFEM.Mesh(open(parse_abaqus, fn)) coloring = JuliaFEM.create_coloring(mesh) for colors in coloring ...
JuliaFEM/JuliaFEM.jl
test/test_mesh_coloring.jl
Julia
mit
591
#White Noise kernel @doc """ # Description Constructor for the Noise kernel (covariance) k(x,x') = σ²δ(x-x'), where δ is a Kronecker delta function and equals 1 iff x=x' and zero otherwise # Arguments: * `lσ::Float64`: Log of the signal standard deviation σ """ -> type Noise <: Kernel lσ::Float64 # Log of Si...
JuliaPackageMirrors/GaussianProcesses.jl
src/kernels/noise.jl
Julia
mit
1,117
module FileFind include("find.jl") end
johnmyleswhite/FileFind.jl
src/FileFind.jl
Julia
mit
40
# map-reduce const AbstractArrayOrBroadcasted = Union{AbstractArray,Broadcast.Broadcasted} # GPUArrays' mapreduce methods build on `Base.mapreducedim!`, but with an additional # argument `init` value to avoid eager initialization of `R` (if set to something). mapreducedim!(f, op, R::AnyGPUArray, A::AbstractArrayOrBro...
JuliaGPU/GPUArrays.jl
src/host/mapreduce.jl
Julia
mit
4,153
# ------------------------------------------------------------------- # # Generic methods # ------------------------------------------------------------------- # # Base.size(::AbstractExogenousProcess{N}) = N # AbstractExogenousProcess Interface # for f in [:step] # @eval $(f){T<:AbstractExogenousProcess}(::T, ar...
NYUEcon/GrowthModels
Models/MA_Exogenous.jl
Julia
mit
3,399
function modifier(ability) end function ability() end mutable struct DNDCharacter end
exercism/xjulia
exercises/practice/dnd-character/dnd-character.jl
Julia
mit
91
# We want to explore fast ways to subset a large, square N*N matrix in julia dependent on # 1. N = number of dimensions of large matrix / data set # 2. S = subset size = floor(log(N)) - floor(10*log(N)) # 3. Method used to extract subset of dimensions/features function extract_with_getindex(matrix, subset) mat...
robertfeldt/FeldtLib.jl
spikes/fast_matrix_subsetting.jl
Julia
mit
1,658
using MATLAB using Base.Test include("engine.jl") include("matfile.jl") include("matstr.jl") include("mstatements.jl") include("mxarray.jl")
musm/MATLAB.jl
test/runtests.jl
Julia
mit
142
module HazmatRouting # package code goes here end # module
chkwon/HazmatRouting.jl
src/HazmatRouting.jl
Julia
mit
61
# fixed or variable sampling time 1/0 fixTime = 0 # default: 0 (variable time steps) #### problem parameters #### TsPF = 0.05 # nominal sampling time sampleN = 3 # down-sampling from Hybrid A* to OBCA if fixTime == 1 # Ts = 0.65/3*sampleN # 0.65/3 must be compatible with motion resolution of Hybrid A* algorithm...
BARCproject/barc
workspace/src/barc/src/control/parking/vehicle-configuration.jl
Julia
mit
816