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 |
|---|---|---|---|---|---|
###############################################
## Reading and writing Julia data .jld files ##
###############################################
module JLD
using HDF5
# Add methods to...
import HDF5: close, dump, exists, file, getindex, g_create, g_open, name, names, read, size, write
import Base.show
# Debugging: com... | jpata/HDF5.jl | src/jld.jl | Julia | mit | 29,189 |
# Julia wrapper for header: /usr/local/include/libavutil/opencl.h
# Automatically generated using Clang.jl wrap_c, version 0.0.0
export
av_opencl_get_device_list,
av_opencl_free_device_list,
av_opencl_set_option,
av_opencl_get_option,
av_opencl_free_option,
av_opencl_alloc_external_env,
av... | JuliaPackageMirrors/VideoIO.jl | src/ffmpeg/AVUtil/v55/opencl.jl | Julia | mit | 3,926 |
# Automatically generated using Clang.jl wrap_c, version 0.0.0
const GDAL_VERSION_MAJOR = 1
const GDAL_VERSION_MINOR = 11
const GDAL_VERSION_REV = 2
const GDAL_VERSION_BUILD = 0
# Skipping MacroDefinition: GDAL_COMPUTE_VERSION ( maj , min , rev ) ( ( maj ) * 1000000 + ( min ) * 10000 + ( rev ) * 100 )
# Skipping Macr... | wkearn/RasterIO.jl | src/clang/gdal_cdefs.jl | Julia | mit | 16,248 |
#Stationary iterative methods
#Templates, section 2.2
export jacobi, jacobi!, gauss_seidel, gauss_seidel!, sor, sor!, ssor, ssor!
####################
# API method calls #
####################
jacobi(A::AbstractMatrix, b; kwargs...) = jacobi!(zerox(A, b), A, b; kwargs...)
function jacobi!(x, A::AbstractMatrix, b;
... | lopezm94/IterativeSolvers.jl | src/stationary.jl | Julia | mit | 10,129 |
#Time integrators
#Second order Runge-Kutta
function RK2(hyd::data2d, dt)
#save old state
old_rho = copy(hyd.rho[:,:])
qold = copy(hyd.q)
#calc rhs
k1 = calc_rhs(hyd, 0.5dt)
#calculate intermediate step
hyd.q = qold + 0.5dt*k1
#con2prim
hyd.rho, hyd.eps, hyd.press, hyd.velx, hyd.... | natj/hydro | src/integrators.jl | Julia | mit | 1,085 |
using BasePi
using Base.Test
# write your own tests here
@test 1 == 1
| TheBB/BasePi.jl | test/runtests.jl | Julia | mit | 71 |
macro test_throws_unwrap(terr, args...)
_test_throws_unwrap(terr, args...)
end
function replace_obj!(ex::Expr, obj)
if ex.head == :(.)
if ex.args[1] isa Symbol
ex.args[1] = Expr(:(.), obj, QuoteNode(ex.args[1]))
else
replace_obj!(ex.args[1], obj)
end
end
r... | shashi/ComputeFramework.jl | test/util.jl | Julia | mit | 1,962 |
#################################################################
# This module provides implementations of MDP and POMDP problems
# in the POMDPs.jl format. These implementations serve as
# examples for new users and as benchmark problems for testing
# and valdiation.
##################################################... | sisl/POMDPModels.jl | src/POMDPModels.jl | Julia | mit | 2,308 |
## define features traits
# most general feature(roadway, scenes, actions, vehid)
abstract type AbstractFeature end
# feature(roadway, veh)
struct EntityFeature <: AbstractFeature end
# feature(roadway, scene, veh)
struct SceneFeature <: AbstractFeature end
# feature(roadway, scenes, veh)
struct TemporalFeature <: Ab... | tawheeler/CarEM.jl | src/feature-extraction/features.jl | Julia | mit | 12,347 |
# *****************************************************************************
# Written by Ritchie Lee, ritchie.lee@sv.cmu.edu
# *****************************************************************************
# Copyright ã 2015, United States Government, as represented by the
# Administrator of the National Aeronautics... | rcnlee/GrammarExpts.jl | modules/ACASX_SA/config/singlethread.jl | Julia | apache-2.0 | 2,497 |
export list, image, link, abbr
@api list => (List <: Tile) begin
doc("Stylize a list of tiles as an itemized list.")
curry(tiles::TileList , doc="A tile or a vector of tiles.")
kwarg(ordered::Bool=false, doc=md"If set to `true`, numbering will be used.")
end
render(l::List, state) =
Elem(l.ordered ? :... | MichaeLeroy/Escher.jl | src/basics/content.jl | Julia | mit | 1,620 |
# TODO:
# This is a punt for now. It does not handle any sort of custom resolving tags,
# only matching default implicits.
const DEFAULT_SCALAR_TAG = "tag:yaml.org,2002:str"
const DEFAULT_SEQUENCE_TAG = "tag:yaml.org,2002:seq"
const DEFAULT_MAPPING_TAG = "tag:yaml.org,2002:map"
const default_implicit_resolvers =
... | peter1000/YAML.jl | src/resolver.jl | Julia | mit | 2,186 |
const synset_test_line = string(
"13134947 20 n 01 fruit 0 037 @ 11675842 n 0000 + 02397119 a 0101 + 101",
"13997 n 0101 + 13135692 n 0101 + 01652731 v 0101 + 01652895 v 0101 + 0",
"0506672 v 0101 + 00056188 v 0101 ~ 07705931 n 0000 ~ 11636835 n 0000 ~",
" 11700279 n 0000 ~ 12036067 n 0000 ~ 12158031 n ... | JuliaPackageMirrors/WordNet.jl | test/test_synset.jl | Julia | mit | 2,798 |
function popchart(; x::AbstractVector = Int[], y::AbstractVector = Int[], group::AbstractVector = [])
v = VegaVisualization(width = 640, height = 400)
add_data!(v, x = x, y = y, group = group)
#Get unique table name
table = v.data[1].name
legend!(v)
v.scales = Array{VegaScale}(3)
v.scale... | johnmyleswhite/Vega.jl | src/derived/popchart.jl | Julia | mit | 4,920 |
using Base.Test
require(joinpath(dirname(@__FILE__), "..", "src", "GarminFIT.jl")) #using GarminFIT
@test 1==1
| jgoldfar/GarminFIT.jl | test/runtests-local.jl | Julia | mit | 113 |
# Windows
# =======
#
# Sliding window iterator.
#
# This file is a part of BioJulia.
# License is MIT: https://github.com/BioJulia/Bio.jl/blob/master/LICENSE.md
module Windows
using Bio.Seq
using Compat
export eachwindow,
EachWindowIterator,
missed
typealias ArrayOrStringOrSeq Union{AbstractArray, Abstr... | kdmurray91/Bio.jl | src/util/windows.jl | Julia | mit | 3,483 |
"""
### MoleculeParam
```
MoleculeParam(carbon, hydrogen, nitrogen, oxygen, sulfur,
monoisotopic_mass, avg_isotopic_mass)
```
**Atoms composition:**
1. `carbon` — number of carbon atoms in molecule
1. `hydrogen` — number of hydrogen atoms in molecule
1. `nitrogen` — number of nitrogen atoms in molecule... | zmactep/ProtParam.jl | src/moleculeparam.jl | Julia | bsd-2-clause | 2,949 |
# Flags
# =====
#
# Bitwise flags (or FLAG).
"the read is paired in sequencing, no matter whether it is mapped in a pair"
const SAM_FLAG_PAIRED = UInt16(0x1)
"the read is mapped in a proper pair"
const SAM_FLAG_PROPER_PAIR = UInt16(0x2)
"the read itself is unmapped; conflictive with SAM_FLAG_PROPER_PAIR"
co... | richardreeve/Bio.jl | src/align/hts/sam/flags.jl | Julia | mit | 1,000 |
using Bokeh
plotfile("hold.html")
x = linspace(-3pi, 3pi)
y1 = cos(x)
plot(x,y1)
hold(true)
y2 = sin(x)./x
plot(x, y2, "r")
showplot() | Laeeth/dbokeh | docs/examples/hold.jl | Julia | mit | 138 |
using Test
using QuantumOptics
using LinearAlgebra, SparseArrays, Random
mutable struct test_lazytensor{BL<:Basis,BR<:Basis} <: AbstractOperator{BL,BR}
basis_l::BL
basis_r::BR
data::Matrix{ComplexF64}
test_lazytensor(b1::Basis, b2::Basis, data) = length(b1) == size(data, 1) && length(b2) == size(data, ... | bastikr/QuantumOptics.jl | test/test_operators_lazytensor.jl | Julia | mit | 8,938 |
module GLAbstraction
using Quaternions
import Quaternions.normalize
using AbstractGPUArray
using FixedSizeArrays
using GeometryTypes
using ModernGL
using Reactive
using FixedPointNumbers
using ColorTypes
using Compat
#import Images: imread, colorspace, Image, AbstractGray, RGB4, ARGB, Images
#import Lumberjack
import... | AlainLich/GLAbstraction.jl | src/GLAbstraction.jl | Julia | mit | 4,867 |
import Compat: ASCIIString
function readlibsvm(fname::ASCIIString, shape)
dmx = zeros(Float32, shape)
label = Float32[]
fi = open(fname, "r")
cnt = 1
for line in eachline(fi)
line = split(line, " ")
push!(label, float(line[1]))
line = line[2:end]
for itm in line
... | JuliaPackageMirrors/XGBoost.jl | test/utils.jl | Julia | mit | 502 |
export lanczosBidiag
function lanczosBidiag(A::SparseMatrixCSC{T1,Int},b::Array{T2,1}, k::Int) where {T1,T2}
T = promote_type(T1,T2)
x1 = zeros(T,size(A,1))
x2 = zeros(T,size(A,2))
Af(x,flag) = (flag=='F') ? mul!(x1,A,x,1.0,0.0) : mul!(x2,transpose(A),x,1.0,0.0)
return lanczosBidiag(Af,b,k)
end
lanczosBidiag... | lruthotto/KrylovMethods.jl | src/lanczosBidiag.jl | Julia | mit | 1,557 |
function init_observable_mappings!(m::SmetsWouters)
observables = OrderedDict{Symbol,Observable}()
population_mnemonic = get(get_setting(m, :population_mnemonic))
############################################################################
## 1. GDP
################################################... | FRBNY-DSGE/DSGE.jl | src/models/representative/smets_wouters/observables.jl | Julia | bsd-3-clause | 7,486 |
# This file is auto-generated by AWSMetadata.jl
using AWS
using AWS.AWSServices: medialive
using AWS.Compat
using AWS.UUIDs
"""
accept_input_device_transfer(input_device_id)
accept_input_device_transfer(input_device_id, params::Dict{String,<:Any})
Accept an incoming input device transfer. The ownership of the... | JuliaParallel/AWS.jl | src/services/medialive.jl | Julia | mit | 59,063 |
"""
Checks that the matrix is swapable under constrained permutations, i.e. one of
the two conformations called c1 and c2.
"""
function constrained_swapable(A::Array{Int64, 2})
@assert size(A) == (2, 2)
const c1 = [1 0; 0 1]
const c2 = [0 1; 1 0]
return (A == c1) | (A == c2)
end
"""
Checks that the matrix is s... | JuliaPackageMirrors/Brim.jl | src/permutations.jl | Julia | mit | 4,210 |
__precompile__(true)
module FixedSizeArrays
using Compat
if isdefined(Base, :normalize)
import Base: normalize
else
import Compat: normalize
export normalize
end
importall Base
import Base.LinAlg.chol!
if VERSION >= v"0.5.0-dev+4677"
import Base.LinAlg._chol!
end
# for 0.5 and 0.4 compat, use our ... | JuliaPackageMirrors/FixedSizeArrays.jl | src/FixedSizeArrays.jl | Julia | mit | 1,904 |
# Julia wrapper for header: /home/kevin/src/vlfeat/vl/stringop.h
# Automatically generated using Clang.jl wrap_c, version 0.0.0
export
vl_string_copy,
vl_string_copy_sub,
vl_string_parse_protocol,
vl_string_protocol_name,
vl_string_basename,
vl_string_replace_wildcard,
vl_string_find_char_... | IHPSystems/VLFeat.jl | src/libvl/stringop.jl | Julia | bsd-2-clause | 2,616 |
using PowerModels
using Graphs
type Graph
graph ::SimpleGraph
vertex_map ::Dict{Int,Any}
edge_map ::Dict{Int,Any}
bus_to_vertex_map ::Dict{Int,Int}
data ::Dict{AbstractString,Any}
ref ::Dict{Symbol,Any}
function Graph()
... | kaarthiksundar/n-k | reductioncodejl/io.jl | Julia | mit | 5,404 |
using ArgParse
function parse_cmdline()
settings = ArgParseSettings()
@add_arg_table settings begin
"--gc"
arg_type = Bool
default = true
help = "collect garbage between iterations"
"--ci"
arg_type = FloatingPoint
default = 0.95
... | jakebolewski/Criterion.jl | src/main.jl | Julia | mit | 1,608 |
# An implementation of TRILQR for the solution of square or
# rectangular consistent linear adjoint systems Ax = b and Aᵀy = c.
#
# This method is described in
#
# A. Montoison and D. Orban
# BiLQ: An Iterative Method for Nonsymmetric Linear Systems with a Quasi-Minimum Error Property.
# SIAM Journal on Matrix Analysis... | JuliaOptimizers/Krylov.jl | src/trilqr.jl | Julia | mit | 15,993 |
# Add functions for calculating the normalized compression distance (NCD).
# Compressors typically write a header to the compressed strings. In NCD calculations
# we do not want to include the length of this header. For each compressor type
# we try to find the length of the header by compressing some very short strin... | robertfeldt/InfoTheory.jl | src/ncd.jl | Julia | mit | 3,371 |
function almost_pi(N)
# Your code goes here!
return 0
end
| project-lovelace/lovelace-website | src/static/code_stubs/julia/almost_pi.jl | Julia | mit | 66 |
function adaptivesimpsons_inner(
f::Function,
a::Real,
b::Real,
ε::Real,
S::Real,
fa::Real,
fb::Real,
fc::Real,
bottom::Integer,
)
c = (a + b) / 2
h = b - a
d = (a + c) / 2
g = (c + b) / 2
fd = f(d)
fe = f(g)
Sleft = (h / 12) * (fa + 4 * fd + fc)
Srigh... | johnmyleswhite/Calculus2.jl | src/integrate/simpsons.jl | Julia | mit | 1,229 |
using DomainSets: convert_numtype, convert_prectype,
promote_numtype, promote_prectype
function test_dimension()
@test DomainSets.euclideandimension(Int) == 1
@test DomainSets.euclideandimension(Float64) == 1
@test DomainSets.euclideandimension(ComplexF64) == 1
@test DomainSets.euclideandimension(... | daanhb/Domains.jl | test/test_common.jl | Julia | mit | 3,882 |
function solution()
sum = 0
for x = 1:999
if x % 3 == 0 || x % 5 == 0
sum += x
end
end
sum
end
# XXX Shorter, but 100%+ slower. std_dev is way higher as well
#=function solution()=#
#=sum([x % 3 == 0 || x % 5 == 0 ? x : 0 for x = 0:999])=#
#=end=#
if length(ARGS) == 1 && ARGS[1] == "-a"
pr... | japaric/euler_criterion.rs | problems/001/001.jl | Julia | apache-2.0 | 510 |
include("Quad/Lattices.jl")
include("Quad/Spaces.jl")
include("Quad/Genus.jl")
include("Quad/GenusRep.jl")
include("Quad/ZLattices.jl")
include("Quad/NormalForm.jl")
include("Quad/ZGenus.jl")
| thofma/Hecke.jl | test/QuadForm/Quad.jl | Julia | bsd-2-clause | 192 |
#############################################################################
# max.jl
# Return the maximum of the two arguments. Operates elementwise over arrays.
# All expressions and atoms are subtpyes of AbstractExpr.
# Please read expressions.jl first.
##############################################################... | JuliaPackageMirrors/Convex.jl | src/atoms/lp_cone/max.jl | Julia | bsd-2-clause | 2,339 |
include("test_1d.jl")
include("test_2d.jl")
include("test_3d.jl")
include("test_4d.jl")
# include("test_5d.jl")
| RJDennis/ChebyshevApprox | test/runtests.jl | Julia | mit | 112 |
# This file is auto-generated by AWSMetadata.jl
using AWS
using AWS.AWSServices: iot_1click_devices_service
using AWS.Compat
using AWS.UUIDs
"""
claim_devices_by_claim_code(claim_code)
claim_devices_by_claim_code(claim_code, params::Dict{String,<:Any})
Adds device(s) to your account (i.e., claim one or more d... | JuliaParallel/AWS.jl | src/services/iot_1click_devices_service.jl | Julia | mit | 14,212 |
# This file is a part of AstroLib.jl. License is MIT "Expat".
# Copyright (C) 2016 Mosè Giordano.
# XXX: trailsign keyword not implemented, not sure it's worth the effort.
# Possible strategy: hold the sign of number in a variable (you can use
# copysign(1, number)), set result[1] equal to dd and multiply the first
# ... | giordano/AstroLib.jl | src/sixty.jl | Julia | mit | 1,262 |
using TermWin
ex = :( f(x::Float64) = x*x+2x + 2.*sin(x / 3.0) +1 )
tshow( ex )
| JuliaPackageMirrors/TermWin.jl | test/twexpr.jl | Julia | mit | 82 |
import Base.sqrt
immutable Sqrt <: SingleArg
x
end
sqrt(a)=Sqrt(a)
sqrt(eq::Equation)=Equation(simplify(sqrt(eq.lhs)),simplify(sqrt(eq.rhs)))
function print(io::IO,s::Sqrt)
print(io,"√(")
print(io,s.x)
print(io,')')
end
function simplify(sq::Sqrt)
sq=Sqrt(simplify(sq.x))
if isa(sq.x,Number)
if isreal(sq.x)&&sq.... | JuliaPackageMirrors/Equations.jl | src/sqrt.jl | Julia | mit | 1,417 |
### BasicGibbsJob
type BasicGibbsJob <: GibbsJob
model::GenericModel
dpindex::IntegerVector # Indices of dependent variables (parameters and transformations) in model.vertices
dependent::Vector{Union{Parameter, Transformation}} # Points to model.vertices[dpindex] for faster access
dpjob::Vector{Union{BasicMCJo... | JuliaPackageMirrors/Lora.jl | src/jobs/BasicGibbsJob.jl | Julia | mit | 13,897 |
@inbounds for i = ix:ix-1+n
x[i] = y[i] + z[i]*a
end
| JuliaPackageMirrors/FastArrayOps.jl | src/templates/addarrscal_foroop_inc1ieq.jl | Julia | mit | 57 |
module TestReturns
using Base.Test
using TimeData
using EconDatasets
using DataFrames
using Dates
using DataArrays
using GLM
include(joinpath(Pkg.dir("Econometrics"), "src/Econometrics.jl"))
###################
## get test data ##
###################
fname = joinpath(Pkg.dir("Econometrics"), "test/data/no_git_intRa... | JuliaFinMetriX/Econometrics.jl | test/cir.jl | Julia | mit | 4,206 |
@doc """
An axis aligned hyperbox - a set of intervals
""" ->
type HyperBox{T} <: Domain{T}
intervals::Vector{Interval{T}}
end
@doc doc"""A LazyBox is a hyperbox whose dimensions can be
created dynamically and do not have to be contiguous""" ->
immutable LazyBox{T} <: Domain{T}
intervals::Dict{Int64,Interval... | jbn/AbstractDomains.jl | src/domains/boxes.jl | Julia | mit | 1,990 |
using Test
include("isogram.jl")
@testset "empty string" begin
@test isisogram("")
end
@testset "isogram with only lower case characters" begin
@test isisogram("isogram")
end
@testset "word with one duplicated character" begin
@test !isisogram("eleven")
end
@testset "longest reported english isogram" b... | exercism/xjulia | exercises/practice/isogram/runtests.jl | Julia | mit | 1,422 |
export checkDerivative, getRandomTestDirection
using Printf
function getRandomTestDirection(x0::Float64)
return randn()
end
function getRandomTestDirection(x0::ComplexF64)
return randn()+1im*randn()
end
function getRandomTestDirection(x0::Array{Float64})
return randn(size(x0))
end
function getRandomTestDirection(... | JuliaInv/jInv.jl | src/Utils/testing.jl | Julia | mit | 1,590 |
export ft_getdeviceinfo
include("FT_DEVICE.jl")
function ft_getdeviceinfo(ft_handle::Culong)
ft_device = Ref{Cuint}() # see ftdevicetypedict
id = Ref{Cuint}()
serialnumber = Array(UInt8,17)
description = Array(UInt8,65)
serialnumber[17] = 0x00
description[65] = 0x00
ft_status = ccall((:FT_GetDeviceInfo,... | cstook/FTD2XX.jl | src/ft_getdeviceinfo.jl | Julia | mit | 734 |
using MLBase
# from Taddy (2015, distrom):
# CV selection rules: both CV1se, which chooses the largest λt with mean
# OOS deviance no more than one standard error away from minimum, and CVmin,
# which chooses λt at lowest mean OOS deviance.
function CVmin(oosdevs)
cvmeans = vec(mean(oosdevs,dims=2))
segCVmin =... | simonster/Lasso.jl | src/cross_validation.jl | Julia | mit | 3,536 |
using REPLMods
using Base.Test
# write your own tests here
@test 1 == 1
| spencerlyon2/REPLMods.jl | test/runtests.jl | Julia | mit | 73 |
# Load the Interpolator in the FEM module
FEM.lintriginterpmod()
using FEM.LinTrigInterpMod
module LinTrigMod
using FEM.LinTrigInterpMod
import FEM: createinterp, creategps, createstorage, get_field,
Bmatrix, doftypes, get_ndofs, get_geotype, get_ref_area, dNdxmatrix
import FEM: AbstractMaterialStatus, ... | KristofferC/FEM.jl | src/elements/lin_trig.jl | Julia | mit | 2,551 |
module InvHessian
using Test
using DiffPrecTest
using ProximalBase
using CovSel
using CoordinateDescent
using Random, LinearAlgebra, SparseArrays, Statistics, Distributions
function genData(p)
Sigmax = Matrix(1.0I, p, p)
Sigmay = zeros(p,p)
rho = 0.7
for i=1:p
for j=1:p
Sigmay[i,j]=rho^abs(i-j)
... | mlakolar/DiffPrecTest.jl | test/invHessian.jl | Julia | mit | 3,737 |
using Arrowhead
using DoubleDouble
using Polynomials
using MatrixDepot
using Base.Test
# There are four tests, a random matrix test and three tests from the arrowhead paper (see README for details)
println("There are four tests for arrowhead matrices, a random matrix test and three")
println("tests from the arrowhead ... | tkelman/Arrowhead.jl | test/runtests.jl | Julia | mit | 7,015 |
"""
An AbstractDataFrame that stores a set of named columns
The columns are normally AbstractVectors stored in memory,
particularly a Vector, DataVector, or PooledDataVector.
**Constructors**
```julia
DataFrame(columns::Vector, names::Vector{Symbol})
DataFrame(kwargs...)
DataFrame() # an empty DataFrame
DataFrame(t:... | campanja-forks/DataFrames.jl | src/dataframe/dataframe.jl | Julia | mit | 28,797 |
function SeisNMO(in;dt=0.001,offset=1000.,tnmo=0.,vnmo=1500.,max_stretch=1000)
nt,nx = size(in)
if length(offset) < size(in,2)
offset = offset[1]*ones(in,2)
end
# interpolate tau,v pairs to match sampling of input data
if (length(vnmo) == 1)
tnmo = convert(Float64,tnmo);
vnmo = convert(Float64,vnmo);
ti... | JuliaPackageMirrors/Seismic.jl | src/Processing/SeisNMO.jl | Julia | mit | 1,422 |
"""
Trace(stat, b=500, f=value)
Wrapper around an OnlineStat that stores `b` "snapshots" (a fixed copy of the OnlineStat). The snapshots
are taken at approximately equally-spaced intervals between 0 and the current `nobs`. The main use
case is visualizing state changes as observations are added.
# Example
... | joshday/OnlineStats.jl | src/stats/trace.jl | Julia | mit | 1,434 |
module EvolutionaryAction
# dependencies
#using Docile
#@docstrings
using FastaIO,
Phylogenetics
# export types and methods
export EvAc,
maketree!,
maketree,
rvevolutionarytrace!,
substlogodds!,
substlogodds,
evolutionaryaction!,
evolutionaryaction_global,
printlogodds,
readlogodds,
printe... | chrartin/EvolutionaryAction.jl | src/EvolutionaryAction.jl | Julia | mit | 576 |
# Automatically generated using Clang.jl wrap_c, version 0.0.0
using Compat
const OBJC_NEW_PROPERTIES = 1
const SUNDIALS_PACKAGE_VERSION = "2.5.0"
const SUNDIALS_DOUBLE_PRECISION = 1
const SUNDIALS_BLAS_LAPACK = 0
# const FLT_EVAL_METHOD = __FLT_EVAL_METHOD__
# Skipping MacroDefinition: FLT_ROUNDS ( __builtin_flt_ro... | christianhaargaard/Sundials.jl | src/sundials_h.jl | Julia | bsd-2-clause | 70,951 |
using Convex
using ECOS
# Summation.
println("Summation example")
x = Variable();
e = 0;
@time begin
for i = 1:1000
e += x;
end
p = minimize(e, x>=1);
end
@time solve!(p, ECOSSolver())
# Indexing.
println("Indexing example")
x = Variable(1000, 1);
e = 0;
@time begin
for i = 1:1000
e += x[i];
end
p... | ahwillia/Convex.jl | examples/paper_examples.jl | Julia | bsd-2-clause | 916 |
# Stricker Klaus 2020 - License is MIT: http://julialang.org/license
# ReadWriteDlm2 - rwd2_dateregex - https://github.com/strickek/ReadWriteDlm2.jl
"""
dfregex(df::AbstractString, locale::AbstractString=\"english\")
Create a regex string `r\"^...\$\"` for the given `Date` or `DateTime`
`format`string `df`.
The... | strickek/ReadWriteDlm2.jl | src/rwd2_dateregex.jl | Julia | mit | 4,622 |
open(joinpath(dirname(@__FILE__), "..", "latex.ts"), "w") do f
println(f, "export const latexSymbols = {")
# sort by name length and name content
symbols = sort(collect(Base.REPLCompletions.latex_symbols))
symbols = sort(symbols, by=x->length(x[1]))
for (name, sym) in symbols
println(f, " '\\$name': '$... | oijazsh/unicode-latex | src/scripts/gen_latex.jl | Julia | mit | 356 |
using WebSockets
function todict(rc::Tuple{Request, WebSocket})
req, client = rc
req′ = todict(req)
req′[:socket] = client
return req′
end
function wcatch(app, req)
try
app(req)
catch e
println(STDERR, "Error handling websocket connection:")
showerror(STDERR, e, catch_backtrace())
end
end
f... | JuliaPackageMirrors/Mux.jl | src/websockets_integration.jl | Julia | mit | 491 |
# syntax: proto3
mutable struct Empty <: ProtoType
__protobuf_jl_internal_meta::ProtoMeta
__protobuf_jl_internal_values::Dict{Symbol,Any}
__protobuf_jl_internal_defaultset::Set{Symbol}
function Empty(; kwargs...)
obj = new(meta(Empty), Dict{Symbol,Any}(), Set{Symbol}())
values = obj.__p... | tanmaykm/ProtoBuf.jl | src/google/empty_pb.jl | Julia | mit | 1,245 |
#2020 Klaus Stricker - Tests for ReadWriteDlm2
#License is MIT: http://julialang.org/license
# rwd2tests_1.jl
# 1st block modified standardtests
isequaldlm(m1, m2, t) = isequal(m1, m2) && (eltype(m1) == eltype(m2) == t)
@testset "1_ readdlm2" begin
@test isequaldlm(readdlm2(IOBuffer("1;2\n3;4\n5;6\n"), Floa... | strickek/ReadWriteDlm2.jl | test/rwd2tests_1.jl | Julia | mit | 16,092 |
## General
function treeadd_edges!(str,ops,node,M,labels)
labels[node]=str
nd=node+1
for op in ops
Main.Graphs.add_edge!(M,node,nd)
add_edges!(op,nd,M,labels)
nd+=treecount(op)
end
end
function introspect(A::Union{BandedOperator,Functional,Space})
@eval... | acarta/spatiotemp | ApproxFun/src/Plot/introspect.jl | Julia | mit | 3,926 |
import Colors: Colorant, Color, RGB, red, green, blue, parse, convert
import PyCall: @pyimport, PyObject
@pyimport cycler
import PyPlot: plt
# I need a way to convert the types from Colors.jl (RGB{8}(r, g, b) -> python tuple)
# this code is directly from PyCall.jl -> conversions.jl for tuple conversion
function PyObj... | gabrielgellner/OdinSon.jl | src/color.jl | Julia | mit | 1,944 |
## Computes a direct plug-in selector of the
## bandwidth for local linear regression as
## described in the 1996 J. Amer. Statist. Assoc.
## paper by Ruppert, Sheather and Wand.
function dpill(x::Vector{Float64}, y::Vector{Float64};
blockmax::Int = 5,
divisor::Int = 20,
tr... | JuliaPackageMirrors/KernSmooth.jl | src/dpill.jl | Julia | mit | 2,750 |
module ChainedVectors
import Base.show, Base.print_matrix,
Base.length, Base.size, Base.strides, Base.stride,
Base.similar, Base.vec, Base.bytestring,
Base.getindex, Base.setindex!,
Base.push!, Base.pop!, Base.shift!, Base.unshift!, Base.empty!,
Base.search, Base.beginswith,
... | JuliaPackageMirrors/ChainedVectors.jl | src/ChainedVectors.jl | Julia | mit | 700 |
using Mimi
@defcomp grosseconomy begin
YGROSS = Variable(index=[time]) #Gross output
K = Variable(index=[time]) #Capital
l = Parameter(index=[time]) #Labor
tfp = Parameter(index=[time]) #Total factor productivity
s = Parameter(index=[time]) #Savings rate
depk ... | JuliaPackageMirrors/Mimi.jl | examples/tutorial/01-one-region-model/one-region-model.jl | Julia | mit | 2,385 |
################################################# FILE DESCRIPTION #########################################################
# This file contains tests for algorithms.
############################################################################################################################
# Traversals
@testset "Al... | pranavtbhat/BSP.jl | test/algorithms.jl | Julia | mit | 1,455 |
using JFVM
import PyPlot
include("../functions/rel_perms_real.jl")
function polymer_viscosity(cs, cp)
a1 = 4.0
a2 = 0.0
a3 = 6.0
sp = -0.24
μ_w = 0.001 # Pa.s
return μ_w*(1.0+cp.*cs.^sp.*(a1+a2*cp+a3*cp.*cp))
end
# domain
Lx = 1.0
Ly = 1.0
Nx = 50
Ny = 10
m = createMesh2D(Nx, Ny, Lx, Ly)
# (... | simulkade/peteng | EOR/polymer_flood.jl | Julia | mit | 8,073 |
module LibOSXNative
#import Base: error, size
using Images, Color, Images.ColorTypes, FixedPointNumbers, Compat
export imread
imread(io::IOStream) = imread(readbytes(io))
function imread(b::Array{Uint8,1})
data = CFDataCreate(b)
imgsrc = CGImageSourceCreateWithData(data)
CFRelease(data)
read_and_release_img... | rened/Images.jl | src/ioformats/OSXnative.jl | Julia | mit | 16,665 |
type PageSize
xscale::Float64
yscale::Float64
units::String
end
type PlotFrame
graphTypes::Vector{Graph}
name::String
viewer::String
size::PageSize
title::String
xlabel::String
ylabel::String
xlim::Vector{Float64}
ylim::Vector{Float64}
legendInside::Bool
showLegend::Bool
legendPos::String
topAxis::Bool... | rennis250/Sparrow.jl | src/plotFrame.jl | Julia | mit | 1,624 |
struct RiskParameters{T} <: AbstractRisk{T}
sparks::Union{Nothing, AbstractVector}
susceptibility::Union{Nothing, AbstractVector}
infectivity::Union{Nothing, AbstractVector}
transmissibility::Union{Nothing, AbstractVector}
latency::Union{Nothing, AbstractVector}
removal::Union{Nothing, AbstractVector}
Ri... | jangevaa/Pathogen.jl | src/core/Risks/RiskParameters.jl | Julia | mit | 2,302 |
using Hexagons
using Test
convert(HexagonOffsetOddR, HexagonAxial(2, 4))
x, y = center(HexagonAxial(2, 3))
@test isapprox(x,7.06217782649107)
@test isapprox(y,5.5)
h = cube_round(23.5, 4.67)
collect(vertices(HexagonAxial(2, 3)))
| dcjones/Hexagons.jl | test/runtests.jl | Julia | mit | 233 |
#!/usr/bin/env julia
using Compose, Color, DataFrames, Base.Collections
import Base: isless
function weighted_color_mean{S <: Number}(
cs::AbstractArray{LAB,1}, ws::AbstractArray{S,1})
l = 0.0
a = 0.0
b = 0.0
sumws = sum(ws)
for (c, w) in zip(cs, ws)
w /= sumws
l += w * c.... | dcjones/isolator | extra/isolator-subway-plot.jl | Julia | mit | 7,538 |
using GlyphTools
using Base.Test
if VERSION.minor < 5
macro testset(name, block)
eval(block)
end
end
@testset "GlyphTools" begin
@testset "FreeType" begin
include("freetype.jl")
end
end
| wookay/GlyphTools.jl | test/runtests.jl | Julia | mit | 204 |
# Only run coverage from linux nightly build on travis.
get(ENV, "TRAVIS_OS_NAME", "") == "linux" || exit()
get(ENV, "TRAVIS_JULIA_VERSION", "") == "nightly" || exit()
Pkg.add("Coverage")
using Coverage
cd(Pkg.dir("AnonymousTypes")) do
Codecov.submit(Codecov.process_folder())
end
| MichaelHatherly/AnonymousTypes.jl | test/coverage.jl | Julia | mit | 295 |
const r = -3:6
const v = collect(r)
const v2 = 1.:10.
const m = reshape(1:100, 10, 10)
const m2 = reshape(1:35, 5, 7)
const args = [
:(), # nil
:(r,), # vec (range)
:(v,), # vec (array)
:(v',), ... | JuliaPackageMirrors/Winston.jl | test/plot.jl | Julia | mit | 1,223 |
# polygon benchmarks
using Luxor, BenchmarkTools, TimerOutputs
const to = TimerOutput()
function testpoly()
pgon = star(O, 201.9, 23, 0.8, π / 2, vertices = true)
@timeit to "polycentroid" begin
for i in 1:10
pc = polycentroid(pgon)
end
end
@timeit to "polyportion" begin
... | cormullion/Luxor.jl | benchmark/polybenchmarks.jl | Julia | mit | 7,117 |
module YARS
export yars_start, yars_send_reset, yars_send_quit, yars_send_message
export yars_send_actuator_commands, yars_read_sensors
export yars_read_float, yars_send_float
export yars_read_string, yars_send_string
export yars_read_int, yars_send_int
export yars_read_float_vector, yars_send_float_vector
expor... | kzahedi/YARS.jl | src/YARS.jl | Julia | mit | 6,811 |
module TestIntegrate
using Calculus2
using Base.Test
@test isapprox(
integrate(x -> 1 / x, 1.0, 2.0),
log(2) - log(1)
)
@test isapprox(
integrate(x -> -sin(x), 0.0, pi),
(cos(pi) - cos(0.0))
)
@test isapprox(
integrate(x -> 1, 0, 1),
1.0 - 0... | johnmyleswhite/Calculus2.jl | test/api/integrate.jl | Julia | mit | 1,520 |
#=
Copyright (c) 2015, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the follo... | JuliaPackageMirrors/ParallelAccelerator.jl | src/api.jl | Julia | bsd-2-clause | 8,734 |
using IterativeSolvers
using FactCheck
facts("rsvd_fnkz") do
context("Rank 2 matrix") do
A = reshape(1:64,8,8)
S = rsvd_fnkz(A, 2, ϵ=1e-9)
@fact vecnorm(A - S[:U]*Diagonal(S[:S])*S[:Vt]) --> less_than(1e-9)
end
context("Linearly dependent matrix") do
A = [collect(1:8) collect(1:8) collect(1:8) collec... | mschauer/IterativeSolvers.jl | test/rsvd_fnkz.jl | Julia | mit | 633 |
# FixMe! Right now the MPI workers are deduced from the DArrays, but if a DArray is distributed on fewer workers that what consistutes the MPI world, then this approach will fail.
type RemoteElementalMatrix
refs::Matrix{Any}
end
function toback{T<:BlasFloat,S<:StridedMatrix}(A::DArray{T,2,S})
rs = Array(Any, ... | JuliaPackageMirrors/Elemental.jl | src/julia/darray.jl | Julia | mit | 8,887 |
#
# y1 +------+
# | |
# | |
# | |
# y0 +------+
# x0 x1
#
struct Rectangle
x0::Float64
x1::Float64
y0::Float64
y1::Float64
end
Rectangle() = Rectangle(NaN, NaN, NaN, NaN)
Rectangle(lowerleft::Point, upperright::Point) =
Rectangle(lowerleft.x, lowerleft.y, upper... | nolta/Winston.jl | src/geom.jl | Julia | mit | 3,639 |
const c=299792458.
function IC(l,p,h,X,Y,Z,tilt,azimut,phase,amplitude,order)
const Rx=vcat([1 0 0],[0 -1 0],[0 0 -1])
const Ry=vcat([-1 0 0],[0 1 0],[0 0 -1])
const Rz=vcat([-1 0 0],[0 -1 0],[0 0 1])
const i0=amplitude*[sin(tilt).*cos(azimut), sin(tilt).*sin(azimut), cos(tilt)]
POS=zeros((order+1)^3*... | manuamador/Stirrer | ImageCreator.jl | Julia | mit | 1,138 |
module MixedTests
using Interpolations, Base.Test
A = rand(6,5)
knots = (collect(linspace(1,size(A,1),size(A,1))),collect(linspace(1,size(A,2),size(A,2))))
itp = @inferred(interpolate(knots, A, (Gridded(Linear()),NoInterp())))
@inferred(getindex(itp, 2, 2))
@inferred(getindex(itp, CartesianIndex((2,2))))
for j = 2:si... | JuliaPackageMirrors/Interpolations.jl | test/gridded/mixed.jl | Julia | mit | 744 |
using Flow
using Base.Test
# write your own tests here
@test 1 == 1
| farrellm/Flow | test/runtests.jl | Julia | mit | 69 |
# Basic Table tests
import STables
using Test
using DataFrames
using Dates
import DelimitedFiles
# create table with test data
function create_table_a()
col_names = [:C_STRING, :C_INT, :C_FLOAT, :C_NSTRING, :C_NINT, :C_NFLOAT]
col_types = [String, Int, Float64, Union{Missing, String}, Union{Missi... | felipenoris/Tables.jl | test/runtests.jl | Julia | mit | 23,045 |
@testset "SArray" begin
@testset "Inner Constructors" begin
@test SArray{Tuple{1},Int,1,1}((1,)).data === (1,)
@test SArray{Tuple{1},Float64,1,1}((1,)).data === (1.0,)
@test SArray{Tuple{2,2},Float64,2,4}((1, 1.0, 1, 1)).data === (1.0, 1.0, 1.0, 1.0)
# Bad input
@test_throws... | andyferris/StaticArrays.jl | test/SArray.jl | Julia | mit | 7,629 |
## Adapted from doc/libsundials-serial-dev/examples/ida/serial/idaRoberts_dns.c and
## sundialsTB/ida/examples_ser/midasRoberts_dns.m
## /*
## * -----------------------------------------------------------------
## * $Revision: 1.2 $
## * $Date: 2009/01/21 21:46:40 $
## * ----------------------------... | JuliaLang/Sundials.jl | test/ida_Roberts_dns.jl | Julia | bsd-2-clause | 3,664 |
#!/usr/bin/env julia
include("sedor20.jl")
push!(PGFPlotsX.CUSTOM_PREAMBLE, raw"\usepackage{fontspec}")
push!(PGFPlotsX.CUSTOM_PREAMBLE, raw"\setmainfont{Asana-Math}")
cas = [Dict(:label => "tumör", :caexpr => "C00-D48"),
Dict(:label => "COVID-19", :caexpr => "U07-U07"),
Dict(:label => "cirkulation", :caexpr=>"... | klpn/static-dust | postdata/2020-11-21-prio/se_cirk_cov_tum_2020h1.jl | Julia | bsd-3-clause | 645 |
using POMCP
using Base.Test
using POMDPModels
using POMDPs
using POMDPToolbox
using ParticleFilters
using NBInclude
pc = ParticleCollection([1,2])
solver = POMCPSolver(estimate_value=RolloutEstimator(FeedWhenCrying()),
eps=0.01,
c=10.0,
tree_queries=50,
... | sisl/POMCP.jl | test/runtests.jl | Julia | mit | 1,747 |
## header to provide surface and context
using Cairo
using Printf
c = CairoRGBSurface(256,256);
cr = CairoContext(c);
save(cr);
set_source_rgb(cr,0.8,0.8,0.8); # light gray
rectangle(cr,0.0,0.0,256.0,256.0); # background
fill(cr);
restore(cr);
save(cr);
set_font_face(cr, "Sans 16")
text(cr,40.0,40.0,"E<span for... | JuliaLang/Cairo.jl | samples/sample_pango_text1.jl | Julia | mit | 838 |
# This file was copied from Transducers.jl
# which is available under an MIT license (see LICENSE).
using PkgBenchmark
mkconfig(; kwargs...) =
BenchmarkConfig(
env = Dict(
"JULIA_NUM_THREADS" => "1",
);
kwargs...
)
group_target = benchmarkpkg(
dirname(@__DIR__),
mkc... | JuliaCollections/DataStructures.jl | benchmark/runjudge.jl | Julia | mit | 588 |
#
# ICU - International Components for Unicode
#
module ICU
export set_locale
export U_FAILURE,
U_SUCCESS,
# ubrk
UBRK_CHARACTER,
UBRK_LINE,
UBRK_SENTENCE,
UBRK_TITLE,
UBRK_WORD,
UBreakIterator,
ubrk_close,
ubrk_next,
ubrk_open,
ub... | nalimilan/ICU.jl | src/ICU.jl | Julia | mit | 18,371 |
# Julia wrapper for header: /usr/include/scip/scip_branch.h
# Automatically generated using Clang.jl wrap_c
function SCIPincludeBranchrule(scip, name, desc, priority, maxdepth, maxbounddist, branchcopy, branchfree, branchinit, branchexit, branchinitsol, branchexitsol, branchexeclp, branchexecext, branchexecps, branch... | SCIP-Interfaces/SCIP.jl | src/wrapper/scip_branch.jl | Julia | mit | 9,941 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.