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 DiffPrecTest
using Statistics, StatsBase, LinearAlgebra
using SparseArrays
using ProximalBase, CoordinateDescent, CovSel
using Random, Distributions
using JLD
@show gethostname()
pArr = [25, 100, 200]
elemArr = [(5,5), (8, 7), (50, 25)]
n = 300
est = Array{Any}(undef, 9) # number of methods
# rep = ... | mlakolar/DiffPrecTest.jl | exper/sim2/sim2_test.jl | Julia | mit | 2,012 |
_jl_libzmq = dlopen("libzmq")
_jl_zmq_version = dlsym(_jl_libzmq, :zmq_version)
_jl_zmq_init = dlsym(_jl_libzmq, :zmq_init)
_jl_zmq_term = dlsym(_jl_libzmq, :zmq_term)
_jl_zmq_errno = dlsym(_jl_libzmq, :zmq_errno)
_jl_zmq_strerror = dlsym(_jl_libzmq, :zmq_strerror)
_jl_zmq_socket = dlsym(_jl_libzmq, :zmq_socket)
_jl_... | aviks/julia-zmq-mongrel | jl/zmq.jl | Julia | mit | 9,112 |
n=parse(Int,ARGS[1]) # take one integer argument
println(rand(1:n,n,n)) # generate and print n x n matrix of random integers between 1 and n
@show b=3 # set b to 3 and show the result
c=4 # set c to 4
| ivanslapnicar/GIAN-Applied-NLA-Course | src/Module A - Short Julia Course/deploy.jl | Julia | mit | 245 |
## Contour plot -- but this is too slow to be usable
## algorithm from MATLAB
## cf. http://www.mathworks.com/help/matlab/creating_plots/contour-plots.html
type Contourc
contours
end
function contourc(f::Function, x, y; cs::Union{Void, Number}=nothing)
fxy = [f(x,y) for x in x, y in y]
## we have edges ... | rened/Winston.jl | src/contour.jl | Julia | mit | 4,494 |
# Composition
# ===========
#
# Sequence composition counter.
#
# This file is a part of BioJulia.
# License is MIT: https://github.com/BioJulia/Bio.jl/blob/master/LICENSE.md
type Composition{T} <: Associative{T,Int}
counts::Vector{Int}
end
function Composition{A<:Union{DNAAlphabet,RNAAlphabet}}(seq::BioSequence{... | kdmurray91/Bio.jl | src/seq/composition.jl | Julia | mit | 3,061 |
# Hock and Schittkowski problem number 117.
#
# Source:
# Problem 117 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 PQR-AN-15-5
#
# A. Montoison, Mont... | dpo/OptimizationProblems.jl | src/hs117.jl | Julia | mit | 1,529 |
using StructJuMP
m = StructuredModel()
factories = 1:3
centers = 1:5
scenarios = ["lo", "mid", "hi"]
cap = [500, 450, 650]
demand = [150 160 170;
100 120 135;
250 270 300;
300 325 350;
600 700 800]
prob = [0.25, 0.5, 0.25]
transcost = [2.49 5.21 3.76 4.85 2.07;
... | fqiang/StructJuMP.jl | examples/transportation.jl | Julia | mit | 1,371 |
# Return type
const DSP_STAT_OPTIMAL = 3000;
const DSP_STAT_PRIM_INFEASIBLE = 3001;
const DSP_STAT_DUAL_INFEASIBLE = 3002;
const DSP_STAT_LIM_ITERorTIME = 3004;
const DSP_STAT_STOPPED_GAP = 3005;
const DSP_STAT_STOPPED_NODE = 3006;
const DSP_STAT_STOPPED_TIME = 3007;
const DSP_STAT_STOPPED_USE... | Argonne-National-Laboratory/DSPsolver.jl | src/defines.jl | Julia | bsd-2-clause | 1,083 |
using CUSPARSE
using CUDArt
using Base.Test
m = 25
n = 35
k = 10
blockdim = 5
@testset "doti" begin
@testset for elty in [Float32,Float64,Complex64,Complex128]
x = sparsevec(rand(1:m,k), rand(elty,k), m)
y = rand(elty,m)
d_x = CudaSparseVector(x)
d_y = CudaArray(y)
ddot = C... | kshyatt/CUSPARSE.jl | test/dot.jl | Julia | mit | 953 |
module VersionWeights
export VersionWeight
immutable HierarchicalValue{T}
v::Vector{T}
rest::T
end
HierarchicalValue{T}(v::Vector{T}, rest::T = zero(T)) = HierarchicalValue{T}(v, rest)
HierarchicalValue(T::Type) = HierarchicalValue(T[])
Base.zero{T}(::Type{HierarchicalValue{T}}) = HierarchicalValue(T)
Base... | shubhamg31/columbus_julia | lib/julia/base/pkg/resolve/versionweight.jl | Julia | apache-2.0 | 6,784 |
# SAM Header
# ==========
# Implicit type restriction for predefiend tags:
# * HD: Dict{String,String}
# * SQ: Vector{Dict{String,Any}}
# * RG: Vector{Dict{String,Any}}
# * PG: Vector{Dict{String,Any}}
# * CO: Vector{String}
type SAMHeader <: Associative{String,Any}
data::Dict{String,Any}
end
function ... | bicycle1885/HTSFileFormats.jl | src/sam/header.jl | Julia | mit | 1,297 |
export SeisBandPass,
SeisDecimate,
SeisDelay,
SeisDiff,
SeisEnvelope,
SeisFKFilter,
SeisFXDecon,
SeisGain,
SeisKolmogoroff,
SeisMWNI,
SeisMute,
SeisNMO,
SeisPOCS,
SeisPWD,
SeisRadonFreqFor,
SeisRadonFreqInv,
SeisSemblance,
SeisSmooth1,
SeisSmooth2,
SeisSmoothGathers,
SeisSmoothStructure,
SeisStack
include("SeisBandPass... | JuliaPackageMirrors/Seismic.jl | src/Processing/Processing.jl | Julia | mit | 878 |
# ViewDBI
module ViewDBI
import Base: show, contains, hash
import Base.Meta.isexpr
import ODBC
import DataFrames
export ViewODBC, View, has_one, has_many, many_to_many, contains, resolve
abstract ViewDB
type ViewODBC <: ViewDB
db::ODBC.Connection
schema::Symbol
end
show(io::IO, kodbc::ViewODBC) = print(io... | kmsquire/ViewDBI.jl | src/ViewDBI.jl | Julia | mit | 6,884 |
# Binary heap
immutable MutableBinaryHeapNode{T}
value::T
handle::Int
end
#################################################
#
# core implementation
#
#################################################
function _heap_bubble_up!{Comp, T}(comp::Comp,
nodes::Vector{MutableBinaryHeapNode{T}}, nodemap::Vect... | timholy/DataStructures.jl | src/heaps/mutable_binary_heap.jl | Julia | mit | 6,052 |
using LowRankModels
using Base.Test
TOL = 1e-5
# QuadConstraint
r = QuadConstraint(7)
@test evaluate(r, ones(7)) == 0
@test evaluate(r, ones(100)) == Inf
@test_approx_eq prox(r, ones(100), 1) ones(100)/sqrt(100)*7
| jaehyunp/LowRankModels.jl | test/reg_test.jl | Julia | mit | 219 |
# Adapted from PWSCF
# I found slight difference with Libxc for PBE correlation.
include("XC_funcs/XC_c_pbe.jl")
include("XC_funcs/XC_c_pbe_E.jl")
include("XC_funcs/XC_c_pbe_spin.jl")
include("XC_funcs/XC_c_pbe_spin_E.jl")
include("XC_funcs/XC_c_pw.jl")
include("XC_funcs/XC_c_pw_E.jl")
include("XC_funcs/XC_c_pw_spi... | f-fathurrahman/ffr-ElectronicStructure.jl | LAPW/XC_functionals_internal.jl | Julia | mit | 623 |
@testset "Check For Skip Function Tests" begin
@test isdefined(Julz, :check_for_skip) == true
end
| djsegal/julz | test/functions/utils/check_for_skip_test.jl | Julia | mit | 102 |
type State
tokens::Vector{Int}
headsets::Vector{Vector{Int}}
step::Int
end
State(tokens, headsets) = State(tokens, headsets, 0)
function Base.next(s::State)::Vector{State}
s.step == length(tokens) && return State[]
map(headsets[s.step+1]) do h
State(s.tokens, s.headsets, h)
end
end
ty... | hshindo/TransitionParser.jl | src/segmentation/state.jl | Julia | mit | 535 |
#-------------------------------------------------------------------
#* 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/stage_separators/condenser/condenserSteady_fakeH.jl | Julia | mit | 4,244 |
using JLD
using DiffPrecTest
using DataFrames, DataFramesMeta, CSV
using Statistics, StatsBase, LinearAlgebra
using SparseArrays
using Random, Distributions
using LaTeXStrings, LaTeXTabulars
cd("exper/sim3")
pArr = [100, 200]
elemArr = [(5,5), (8, 7), (50, 25), (21, 20), (30, 30)]
methodArr = ["Sym-N", "Asym-N", "Yin... | mlakolar/DiffPrecTest.jl | exper/sim3/summarize.jl | Julia | mit | 2,963 |
#five-bit-lattice.jl
#definition for the five-bit lattice with epochs.
#five-bit Lnum
if !isdefined(:PTile6)
six_bit_lattice = Unum2.LatticeNum[1.25, 1.5, 1.75, 2.0, 2.5, 3.0, 3.5]
Unum2.addlattice(:Lnum6, six_bit_lattice, 4)
typealias PTile6 PTile{:Lnum6, 2}
typealias PBound6 PBound{:Lnum6, 2}
Base.show(... | ityonemo/Unum2 | src/lattices/six-bit-lattice.jl | Julia | mit | 403 |
# jni_md.h
typealias jint Cint
#ifdef _LP64 /* 64-bit Solaris */
# typedef long jlong;
typealias jlong Clonglong
typealias jbyte Cchar
# jni.h
typealias jboolean Cuchar
typealias jchar Cushort
typealias jshort Cshort
typealias jfloat Cfloat
typealias jdouble Cdouble
typealias jsize jint
jprimitive = Union(jboolean,... | mbeltagy/JavaCall.jl | src/core.jl | Julia | mit | 9,519 |
# Main lookup methods.
"""
Find all methods defined by an method definition expression.
"A docstring for the methods ``f(::Any)`` and ``f(::Any, ::Any)``"
f(x, y = 1) = x + y
"""
function findmethods(state::State, ex::Expr, codesource)
line, file = codesource
fname, mset = funcname(state, ex), Set{M... | hayd/Docile.jl | src/Runner/lookup.jl | Julia | mit | 5,918 |
#TODO:
# check_parent
# hash
# elem_type & friends
#
mutable struct RealField <: Nemo.Field
K::AnticNumberField
P::InfPlc
function RealField(K::AnticNumberField, P::InfPlc)
if !isreal(P)
error("place is not real")
end
r = new()
r.K = K
r.P = P
return r
end
end
@doc Markdown.doc... | thofma/Hecke.jl | src/Misc/RealField.jl | Julia | bsd-2-clause | 3,694 |
# Grigoriadis Khachiyan Matrix Games.
#
# Example run: gk(10000, [0.1])
#
# Code from Dilys Thomas <dilys@cs.stanford.edu>
##### generate skew symmetric matrix #######
function myunifskew(n)
A = zeros(n, n)
#print("A[i,j] initialized with zeros \n");
for i=1:n
for j=1:i-1
... | shubhamg31/columbus_julia | lib/julia/test/perf/kernel/gk.jl | Julia | apache-2.0 | 3,236 |
module TestVecnorm
using ParallelAccelerator
@acc norm_t(y) = norm(y,1)
@acc norm_t2(y) = norm(y,2)
function test()
y = [1.,2.,3.]
z = norm_t(y)
return z
end
function test2()
y = [1.,2.,3.]
z = norm_t2(y)
return z
end
end
using Base.Test
println("testing vecnorm...")
@test_approx_eq TestVec... | malekbr/julia-to-tiramisu | test/vecnorm_test.jl | Julia | bsd-2-clause | 428 |
# one parameter predicates
"""Returns nonzero iff the midpoint and radius of x are both finite floating-point numbers, i.e. not infinities or NaN."""
function isfinite{D,P}(x::ArbDec{D,P})
return 0 != ccall(@libarb(arb_is_finite), Int, (Ptr{ArbDec{D,P}},), &x)
end
"""isnan or isinf"""
function notfinite{D,P}(x::A... | JuliaArbTypes/ArbDecimals.jl | src/basics/predicates.jl | Julia | mit | 5,143 |
abstract type LateralDriverModel end
get_name(::LateralDriverModel) = "???"
reset_hidden_state!(model::LateralDriverModel) = model # do nothing by default
observe!(model::LateralDriverModel, scene::Scene, roadway::Roadway, egoid::Int) = model # do nothing by default
Base.rand(model::LateralDriverModel) = error("rand n... | tawheeler/AutomotiveDrivingModels.jl | src/2d/behaviors/lateral_driving_models/lateral_driving_models.jl | Julia | mit | 2,329 |
# BAM
# ===
#
# The BAM file format.
#
# http://samtools.github.io/hts-specs/SAMv1.pdf
"""
The BAM file format.
"""
immutable BAM <: Bio.IO.FileFormat end
include("bai.jl")
include("record.jl")
include("reader.jl")
include("writer.jl")
include("auxdict.jl")
include("intersect.jl")
function Base.open(filename::Abstra... | bicycle1885/HTSFileFormats.jl | src/bam/bam.jl | Julia | mit | 544 |
using StochasticSearch, FactCheck
facts("[Interface] with Optim.jl") do
context("simulated_anealing and nelder_mead") do
function rosenbrock(x::Array)
return (1.0 - x[1])^2 + 100.0 * (x[2] - x[1]^2)^2
end
c = Configuration([NumberParameter(-10.0,10.0,-2.0,"a"),
... | tkelman/StochasticSearch.jl | test/optim_interface.jl | Julia | mit | 956 |
using MarketData
facts("readwrite parses csv file correctly") do
context("1d values array works") do
@fact typeof(cl.values) => Array{Float64,1}
end
context("2d values array works") do
@fact typeof(ohlc.values) => Array{Float64,2}
end
context("Specifying DateTime string format for reading") do... | zhmz90/TimeSeries.jl | test/readwrite.jl | Julia | mit | 943 |
using Color
include("helpers/page.jl")
include("helpers/doc.jl")
intro = md"""
$(title(2, "Typography"))
$(vskip(1em))
# Functions
$(vskip(1em))
$(
showdocs([fontsize, fontweight, fontcolor, fontstyle, fontfamily, fonttype,
fontcase, textalign, lineheight, letterspacing, title, heading,
... | cdsousa/Escher.jl | docs/typography-api.jl | Julia | mit | 425 |
module Word2Vec
import Base: show, size
export
# types
WordVectors, WordClusters,
# functions
index, size,
vocabulary, in_vocabulary,
get_vector, get_cluster, get_words,
cosine, cosine_similar_words,
analogy, analogy_words, similarity,
wordvectors, clusters, wordclusters,
... | JuliaPackageMirrors/Word2Vec.jl | src/Word2Vec.jl | Julia | apache-2.0 | 450 |
using Printf
using LinearAlgebra
using Random
include("../common/PWGrid_v02.jl")
include("../common/ortho_gram_schmidt.jl")
include("../common/wrappers_fft.jl")
include("../common/gen_lattice_pwscf.jl")
include("gen_dr.jl")
include("init_pot_harm_3d.jl")
include("op_K.jl")
include("op_Vpot.jl")
include("op_H.jl")
in... | f-fathurrahman/ffr-ElectronicStructure.jl | PW/sch_02/main_harm_02.jl | Julia | mit | 2,345 |
using Match
include("debug_println.jl")
# An AstWalker walks over and visits all elements of the AST.
abstract AstWalker
visit(w::AstWalker, s::Symbol) = visit_symbol(w, s)
visit(w::AstWalker, i::Int) = visit_int(w, i)
visit(w::AstWalker, l::LineNumberNode) = visit_line_node(w, l)
visit(w::AstWalker, q::QuoteNode) =... | robertfeldt/FeldtLib.jl | spikes/dynamic_code_instrumentation/ast_walker.jl | Julia | mit | 1,761 |
# Plan
function discretize(df, rewardfunc, transitionfunc)
# args:
# reward function
# transition function
# dataframe (contains observations of the state variables)
#
# returns:
# dataframe corresponding to discrete levels
end
| cpritcha/MDP | src/conversion.jl | Julia | mit | 253 |
type Rule
p::Array # antecedent (rhs)
q::Array # consequent (lhs)
supp::Float64
conf::Float64
lift::Float64
end
# Support Count: σ(x) = | {t_i|x ⊆ t_i, t_i ∈ T}|
function σ(x::Array, T)
res = 0
for t in T
if x ⊆ t
res += 1
end
end
... | nolimitjl/AssociationRules.jl | src/apriori.jl | Julia | mit | 8,622 |
module JeszenszkiBasis
export
AbstractSzbasis,
Szbasis,
RestrictedSzbasis,
@sz_str,
num_vectors,
serial_num,
site_max,
sub_serial_num,
to_str
include("basis.jl")
include("indexing.jl")
include("iteration.jl")
include("string.jl")
include("utilities.jl")
end
| 0/JeszenszkiBasis.jl | src/JeszenszkiBasis.jl | Julia | mit | 299 |
type SAGinitsd <: StepData
d
functions
y
I
getStep::Function
stepString::AbstractString
function SAGinitsd(numVars::Int64,dt::DataType, stepString::AbstractString,numDp::Int64)
new(zeros(numVars),Array(Function, numDp), Array(dt, numDp),0, SAGinitComputation, stepString)
end
end
function SAGinit(numVars::In... | stefanks/EGR.jl | src/Steps/stepSAGinit.jl | Julia | mit | 766 |
using HTTP
using JSON
using RCall
export get_lat_lon, vgregion_lat_lon_bounds
#nominatim requires as user agent and will block you otherwise
HTTP.setuseragent!("Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.0")
const NominatimSearchPrefix = "https://nominatim.openstreetmap.org/search?q="
# Nomina... | robertfeldt/FeldtLib.jl | src/geocoding.jl | Julia | mit | 2,873 |
using NaiveBayes
using RDatasets
using StatsBase
# Example 1
iris = dataset("datasets", "iris")
# observations in columns and variables in rows
X = array(iris[:, 1:4])'
p, n = size(X)
# by default species is a PooledDataArray,
y = [species for species in iris[:, 5]]
# how much data use for training
train_frac = 0.9... | JuliaPackageMirrors/NaiveBayes.jl | examples/iris.jl | Julia | mit | 839 |
################ Introduce the model structures ###############
abstract type DSGEModel end
abstract type ModelPrimatives end
struct REModelPrimatives{Q <: AbstractString} <: ModelPrimatives
# This structure contains the critial model information extracted from a
# model file.
states::Array{Q,1}
jum... | RJDennis/SolveDSGE.jl | src/structures.jl | Julia | mit | 15,534 |
using apfamet
using Base.Test
# write your own tests here
@test 1 == 1
| ianpgm/apfamet | test/runtests.jl | Julia | mit | 72 |
using StatsBase
abstract type Model end
layers(m::T) where {T<:Model} = error("layers(::$T) not implemented.")
inputs(m::T) where {T<:Model} = error("inputs(::$T) not implemented.")
outputs(m::T) where {T<:Model} = error("outputs(::$T) not implemented.")
Base.getindex(m::T, i::Int) where {T<:Model} = error("getind... | invenia/Keras.jl | src/models.jl | Julia | mit | 2,189 |
###########################
# Function Cell Interface #
###########################
"""
kpca([;kwargs])
Constructs an untrained cell that when piped data inside, calculates the Kernel-PCA
projection matrix of the input data. We assume that `d` is the dimesionality
of the input dataset, `n` the number of samples
# K... | zgornel/j4pr.jl | src/lib/ext/kpca.jl | Julia | mit | 3,962 |
import OpenCL.cl.CLArray
import Base.LinAlg.BLAS: axpy!, scal!, gemm!
#### common stuff
function transval(t::Char)
return t == 'T' ? clblasTrans : clblasNoTrans
end
########################### L1 functions ###############################
## AXPY
for (func, typ) in [(:clblasSaxpy, Float32), (:clblasDaxpy, Floa... | JuliaPackageMirrors/CLBLAS.jl | src/highlevel.jl | Julia | apache-2.0 | 2,070 |
# for arithmetic etc. see AlgAssAbsOrd/Elem.jl
export trred
parent_type(::Type{AlgAssRelOrdElem{S, T, U}}) where {S, T, U} = AlgAssRelOrd{S, T, U}
parent_type(::AlgAssRelOrdElem{S, T, U}) where {S, T, U} = AlgAssRelOrd{S, T, U}
@doc Markdown.doc"""
parent(x::AlgAssRelOrdElem) -> AlgAssRelOrd
Returns the order ... | thofma/Hecke.jl | src/AlgAssRelOrd/Elem.jl | Julia | bsd-2-clause | 5,508 |
module NaiveResamplers
export naivefilt
# Naive rational resampler
function naivefilt( h::Vector, x::Vector, resamplerate::Rational = 1//1 )
upfactor = num( resamplerate )
downfactor = den( resamplerate )
xLen = length( x )
xZeroStuffed = zeros( eltype(x), length( x ) * upfactor )
f... | JuliaPackageMirrors/Multirate.jl | src/NaiveResamplers.jl | Julia | mit | 1,345 |
include("unit_test_helper.jl")
# Turing
using Turing
@model gdemo() = begin
s ~ InverseGamma(2, 3)
m ~ Normal(0,sqrt(s))
1.5 ~ Normal(m, sqrt(s))
2.0 ~ Normal(m, sqrt(s))
return s, m
end
# Plain Julia
using ReverseDiff: GradientTape, GradientConfig, gradient, gradient!, compile
using Turing: ... | yebai/Turing.jl | test/skipped/gdemo.jl | Julia | mit | 1,072 |
ones100 = ones(100)
onesthou = ones(1000)
dA = full(sA)
dTl = full(sTl)
dTu = full(sTu)
@test_approx_eq(sA*ones100,dA*ones100)
@test_approx_eq(sTl*ones100,dTl*ones100)
@test_approx_eq(sTu*ones100,dTu*ones100)
@test_approx_eq(sA'onesthou,dA'onesthou)
@test_approx_eq(LowerTriangular(sTl)*ones100,sTl*ones100)
@test_app... | KristofferC/MKLSparse.jl | test/matmul.jl | Julia | mit | 836 |
export ScaledInterpolation, eachvalue
import Base: done, next, start
immutable ScaledInterpolation{T,N,ITPT,IT,GT,RT} <: AbstractInterpolationWrapper{T,N,ITPT,IT,GT}
itp::ITPT
ranges::RT
end
@generated function ScaledInterpolation{ITPT,RT}(itp::ITPT, ranges::RT)
T = eltype(itp)
N = ndims(itp)
IT =... | JuliaPackageMirrors/Interpolations.jl | src/scaling/scaling.jl | Julia | mit | 10,721 |
#Compute image using 4 quadrants;
#(can be parallellized easily)
######################
#grid setup
xmin = -10
xmax = -xmin +0.005
ymin = -10
ymax = -ymin +0.005
Ny = 100
Nx = 100
xmid = round(Int,Nx/2)
ymid = round(Int,Ny/2)
hdata3 = zeros(Ny, Nx)
#dx = (xmax-xmin)/(Nx-1)
#dy = (ymax-ymin)/(Ny-1)
#x_grid = collect... | natj/bender | julia/rtrace_cart.jl | Julia | mit | 2,942 |
module VTKExportMod
using FEM
using Zlib
using LightXML
using Codecs
import Base.push!
import FEM: write_data, get_coord, get_geotype, get_ncomponents, get_cell_data,
get_displacement, get_field, get_galphas, DofVals
export VTKExporter, set_binary!, set_compress!
type VTKExporter <: AbstractDataExport... | KristofferC/FEM.jl | src/export/vtkexport_xml.jl | Julia | mit | 7,847 |
# TODO: only store last N trees
_id = 0
treeid() = (global _id += 1)
const trees = Dict{Int,LazyTree}()
function render(i::Inline, tree::LazyTree)
id = treeid()
trees[id] = tree
d(:type => :lazy,
:head => render(i, tree.head),
:id => id)
end
handle("getlazy") do id
haskey(trees, id) || return [rende... | JunoLab/Atom.jl | src/display/lazy.jl | Julia | mit | 511 |
function demoHMMinferenceSimple()
V = 5 # number of visible states
H = 10 # number of hidden states
T = 20 # number of timesteps
h = zeros(Integer,1,T) # holds the state value for the hidden variable at a specific timestep
v = zeros(Integer,1,T) # holds the state value for the visible variable at... | davidbarber/Julia0p4ProbabilisticInferenceEngine | Demos/demoHMMinferenceSimple.jl | Julia | mit | 1,974 |
"""
PolicyGraphGenerator
* `fast = false` use fast (but very picky) alternate parser for .pomdp files
* `graph_max_depth` maximum horizon of the generated policy graph. There is no limit by default.
* `graph_max_branch` maximum number of branches of the generated policy graph. Shown will be top in probability. The... | sisl/SARSOP.jl | src/graph.jl | Julia | mit | 2,125 |
"""
Description of TSP, and the setup used to solve it.
"""
function tsp()
# Compute the absolute location of the TSP example file.
file_name = "$(dirname(@__FILE__))/tsp/berlin52.tsp"
def = algorithm.genetic() do alg
alg.population = population.simple() do pop
pop.size = 100
pop.species = specie... | JuliaPackageMirrors/Wallace.jl | src/example/tsp.jl | Julia | mit | 889 |
import GZip
using StatsBase
using IterTools
using Combinatorics
using LightGraphs
using Formatting
#derrida_map calculates derrida map for a net up to a H hamming distance
function derrida_map!{T<:state_type}(net::Net2{T},nrand_init::Int=prod([length(sigma.state_range) for sigma in net.nodes]);tau::Int=1,update_mode::... | dpriego87/DisDyNet.jl | src/NetAnalysis2.jl | Julia | mit | 29,597 |
module Mime_ext
export MimeExt
MimeExt = Dict{String, String}(
"ez" => "application/andrew-inset",
"anx" => "application/annodex",
"atom" => "application/atom+xml",
"atomcat" => "application/atomcat+xml",
"atomsrv" => "application/atomserv+xml",
"lin" => "application/bbolin",
"cu" => "application/cu-see... | samuel-massinon-invenia/LibCURL.jl | src/Mime_ext.jl | Julia | mit | 19,488 |
function _biLanczosIterations!(A, stepsize, αs, βs, U, V, μs, νs, maxνs, maxμs, τ, reorth_in, tolreorth, debug)
m, n = size(A)
reorth_μ = reorth_in
nReorth = 0
nReorthVecs = 0
T = eltype(eltype(U))
Tr = real(T)
iter = length(αs)
u = U[iter + 1]
v = V[iter]
β = βs[iter]
f... | andreasnoack/TSVD.jl | src/svd.jl | Julia | mit | 12,342 |
type SGksd <: StepData
getStep::Function
stepString::AbstractString
function SGksd(stepString::AbstractString)
new(computeSGkStep,stepString)
end
function SGksd()
new(computeSGkStep,"SGk")
end
end
function computeSGkStep(x, k, gnum, sd::SGksd, problem::Problem; outputLevel =0)
func = consume(problem.getNex... | stefanks/EGR.jl | src/Steps/stepSGk.jl | Julia | mit | 391 |
# This file contains the basic functions of PCG.
import RandomNumbers: AbstractRNG
"Return the default multiplier for a certain type."
@inline default_multiplier(::Type{UInt8}) = 0x8d
@inline default_multiplier(::Type{UInt16}) = 0x321d
@inline default_multiplier(::Type{UInt32}) = 0x2c9277b5
@inline default_multiplier(... | sunoru/RNG.jl | src/PCG/bases.jl | Julia | mit | 10,435 |
function randindex{T<:Integer}(truth::Vector{T}, pred::Vector{T})
# See Hubert and Arabie 1985 "Comparing Partitions"
@assert length(truth) == length(pred)
n_samples = length(truth)
classes = unique(truth)
clusters = unique(pred)
# Special limit cases: no clustering since the data is not split... | jakesnell/Seglib.jl | src/metrics.jl | Julia | mit | 2,101 |
# Translation from our variables to Nocedal and Wright's
# JMW's dx <=> NW's s
# JMW's dgr <=> NW' y
macro bfgstrace()
quote
if tracing
dt = Dict()
if o.extended_trace
dt["x"] = copy(x)
dt["g(x)"] = copy(gr)
dt["~inv(H)"] = copy(invH)
... | pkofod/Optim.jl | src/bfgs.jl | Julia | mit | 5,995 |
module Base_threads
end
| zhmz90/Daily | code_test/Base_threads.jl | Julia | mit | 33 |
using Base.BLAS
using Base.LinAlg
# type for collecting data statistics incrementally
type DataStats
x_sums::Vector{Float64} # sum(x_i)
cross_sums::Matrix{Float64} # sum(x_i'*x_i) (lower-triangular matrix)
n_obs::UInt64 # number of observations
obs_axis::Int64 # obser... | JuliaPackageMirrors/NaiveBayes.jl | src/datastats.jl | Julia | mit | 1,612 |
module EMLlag_1
using DanaTypes
using DotPlusInheritance
using Reexport
@reexport using ...types.EMLtypes
import EMLtypes.length
include("lag_1/Lag_1.jl")
end | DANA-Laboratory/EMSOModelLibrary.jl | JuliaEMSOModels/controllers/lag_1.jl | Julia | mit | 164 |
type PageSize
xscale::Float64
yscale::Float64
units::String
end
type PlotFrame
wi::Int
name::String
size::PageSize
title::String
xlabel::String
ylabel::String
xlim::Vector{Float64}
ylim::Vector{Float64}
legendInside::Bool
showLegend::Bool
legendPos::String
topAxis::Bool
leftAxis::Bool
bottomAxis::Bool... | JuliaPackageMirrors/Sparrow.jl | src/plotFrame.jl | Julia | mit | 1,315 |
#!/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/math/base/special/log2/benchmark/julia/benchmark.jl | Julia | apache-2.0 | 2,841 |
using Luxor
using Colors
using BoundaryValueDiffEq
# constants for differential equations and movie
const g = 9.81
const L = 1.0 # pendulum length in meters
const bobd = 0.10 # pendulum bob diameter in meters
const framerate = 50.0 # intended frame rate/sec
co... | wherrera10/julia | pendulumdiffeqmuv.jl | Julia | apache-2.0 | 1,972 |
using Base.Test
using Sigma
import Sigma: measure, logmeasure
# What should a domain be
b = HyperBox([0.0 0.0
2.0 1.0])
@test ndims(b) == 2
@test measure(b) == 2
@test logmeasure(b) == log(2) + 0 | JuliaPackageMirrors/Sigma.jl | test/hyperbox.jl | Julia | mit | 210 |
module Murmur3
include("x86.jl")
include("x64.jl")
end
| rjagerman/Murmur3.jl | src/Murmur3.jl | Julia | mit | 57 |
export pfork, pfork_shm
function pfork(n::Integer, f::Function, args...)
if nprocs() > 1
error("pfork is incompatible with worker processes. Execute a `rmprocs(workers())` and try again.")
end
pipes = cell(n)
cpids = cell(n)
responses=cell(n)
for i in 1:n
pipe_fds = Ar... | amitmurthy/PTools.jl | src/pfork.jl | Julia | mit | 4,791 |
#!/usr/bin/env julia
# -*- coding: utf-8 -*-
"""Lempel-Ziv complexity for a binary sequence, in naive Julia code.
- How to use it? From Julia, it's easy:
>>> using LempelZivComplexity
>>> s = "1001111011000010"
>>> LempelZivComplexity.lempel_ziv_complexity(s) # 1 / 0 / 01 / 11 / 10 / 110 / 00 / 010
8
- Run this ... | Naereen/Lempel-Ziv_Complexity | src/lempel_ziv_complexity.jl | Julia | mit | 2,085 |
using DualNumbers
using Base.Test
x = dual(2, 1)
y = x^3
@test_approx_eq real(y) 2.0^3
@test_approx_eq epsilon(y) 3.0*2^2
y = x^3.0
@test_approx_eq real(y) 2.0^3
@test_approx_eq epsilon(y) 3.0*2^2
y = sin(x)+exp(x)
@test_approx_eq real(y) sin(2)+exp(2)
@test_approx_eq epsilon(y) cos(2)+exp(2)
@test x > 1
y = abs(... | tlycken/DualNumbers.jl | test/automatic_differentiation_test.jl | Julia | mit | 1,606 |
@testset "examples" begin
dir = "../examples"
files = [ #"csg.jl",
"example001.jl",
"piping.jl",
"radiused_union.jl",
"fea.jl",
"2d.jl"]
for file in files
@testset "$file" begin
include("$dir/$file")
end
end... | sjkelly/Descartes.jl | test/examples.jl | Julia | mit | 325 |
import Base: filter, map, reduce
"""
map(f, d::DTable) -> DTable
Applies `f` to each row of `d`.
The applied function needs to return a `Tables.Row` compatible object (e.g. `NamedTuple`).
# Examples
```julia
julia> d = DTable((a = [1, 2, 3], b = [1, 1, 1]), 2);
julia> m = map(x -> (r = x.a + x.b,), d)
DTable wi... | shashi/ComputeFramework.jl | src/table/operations.jl | Julia | mit | 4,293 |
module problem110
description = """
Diophantine reciprocals II
In the following equation x, y, and n are positive integers.
1/x + 1/y = 1/n
It can be verified that when n = 1260 there are 113 distinct solutions and this is the least value of n for which the total number of distinct solutions exceeds one hundred.
Wha... | mbuhot/mbuhot-euler-solutions | julia/problem110.jl | Julia | mit | 2,562 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | xhochy/arrow | julia/Arrow/src/utils.jl | Julia | apache-2.0 | 6,378 |
@testset "Elements" begin
Qx, x = PolynomialRing(FlintQQ, "x")
K1, a1 = NumberField(x^3 - 2, "a")
O1 = EquationOrder(K1)
K2, a2 = number_field(4*x^2 + 1, "a")
O2 = maximal_order(K2)
@testset "Construction" begin
b1 = @inferred O1(2*a1^0)
@test b1.elem_in_nf == 2*a1^0
@test parent(b1) == O1
... | thofma/Hecke.jl | test/NfOrd/Elem.jl | Julia | bsd-2-clause | 8,032 |
export Bnum, Bbound
immutable Bnum <: Real
num::BigFloat
open::Bool
end
immutable Bbound <: Real
lo::Bnum
hi::Bnum
end
Bnum(x::Real,open::Bool) = Bnum(BigFloat(x),open)
Bnum(x::Real) = Bnum(x,false)
convert(::Type{Bnum},x::Bnum) = x
convert(::Type{Bnum},x::Real) = Bnum(x)
import Base.MPFR: to_mpf... | simonbyrne/UnumX.jl | src/bnum.jl | Julia | mit | 6,746 |
struct IndexableGenerator{I,F}
g::Base.Generator{I,F}
end
IndexableGenerator(args...) = IndexableGenerator(Base.Generator(args...))
Base.iterate(ig::IndexableGenerator, s...) = iterate(ig.g, s...)
Base.length(ig::IndexableGenerator) = length(ig.g)
Base.size(ig::IndexableGenerator) = size(ig.g)
Base.axes(ig::Index... | quinnj/TimeZones.jl | src/indexable_generator.jl | Julia | mit | 659 |
using StructJuMP
numScen = 2
m = StructuredModel(num_scenarios=numScen)
@variable(m, 0 <= x <= 1)
@variable(m, 0 <= y <= 1)
@constraint(m, x + y == 1)
@objective(m, Min, x*x + y)
for i in 1:numScen
bl = StructuredModel(parent=m, id=i)
@variable(bl, w >= 0)
@constraint(bl, w - x - y <= 1)
@objective(... | joehuchette/StructJuMP.jl | examples/easy_test.jl | Julia | mit | 342 |
# Constructors -----------------------------------------------------------------
function SIILife()
tf = TimeFrame()
dim = [:L_QX, :L_PX, :L_DM, :L_SX, :L_COST, :L_REV, :L_CAT]
corr = zeros(Float64, 1, 1)
qx = SIILifeQX()
sx = SIILifeSX()
px = SIILifePX()
cost = SIILifeCost()
cat = SIILifeCat()
... | mkriele/MCInsurance.jl | src/SII/SII_SIILife.jl | Julia | mit | 2,600 |
# the objective is to plot date time values on the x-axis
# one method is to represent the time as seconds past epoch
# this means the .millis field needs to be access from the CalendarTime object
# first it needs to be taken out of the IndexedVector type
# then the representation needs to eliminate the "e"
# here is a... | milktrader/TimeCharts.jl | src/timeline.jl | Julia | mit | 433 |
#!/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/binomial/quantile/test/fixtures/julia/runner.jl | Julia | apache-2.0 | 2,280 |
#!/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/discrete-uniform/mgf/test/fixtures/julia/runner.jl | Julia | apache-2.0 | 2,246 |
using Cxx
using Graphs
using GraphViz
import Base: start, next, done
import Graphs: is_directed, num_vertices, vertices,
implements_vertex_list, implements_vertex_map,
implements_adjacency_list, out_neighbors,
vertex_index
include(Pkg.dir("Cxx","test","llvmincludes.jl"))
immutable LLVMGraph{GraphType,Nod... | tkelman/Cxx.jl | test/llvmgraph.jl | Julia | mit | 2,739 |
# Immutable type that contains the preallocated space needed for match
immutable MatchEnv
# sizes of the full size patches
size_src::NTuple{2, Int64}
size_dst::NTuple{2, Int64}
# blockmatch scale
scale::Float64
# bandpass values
bandpass
# bandpass filter for xcorr
kernel::Array{Float64, 2}
# tfo... | seung-lab/Julimaps | src/core/Match.jl | Julia | mit | 34,393 |
# Date internal algorithms
@test Dates.totaldays(0,2,28) == -307
@test Dates.totaldays(0,2,29) == -306
@test Dates.totaldays(0,3,1) == -305
@test Dates.totaldays(0,12,31) == 0
# Rata Die Days # start from 0001-01-01
@test Dates.totaldays(1,1,1) == 1
@test Dates.totaldays(1,1,2) == 2
@test Dates.totaldays(2013,1,1) == 7... | quinnj/Dates.jl | test/types.jl | Julia | mit | 7,097 |
function waterfall(;x::AbstractVector = Int[], y::AbstractVector = Int[])
if length(x) != length(y)
error("X and Y need to be the same length")
end
#Calculate waterfall
_start = zeros(Int, length(x))
_end = cumsum(y) #End values for bar
#Do lag calculation for bar starting value
fo... | johnmyleswhite/Vega.jl | src/derived/waterfall.jl | Julia | mit | 1,227 |
using Gadfly
using Markdown
using Distributions
N = Input(10000)
btn = Input{Escher.MouseButton}(leftbutton)
it = Input([0])
val = Input([1.0])
running = Input(false)
result = lift(st -> run_simulate() , btn; typ=Any, init=nothing)
f(u) = exp(-u^2/2)/√(2pi)
f(u) = exp(-u^2/2)/√(2pi)
const u1=Uniform(-5.0,+5.0)
co... | jiahao/Escher.jl | examples/mc.jl | Julia | mit | 2,141 |
# Full positive definite matrix together with a Cholesky factorization object
immutable PDMat <: AbstractPDMat
dim::Int
mat::Matrix{Float64}
chol::CholType
end
function PDMat(mat::Matrix{Float64}, chol::Cholesky{Float64})
d = size(mat, 1)
size(chol, 1) == d ||
throw(DimensionMismatch("Dime... | scheidan/PDMats.jl | src/pdmat.jl | Julia | mit | 2,557 |
using IterativeSolvers
#Common functions and data structures
include("common.jl")
include("orthogonalize.jl")
# Hessenberg problem solver
include("hessenberg.jl")
#Stationary solvers
include("stationary.jl")
#Conjugate gradients
include("cg.jl")
#BiCGStab(l)
include("bicgstabl.jl")
#MINRES
include("minres.jl")
#... | JuliaLang/IterativeSolvers.jl | test/runtests.jl | Julia | mit | 766 |
function execute(config::Config, cmd::Cmd; dir::AbstractString="", name::AbstractString="")
init(config)
pg = Environment(config, dir, name)
set_envs(pg)
run(cmd)
end
| Rory-Finnegan/Playground.jl | src/execute.jl | Julia | mit | 184 |
module SCIP
function __init__()
# if SCIP is compiled with Ipopt, libipopt must be in LD_LIBRARY_PATH
if (libipopt = find_library(["libipopt"])) != ""
@unix_only dlopen(libipopt, RTLD_LAZY|RTLD_DEEPBIND|RTLD_GLOBAL)
end
end
# dump all code wrapped from C interface
module CInterface
include("wrapped... | ryanjoneil/SCIP.jl | src/SCIP.jl | Julia | mit | 749 |
using Seismic
d,e = SeisLinearEvents();
| aaronstanton/Seismic.jl | test/test_SeisLinearEvents.jl | Julia | mit | 43 |
using KUparser, KUnet, HDF5, JLD, ArgParse, Compat, CUDArt
VERSION < v"0.4-" && eval(Expr(:using,:Dates))
function parse_commandline()
s = ArgParseSettings()
@add_arg_table s begin
"datafiles"
help = "JLD files for input: first one will be used for training"
nargs = '+'
required... | denizyuret/KUparser.jl | test/train3.jl | Julia | mit | 7,747 |
using Glob
@test string.(glob("*tests.jl", cwd())) == glob("*tests.jl", pwd())
@test string.(readdir(glob"*tests.jl", cwd())) == readdir(glob"*tests.jl", pwd())
| Rory-Finnegan/Paths.jl | test/glob.jl | Julia | mit | 163 |
if Pkg.installed("Gurobi") != nothing
import Gurobi
end
immutable Razaviyayn2013_MinMaxWMMSEState
U::Array{Matrix{Complex128},1}
W::Array{Hermitian{Complex128},1}
V::Array{Matrix{Complex128},1}
end
function Razaviyayn2013_MinMaxWMMSE(channel, network)
assignment = get_assignment(network)
# Th... | rasmusbrandt/CoordinatedPrecoding.jl | src/precoding/Razaviyayn2013_MinMaxWMMSE.jl | Julia | mit | 12,849 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.