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 |
|---|---|---|---|---|---|
# Hock and Schittkowski problem number 2.
#
# Source:
# Problem 2 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 PBR2-AN-2-0
#
# A. Montoison, Montreal, 0... | dpo/OptimizationProblems.jl | src/hs2.jl | Julia | mit | 589 |
@inline sqr(x) = x*x
@inline cub(x) = x*x*x
| JuliaPackageMirrors/Interpolations.jl | src/utils.jl | Julia | mit | 44 |
module BismarkSummary
# package code goes here
export parse_bismark_report
export get_bismark_report_filenames_from_plite_pipeline
export parse_bismark_reports
export add_report_info_to_datasource!
export make_bismark_report
export bismark_report
include(Pkg.dir("BismarkSummary","src","bismark-report.jl"))
export mak... | nw11/BismarkSummary.jl | src/BismarkSummary.jl | Julia | mit | 419 |
const Coord = SVector{4, Float64}
const Coord234 = Union{SVector{2, Float64}, SVector{3, Float64}, SVector{4, Float64}}
"""
Transformation(source_crs, target_crs; area=C_NULL, ctx=C_NULL, always_xy=false)
Create a Transformation that is a pipeline between two known coordinate reference systems.
Transformation imp... | FugroRoames/Proj4.jl | src/coord.jl | Julia | mit | 7,934 |
export ft_setflowcontrol
export FT_FLOW_NONE, FT_FLOW_RTS_CTS, FT_FLOW_DTR_DSR, FT_FLOW_XON_XOFF
#Flow Control (see ft_setflowcontrol)
const FT_FLOW_NONE = 0x0000
const FT_FLOW_RTS_CTS = 0x0100
const FT_FLOW_DTR_DSR = 0x0200
const FT_FLOW_XON_XOFF = 0x0400
function ft_setflowcontrol(ft_handle::Culong, flowcontro... | cstook/FTD2XX.jl | src/ft_setflowcontrol.jl | Julia | mit | 826 |
# type definition for Evolutionary Action object
# with fields for alignment, tree, evolutionary trace measure,
# substitution log-odds scores, and evolutionray action measure
type EvAc
alphabet::Array{Char,1}
aln::Array{Any,1}
phy::Phylo
odds::Array{Float64,2}
et::Array{Float64,1}
ea::Array{Float64,2}
# contr... | chrartin/EvolutionaryAction.jl | src/typedefs.jl | Julia | mit | 836 |
type AdiaComputer <: QuComput
###########################################
# Eternal
###########################################
HB::AbstractMatrix # Base Hamiltonian
HP::AbstractMatrix # Problem Hamiltonian
maxtime::Real # max evolution time
n::Int64 # number o... | Roger-luo/QuCmp | src/Adiabatic/Base.jl | Julia | mit | 1,745 |
#=
Copyright (c) 2015, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the followi... | IntelLabs/CompilerTools.jl | src/alias-analysis.jl | Julia | bsd-2-clause | 15,748 |
using FormulationLattice
using Base.Test
let
@Literals(A, B, C, D)
cl = A ∨ ((B ∨ C) ∧ D)
formtrack = FormulaState[]
cl2 = dnf(cl, formtrack)
@test cl2 == A ∨ (B ∧ D) ∨ (C ∧ D)
end
let
@Literals(A, B, C, D)
cl = (A ∨ B) ∧ (C ∨ D)
formtrack = FormulaState[]
cl2 = dnf(cl, formtrack)
... | joehuchette/FormulationLattice.jl | test/runtests.jl | Julia | mit | 3,104 |
module WCSLIB
export pscard,
pvcard,
wcsprm
export wcsbchk,
#wcsbdx,
wcsbth,
wcscopy,
wcserr_enable,
wcserr_prt,
wcsfree,
wcshdo,
#wcsidx,
wcsini,
#wcsmix,
wcsmodify,
wcsnps,
wcsnpv,
wcsp2s,
wcsperr,... | kbarbary/WCSLIB.jl | src/WCSLIB.jl | Julia | mit | 7,152 |
import LinearAlgebra
export ucase,
ucrss,
uddf,
union,
unitim,
unload,
unorm,
unormg,
utc2et
function _ucase(in)
n = length(in) + 1
out = Array{SpiceChar}(undef, n)
ccall((:ucase_c, libcspice), Cvoid, (Cstring, SpiceInt, Ref{SpiceChar}),
in, n, out)
chararray_... | helgee/SPICE.jl | src/u.jl | Julia | mit | 5,311 |
import Polyhedra # needed for some algorithms
using Reachability: constrained_dimensions
include("models/bouncing_ball.jl")
include("models/thermostat.jl")
models = [bouncing_ball, thermostat]
for model in models
system, options = model()
# --- reachability algorithms ---
# default algorithm
sol = ... | JuliaReach/Reachability.jl | test/Reachability/solve_hybrid.jl | Julia | mit | 2,150 |
module TestHash
using Test
using CategoricalArrays
@testset "hash() for CategoricalPool{Int} and CategoricalPool{Float64} and its values" begin
pool1 = CategoricalPool([1, 2, 3])
pool2 = CategoricalPool([2.0, 1.0, 3.0])
@test (hash(pool1) == hash(pool1)) === true
@test (hash(pool1) == hash(pool2)) ===... | nalimilan/CategoricalArrays.jl | test/09_hash.jl | Julia | mit | 3,260 |
preptime(layers) = 2 * layers
remaining_time(current_time) = 60 - current_time
total_working_time(layers, current_time) = preptime(layers) + current_time
| exercism/xjulia | exercises/concept/lasagna/.meta/exemplar.jl | Julia | mit | 154 |
module Probs
include("./samplesGenerator.jl")
export generateChanges
# export ifDetected, notDetected, extractFps, extractTps, belowH, aboveH
function ifDetected(cde::Int64, changes::Vector{Int64}, delay::Int64)
# 1) If change detection event is TP
for chp in changes
if abs(chp - cde) <= delay
... | av-maslov/Pccf | src/lib/probs.jl | Julia | mit | 4,760 |
module SuffixArrays
export suffixsort
immutable SuffixArray{S<:String,N<:Signed}
string::S
n::Int
index::Array{N,1}
end
function SuffixArray{S}(s::S)
n = length(s)
index = zeros(n < 256 ? Int8 :
n < 65536 ? Int16 :
n < 4294967296 ? Int32 : Int64,n)
return Suffi... | bicycle1885/SuffixArrays.jl | src/SuffixArrays.jl | Julia | mit | 1,076 |
using TimeSeries, 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 st... | multidis/TimeSeries.jl | test/readwrite.jl | Julia | mit | 1,065 |
mutable struct ResultChannel <: AbstractChannel{Result}
current_result::Result
ResultChannel(result::Result) = new(result)
end
function put!(channel::ResultChannel, result::Result)
if result.cost_minimum < channel.current_result.cost_minimum
channel.current_result = result
end
channel
end
... | phrb/StochasticSearch.jl | src/util/resultchannel.jl | Julia | mit | 453 |
using SimIndex
using Base.Test
using Distances
println("Building an index on 1,000 1-dimensional points with Euclidean distance...")
si = SimIndex.Index(collect(1:1000), k=20, d=euclidean)
er = SimIndex.test_error_ratio(si)
println("Error ratio: $(er)")
println("")
@test er < 2.0
println("Building an index on 8,000 5... | aaw/SimIndex.jl | test/tests.jl | Julia | mit | 1,467 |
import Base: +, -, /, *, mean, maximum, minimum, isequal, ==
# +
function +(vi1::VolumeImage, vi2::VolumeImage)
dimensions_equal(vi1, vi2)
debug("Adding two volume images with $(size(vi1.data, 4)) time instances")
vout = deepcopy(vi1)
vout.data = vi1.data .+ vi2.data
return vout
end
# -
f... | JuliaPackageMirrors/EEG.jl | src/types/VolumeImage/Operations.jl | Julia | mit | 4,095 |
function KS_solve_MGC_cg( pw::PWGrid, V_ionic, Focc, Nstates::Int;
psi0=nothing, Potentials0 = nothing,
α_t = 3e-5, NiterMax=1000, verbose=false )
Ns = pw.Ns
Npoints = prod(Ns)
Ngwx = pw.gvecw.Ngwx
Ω = pw.Ω
if psi0 == nothing
srand(2222... | f-fathurrahman/ffr-ElectronicStructure.jl | PW/dft_02/KS_solve_MGC_cg.jl | Julia | mit | 4,980 |
using JLD2, Test
struct SingleFieldWrapper{T}
x::T
end
Base.:(==)(a::SingleFieldWrapper, b::SingleFieldWrapper) = a.x == b.x
struct MultiFieldWrapper{T}
x::T
y::Int
end
Base.:(==)(a::MultiFieldWrapper, b::MultiFieldWrapper) = (a.x == b.x && a.y == b.y)
struct UntypedWrapper
x
end
Base.:(==)(a::Untype... | simonster/JLD2 | test/customserialization.jl | Julia | mit | 7,312 |
include("../emi.jl")
using EMI
using EMI.Draw, EMI.Gmsh
# Something like this with circular
# ^
# / \
# [ ]
# \ /
# U
const R, dx, dy = 1, 0.2, 0.3
loop = Loop([Line(Point(0, R+dy+dx), Point(0, R+dy)),
Line(Point(0, R+dy), Point(dy, R+dy)),
CircleArc(Point(dy, R+dy), Point(R+dy, R+... | MiroK/emi-cylinders | emi.jl/demos/circular_cell.jl | Julia | mit | 1,365 |
# An experimental d3 backend for compose.
export D3
# In d3 svg we use millimeters as the base measure.
type D3Measure <: NativeMeasure
value::Float64
end
*(u::Float64, v::D3Measure) = D3Measure(u * v.value)
+(u::D3Measure, v::D3Measure) = D3Measure(u.value + v.value)
-(u::D3Measure, v::D3Measure) = D3Measure(... | Keno/Compose.jl | src/d3.jl | Julia | mit | 12,418 |
using DataFrames, LowRankModels
# boolean example with only entries greater than threshold t observed
# ie, censored data
# example with only entries greater than threshold t observed
m,n,k,ktrue = 100,100,1,1
A = rand(m,ktrue)*rand(ktrue,n)
println("max value of A is ",maximum(maximum(A))," which is less than $ktrue"... | zhmz90/LowRankModels.jl | examples/precision_at_k.jl | Julia | mit | 1,248 |
abstract FixedArray{T, NDim, SIZE}
abstract MutableFixedArray{T, NDim, SIZE} <: FixedArray{T, NDim, SIZE}
typealias MutableFixedVector{T, CARDINALITY} MutableFixedArray{T, 1, Tuple{CARDINALITY}}
typealias MutableFixedMatrix{T, M, N} MutableFixedArray{T, 2, Tuple{M,N}}
typealias FixedVector{CARDINALITY, T} ... | JuliaPackageMirrors/FixedSizeArrays.jl | src/core.jl | Julia | mit | 8,421 |
#
# This file is part of the Actors.jl Julia package,
# MIT license, part of https://github.com/JuliaActors
#
"""
newLink(size=32; remote=false, pid=myid(), mode=nothing)
Create a local Link with a buffered `Channel` `size ≥ 1`.
# Parameters
- `size=32`: the size of the channel buffer,
- `remote=false`: should ... | daqcore/Actors.jl | src/links.jl | Julia | mit | 1,346 |
# example 3: read with readall
# default return type (ASCIIString)
module FastaReadExample3
using FastaRead
function read_fasta_file(filename::String)
fr = FastaReader(filename)
out = readall(fr)
n = 0
for (name, seq) in out
n += 1
println("num=$n name=$name seq=$seq")
... | carlobaldassi/FastaRead.jl | examples/example_3.jl | Julia | mit | 517 |
#############################################################################
# MathProgBase.jl
#############################################################################
# test/conininterface.jl
# Test the MathProgBase.jl interface for a provided conic solver.
#######################################################... | tkelman/MathProgBase.jl | test/conicinterface.jl | Julia | mit | 11,561 |
# IJulia hooks for displaying plots with RCall
# TODO: create a special graphics device. This would allow us to not accidently close devices opened by users, and display plots immediately as they appear.
ijulia_mime = nothing
"""
Set options for R plotting with IJulia.
The first argument should be a MIME object: cu... | JuliaStats/RCall.jl | src/ijulia.jl | Julia | mit | 2,877 |
fe1ph(v::Vector{Int64}) = hist(v)[2] ./ size(v)[1]
function fe2p(v::Matrix{Int64}) # frequency estimation of one dimensional probability
@assert (size(v)[2] == 2) "fe2p requires two columns."
m1 = maximum(v[:,1])
m2 = maximum(v[:,2])
r = counts(v[:,1], v[:,2], (1:m1, 1:m2))
l = size(v)[1]
r = r ./ l
... | kzahedi/Shannon.jl | src/distribution.jl | Julia | mit | 1,805 |
using Compose
imgs = [SVG("arc_sector.svg", 7cm, 7cm),
PDF("arc_sector.pdf", 7cm, 7cm)]
a = range(-0.5π, stop=1.5π, length=13)
colv = repeat(["white","black"], outer=6)
img = compose(context(),
(context(), sector([0.5], [0.5], [0.4], a[1:12], a[2:13]), fill(colv)),
(context(order=2), arc([0.5],... | dcjones/Compose.jl | test/examples/arc_sector.jl | Julia | mit | 470 |
#############################################################################
# constant.jl
# Defines Constant, which is a subtype of AbstractExpr
#############################################################################
export Constant
export vexity, evaluate, sign, conic_form!
type Constant <: AbstractExpr
hea... | ahwillia/Convex.jl | src/constant.jl | Julia | bsd-2-clause | 1,299 |
function (p::Array{Float64, 1}, q::Array{Float64, 1})
a = (p - q)^2
b = p + q
a[abs(b) < 1e-12] = 0.0
b[abs(b) < 1e-12] = 1.0
r = a / b
return 0.5*sum(r)
| vladpopovici/WSItk | WSItk/fast/pdist.jl | Julia | mit | 198 |
using Distributions
using JSON
a = 0
b = 1
c = 0.5
d = TriangularDist( a,b,c )
x = linspace( 0, 1, 25 )
dmgf(t) = mgf(d, t )
y = map( dmgf, x )
println( y )
data = Dict([
("a", a),
("b", b),
("c", c),
("data", x),
("expected", y)
])
outfile = open("./test/fixtures/matrix.json", "w")
JSON.json(data)
write( ou... | distributions-io/triangular-mgf | test/fixtures/test.matrix.jl | Julia | mit | 345 |
module BitcoinBlockchain
export BitcoinBlockchainHandler,
connect,
subscribe_unconfirmed_transcations,
subscribe_new_blocks,
get_block,
get_transaction,
get_address
include("client.jl")
end
| stejin/BitcoinBlockchain.jl | src/BitcoinBlockchain.jl | Julia | mit | 258 |
# Julia wrapper for header: /usr/local/include/libavutil/opt.h
# Automatically generated using Clang.jl wrap_c, version 0.0.0
export
av_find_opt,
av_set_string3,
av_set_double,
av_set_q,
av_set_int,
av_get_double,
av_get_q,
av_get_int,
av_get_string,
av_next_option,
av_opt_... | JuliaPackageMirrors/VideoIO.jl | src/libav/AVUtil/v51/opt.jl | Julia | mit | 6,734 |
# centroid is the geometric centre
centroid(x) = x
centroid(d::Circle) = d.center
centroid(d::IntervalOrSegment) = mean((first(d),last(d)))
# dist and dist2 are the nearest distance and distance-squared between x and y
dist(x,y) = sqrt(dist2(x,y))
dist2(x,y) = dist(x,y)^2
dist2(x::Number,y::Number) = abs2(x-y)
dis... | ApproxFun/SingularIntegralEquations.jl | src/GreensFun/Geometry.jl | Julia | bsd-3-clause | 3,562 |
using ApproxFun, MultivariateOrthogonalPolynomials, BlockArrays, SpecialFunctions, FillArrays, Plots
import ApproxFun: blockbandwidths, Vec, PiecewiseSegment
import MultivariateOrthogonalPolynomials: DirichletTriangle
#######
# Example 1 Poisson
#######
S = TriangleWeight(1,1,1,JacobiTriangle(1,1,1))
Δ = Laplacian(... | ApproxFun/DiskFun.jl | examples/triangleexamples.jl | Julia | mit | 11,170 |
"""
Exported module that provides build and deploy dependencies and related functions.
Currently only [`pip`](@ref) is implemented.
"""
module Deps
export pip
using DocStringExtensions
"""
$(SIGNATURES)
Installs (as non-root user) all python packages listed in `deps`.
# Examples
```julia
using Documenter
makedo... | MichaelHatherly/Lapidary.jl | src/Deps.jl | Julia | mit | 826 |
"""
IS()
Importance sampling algorithm.
Note that this method is particle-based, and arrays of variables
must be stored in a [`TArray`](@ref) object.
Usage:
```julia
IS()
```
Example:
```julia
# Define a simple Normal model with unknown mean and variance.
@model gdemo(x) = begin
s² ~ InverseGamma(2,3)
... | yebai/Turing.jl | src/inference/is.jl | Julia | mit | 1,499 |
using Turing, Test
N = 5
setchunksize(4*N)
alg = HMC(0.2, 4)
@model vdemo(::Type{T}=Float64) where {T} = begin
v = Vector{Matrix{T}}(undef, N)
@. v ~ Wishart(7, [1 0.5; 0.5 1])
end
t_vec = @elapsed res_vec = sample(vdemo(), alg, 1000)
@model vdemo() = begin
v = Vector{Matrix{Real}}(undef, N)
for i = 1:N
... | yebai/Turing.jl | test/skipped/vec_assume_mat.jl | Julia | mit | 417 |
facts("Interface.") do
context("Module.") do
@fact isempty(Docile.Interface.documented()) --> false
@fact typeof(Docile.Interface.documented()) --> Set{Module}
@fact Docile.Interface.isdocumented(Docile) --> true
@fact Docile.Interface.isdocumented(Docile.Interface) -->... | MichaelHatherly/Docile.jl | test/Interface/facts.jl | Julia | mit | 3,704 |
# 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... | mbaijal/incubator-mxnet | julia/examples/char-lstm/lstm.jl | Julia | apache-2.0 | 5,561 |
# Aminoacids
# ==========
#
# The amino acid type.
#
# This file is a part of BioJulia.
# License is MIT: https://github.com/BioJulia/Bio.jl/blob/master/LICENSE.md
"Type representing AminoAcids"
bitstype 8 AminoAcid
# Conversion from/to integers
# ---------------------------
Base.convert(::Type{AminoAcid}, aa::UInt... | richardreeve/Bio.jl | src/seq/aminoacid.jl | Julia | mit | 6,298 |
# 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... | cpcloud/arrow | julia/Arrow/src/metadata/Message.jl | Julia | apache-2.0 | 8,064 |
using Gadfly, DataArrays, RDatasets
plot(dataset("ggplot2", "diamonds"), x=:Price, Geom.histogram(bincount=30))
| joehuchette/Gadfly.jl | test/histogram_explicit_bins.jl | Julia | mit | 117 |
function ActivateLicense(env::AWSEnv, msg::ActivateLicenseType)
ec2resp::EC2Response = call_ec2(env, "ActivateLicense" , msg)
if (ec2resp.pd != nothing) && (ec2resp.obj == nothing)
ec2resp.obj = ActivateLicenseResponseType(ec2resp.pd)
end
ec2resp
end
function ActivateLicense(env::AWSEnv; kwargs... | tkelman/AWS.jl | src/ec2_operations.jl | Julia | mit | 81,190 |
@testset "ESS" begin
@model demo(x) = begin
m ~ Normal()
x ~ Normal(m, 0.5)
end
demo_default = demo(1.0)
@model demodot(x) = begin
m = Vector{Float64}(undef, 2)
@. m ~ Normal()
x ~ Normal(m[2], 0.5)
end
demodot_default = demodot(1.0)
@turing_testset ... | yebai/Turing.jl | test/inference/ess.jl | Julia | mit | 1,698 |
module EXT_TEST
export EXT_TEST_hmmalign
export EXT_TEST_hmmsearch
export EXT_TEST_cmsearch
######################################################################
# FUNCTION: EXT_TEST_hmmalign
######################################################################
function EXT_TEST_hmmalign()
try
ru... | christophfeinauer/PdbTool.jl | src/EXT_TEST.jl | Julia | mit | 1,052 |
t1 = time_ns() #tic()
if ispath("wavDir") == false
mkdir("wavDir")
end
include("snd_process_tests.jl")
include("test_AMTone.jl")
include("test_AMToneIPD.jl")
include("test_asynchChord.jl")
include("test_complexTone.jl")
include("test_expAMNoise.jl")
include("test_expSinFMTone.jl")
include("test_FMComplexTone.jl")
... | sam81/SndLib.jl | test/runtests.jl | Julia | mit | 747 |
#################################################################################
#
# EllCrv/Misc.jl : Misc functions
#
# This file is part of Hecke.
#
# Copyright (c) 2015, 2016: Claus Fieker, Tommy Hofmann
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modi... | thofma/Hecke.jl | src/EllCrv/Misc.jl | Julia | bsd-2-clause | 6,646 |
#=
Copyright (c) 2015, Intel Corporation
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 following disclaime... | IntelLabs/Latte.jl | src/optimizers/fusion.jl | Julia | bsd-3-clause | 5,748 |
import accrue.cryptoerase.runtime.Condition;
class C {
Condition c;
final int{L /c H} x = 7;
void m() {
this.x = 7;
}
public static void main(String[] args) {
new C().m();
}
}
| HarvardPL/cryptoerase | tests/Bad03.jl | Julia | bsd-3-clause | 203 |
# System module.
module System
import PyCall: pyimport, pycall
export LIB_SKL_AVAILABLE,
LIB_CRT_AVAILABLE
function check_py_dep(package::String)
is_available = true
try
pyimport(package)
catch
is_available = false
end
return is_available
end
function check_r_dep(package::String)
is_avail... | JuliaPackageMirrors/Orchestra.jl | src/system.jl | Julia | mit | 615 |
module TestServices
using FactCheck
using Bio
end # TestServices | NPalopoli/Bio.jl | test/services/test_services.jl | Julia | mit | 66 |
export Backend, CPUBackend, AbstractGPUBackend
export init, shutdown, registry_reset, registry_put
abstract Backend
typealias ParameterRegistry Dict{AbstractString, Vector{AbstractParameter}}
import Base.show
export show
show(io::IO, backend::Backend) = show(io, typeof(backend))
function init(backend::Backend)
end
f... | r9y9/Mocha.jl | src/backend.jl | Julia | mit | 1,422 |
#MM dictionary
function MMwithRedirects(mm::Dict{Int64,Int64})
mmr = Dict{Int64,Int64}()
for m in mm
finID = m[2]
while true
if haskey(mm, finID)
finID = mm[finID]
else
break;
end
end
mmr[m[1]] = deepcopy(finID)
end
return mmr
end
# point to the first instance... | dehann/Caesar.jl | data/datasets/victoriapark/Vic120MM.jl | Julia | mit | 11,530 |
function creategrid(;xrange::(Real, Real)=(-1,1), yrange::(Real, Real)=(-1,1), zrange::(Real, Real)=(-1,1), camera=pcamera)
xyplane = genquad(Vec3(0, 0, 0), Vec3(1, 0, 0), Vec3(0, 1, 0))
zyplane = genquad(Vec3(0, 0, 0), Vec3(0, 0, 1.2), Vec3(0, 1, 0))
zxplane = genquad(Vec3(0, 1, 0), Vec3(0, 0, 1.2), Vec3(1, 0, 0))
... | SimonDanisch/Romeo.jl | src/visualize/grid.jl | Julia | mit | 1,042 |
function flatten(data::Vector)
res = Int[]
for x in data
append!(res, x)
end
res
end
function encode(dict::IdDict, data::Vector)
chars = Int[]
tags = Int[]
for sent in data
for items in sent
char, tag = items[1], items[2]
charid = push!(dict, string(c... | hshindo/JukaiNLP.jl | src/dev/tokenization_sentence/train.jl | Julia | mit | 2,175 |
module Languages
using Compat
export Language, EnglishLanguage, SpanishLanguage, GermanLanguage
export isocode, name
export articles, definite_articles, indefinite_articles
export prepositions
export pronouns
export stopwords
cache = Dict()
include("types.jl")
include("utils.jl")
include("word_lists.jl")
en... | JuliaPackageMirrors/Languages.jl | src/Languages.jl | Julia | mit | 322 |
#
# This file is part of the Actors.jl Julia package,
# MIT license, part of https://github.com/JuliaActors
#
using Actors, Distributed, Test
import Actors: spawn
length(procs()) == 1 && addprocs(1)
if length(workers()) > 0
# @everywhere using Pkg
# @everywhere Pkg.activate(".")
@everywhere using Actors... | daqcore/Actors.jl | test/test_distr.jl | Julia | mit | 685 |
using GeneOntology
using Base.Test
const testdir = dirname(@__FILE__)
include("test_term.jl")
include("test_typedef.jl")
include("test_annotation.jl")
include("test_parser.jl")
include("test_graph.jl")
| bicycle1885/GeneOntology.jl | test/runtests.jl | Julia | mit | 204 |
export
putstreamfunc,
putcallbackfunc
function msk_stream_callback_wrapper(userdata::Ptr{Void}, msg :: Ptr{Uint8})
f = unsafe_pointer_to_objref(userdata) :: Function
f (bytestring(msg))
convert(Int32,0)::Int32
end
function putstreamfunc(t::MSKtask, whichstream:: Int32, f :: Function)
cbfunc = cfunction(ms... | iamed2/Mosek.jl | src/msk_callback.jl | Julia | mit | 2,432 |
"""
The `SIFTS` module of MIToS allows to obtain the
residue-level mapping between databases stored in the SIFTS XML files.
It makes easy to assign PDB residues to UniProt/Pfam positions.
Given the fact that pairwise alignments can lead to misleading association between residues in both sequences,
SIFTS offers more re... | JuliaPackageMirrors/MIToS.jl | src/SIFTS/SIFTS.jl | Julia | mit | 1,129 |
add_verbose_scope(:NfMaximalOrder)
add_assert_scope(:NfMaximalOrder)
set_verbose_level(:NfMaximalOrder, 1)
include("NfMaximalOrder/NfMaximalOrder.jl")
include("NfMaximalOrder/Ideal.jl")
include("NfMaximalOrder/Zeta.jl")
include("NfMaximalOrder/FracIdeal.jl")
include("NfMaximalOrder/Clgp.jl")
include("NfMaximalOrder/G... | fredrik-johansson/hecke | src/NfMaximalOrder.jl | Julia | bsd-2-clause | 379 |
#################### Dependent ####################
const depfxargs = [(:model, :Model)]
#################### Base Methods ####################
function Base.show(io::IO, d::AbstractDependent)
msg = string(ifelse(isempty(d.monitor), "An un", "A "),
"monitored node of type \"", summary(d), "\"\n")
... | JuliaPackageMirrors/Mamba.jl | src/model/dependent.jl | Julia | mit | 5,757 |
export GitIndex, GitIndexEntry, add_bypath!, write_tree!, write!, reload!, clear!,
remove!, removedir!, read_tree!, add_all!, update_all!,
remove_all!, has_conflicts, add!, is_fully_merged, conflicts
type GitIndex
ptr::Ptr{Void}
function GitIndex(ptr::Ptr{Void})
@assert ptr != C_NULL
... | jakebolewski/LibGit2.jl | src/index.jl | Julia | mit | 11,163 |
isdefined(Base, :__precompile__) && __precompile__()
module Calculus
import Compat
import Base.ctranspose
export check_derivative,
check_gradient,
check_hessian,
check_second_derivative,
deparse,
derivative,
differentiate,
hessian... | JuliaPackageMirrors/Calculus.jl | src/Calculus.jl | Julia | mit | 1,694 |
using Bokeh
using Compat
if VERSION < v"0.4-"
using Dates
else
using Base.Dates
end
autoopen(true)
plotfile("dates1.html")
# this simple example uses unix time stamps for datetimes
epoch = DateTime(1970, 1, 1)
@compat n = Int(now() - epoch) # ms
# 1 month range
day = 1000 * 3600 * 24
x = linspace(n, n + day... | ivant/Bokeh.jl | test/test-cases/dates1.jl | Julia | mit | 498 |
function label_propagation{V,T<:Real}(graph::AbstractGraph{V};
weights::Vector{T} = Array(Float64, 0),
proximity::Vector{T} = Array(Float64, 0),
initial::Dict{V,Int} = Dict{V,Int}(),
... | afternone/LabelPropagation.jl | src/lpa.jl | Julia | mit | 10,779 |
#MDDatasets: Register dataset operations
#-------------------------------------------------------------------------------
#==NOTE
DataF1 cannot represent matrices. Element-by-element operations will therefore
be the default. There is not need to use the "." operator versions.
==#
#==NOTE:
:cummax, :cummin, :cumpro... | ma-laforge/MDDatasets.jl | src/datasetop_reg.jl | Julia | mit | 8,111 |
function _parseProposition(engine::EngineSkeleton,propositions::Vector{AbstractString}, T::Type,index::Int)
variable = getVariable(engine,symbol(propositions[index+2]),T)
hasVariable = (variable != DoesNotExistVariable()) ? true: throw(ParseError(" Variable $(propositions[index+2]) not found"))
hasI... | altieresdelsent/JuliaFuzzy | src/_parseProposition.jl | Julia | mit | 1,278 |
using Stream
using Base.Test
# write your own tests here
@test 1 == 1
| dwgill/Stream.jl | test/runtests.jl | Julia | mit | 71 |
using Base.Test
using ArrayViewsAPL
A = reshape(float64(1:300), 5, 5, 3, 4)
S = subview(A, 1:2, 1:2, 1:2, 1:2)
@test isa(S, View{Float64, 4})
@test size(S) == (2,2,2,2)
@test strides(S) == (1,5,25,75)
S = sliceview(A, 1:2, 1:2, 1:2, 1:2)
@test isa(S, View{Float64, 4})
@test size(S) == (2,2,2,2)
@test strides(S) == (1,... | timholy/ArrayViewsAPL.jl | test/core.jl | Julia | mit | 8,311 |
# center is (0,0,0)
# not working for general case
function gen_dr( r, LatVecs )
#
v1 = LatVecs[:,1]
v2 = LatVecs[:,2]
v3 = LatVecs[:,3]
#
Npoints = size(r)[2]
dr = Array{Float64}(Npoints)
#
Lx = maximum( abs(LatVecs[:,1]) )
Ly = maximum( abs(LatVecs[:,2]) )
Lz = maximum( abs... | f-fathurrahman/ffr-ElectronicStructure.jl | PW/ewald_02/gen_dr_old.jl | Julia | mit | 1,041 |
#============================================================
Struct with the dictionary of options and basic functionality
============================================================#
import Base: merge, merge!, getindex, keys, haskey, values, setindex!, copy,
iterate, show
export Options
"""
Abst... | JuliaReach/Reachability.jl | src/Options/dictionary.jl | Julia | mit | 14,097 |
using Base.Test
const MODE_LOG_FILE = tempname()
println("Path to MODE_LOG_FILE: $MODE_LOG_FILE")
configure(; modes = ["debug", "info", "warn", "error", "crazy"])
add_truck(Lumberjack.LumberjackTruck(MODE_LOG_FILE, "info"), "infotruck")
add_saw(Lumberjack.Saw(Lumberjack.fn_call_saw, "error"))
# Test limiting trucks ... | WestleyArgentum/Lumberjack.jl | test/test-modes.jl | Julia | mit | 1,059 |
# reshape test
x = create_var(6, 4)
y = reshape(x, 8, 3)
z = reshape(x, 4, 6)
v = vec(x)
test_expr(y, (x,))
test_expr(z, (x,))
test_expr(v, (x,))
info("All reshape tests passed")
| davidlizeng/LinearLeastSquares.jl | test/unit_tests/reshape.jl | Julia | mit | 180 |
"""
LatLonAccel
Acceleration in the frenet frame
# Fields
- `a_lat::Float64` Lateral acceleration [m/s^2]
- `a_lon::Float64` Longitudinal acceleration [m/s^2]
"""
struct LatLonAccel
a_lat::Float64
a_lon::Float64
end
LatLonAccel(alat::Float64, alon::LaneFollowingAccel) = LatLonAccel(alat, alon.a)
Base.show... | tawheeler/CarEM.jl | src/actions/lat_lon_accel.jl | Julia | mit | 1,562 |
#! usr/bin/julia
# Functions to test
function lineEvalTest()
line = Line{Solid}(SVector(1., 0., 0.),
SVector(3., 0., 0.))
t::Float64 = 4.
testVal = evalLineEq(line, t)
return testVal == SVector(8., 0., 0.)
end
function lineParallelTest()
line = Line{Solid}(SVector(1., 0., ... | MagB93/LatticeBoltzmann | test/geometry_tests.jl | Julia | mit | 2,041 |
module TestHardyWeinberg
using PopGen
using DataFrames
using Test
cats = @nancycats;
testarray = cats.genodata.genotype[1:10]
@testset "Hardy Weinberg" begin
@test PopGen._chisqlocus(testarray) == (16.691358024691358, 12, 0.1615808310222504)
tmp = hwetest(cats)
@test tmp isa DataFrame
@test size(tmp... | BioJulia/PopGen.jl | test/hardyweinberg.jl | Julia | mit | 512 |
function updateμ!{T <: AbstractFloat}(m::GeneralizedLinearMixedModel{T})
y, dist, link, η, μ = m.y, m.dist, m.link, m.η, m.μ
wt, wrkresid, wrkwt, dres = m.wt, m.wrkresid, m.wrkwt, m.devresid
priorwts = !isempty(wt)
@inbounds Threads.@threads for i = eachindex(η)
yi, ηi = y[i], η[i]
μi ... | JuliaPackageMirrors/MixedModels.jl | src/glm.jl | Julia | mit | 2,439 |
using GWinstekPSP
using Base.Test
# write your own tests here
@test 1 == 1
| cstook/GWinstekPSP.jl | test/runtests.jl | Julia | mit | 76 |
using Base.Collections: heappush!, heappop!
# IntervalStreams
# ---------------
#
# Often we'd rather avoid reading a large interval dataset into an
# IntervalCollection. We can still do efficient intersections if we can assume
# the data is sorted
type IntervalStreamIntersectIterator{S, T, SS, TS}
a::SS
b:... | nw11/Bio.jl | src/intervals/intervalstream.jl | Julia | mit | 11,239 |
# Rearrangle a Kronecker product in preparation for factorization
function kron_shuffle!{T}(B::Matrix{T}, A::Matrix{T}, outer_rows::Int, outer_cols::Int, inner_rows::Int, inner_cols::Int)
for or in 1:outer_rows, oc in 1:outer_cols, ir in 1:inner_rows, ic in 1:inner_cols
B[outer_rows * (oc-1) + or, inner_row... | NickMcNutt/MoreMatrices.jl | src/operations.jl | Julia | mit | 5,751 |
### High level interface to CUDNN:
# 0. Init
# 1. Descriptors
# 2. Convolution
# 3. Pooling
# 4. LRNCrossChannel
# 5. DivisiveNormalization
# 6. Batch Normalization
# 7. Other tensor functions
# 8. Helper functions
### 0. INIT ##################################################
isdefined(Base, :__precompile__) && __p... | JuliaPackageMirrors/CUDNN.jl | src/CUDNN.jl | Julia | mit | 43,680 |
import Transforms
import Distributions: MixtureModel, Normal, pdf
using PyPlot
xmodel = MixtureModel([Normal(1., 2.), Normal(-4., 10.)], [0.5, 0.5])
ymodel = MixtureModel([Normal(1., 2.), Normal(-4., 10.), Normal(2.3, 0.3)],
[0.2, 0.5, 0.3])
x = Transforms.RandomVariable(xmodel)
y = Transforms.R... | cqql/Transforms.jl | experiments/complex-division/gauss-hermite.jl | Julia | mit | 848 |
# 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... | reminisce/mxnet | julia/test/unittest/ndarray.jl | Julia | apache-2.0 | 36,958 |
##############################################################################
##
## Solve hamilton-jacobi-bellman
##
##############################################################################
##############################
##
## FDSpec
##
##############################
"""
Use finite difference method to solve f... | jstac/quantecon_nyu_2016 | lecture13/felipe_alves_codes/solveHJB.jl | Julia | bsd-3-clause | 28,415 |
# Julia wrapper for header: /usr/include/libavformat/avio.h
# Automatically generated using Clang.jl wrap_c, version 0.0.0
export
avio_check,
avio_alloc_context,
avio_w8,
avio_write,
avio_wl64,
avio_wb64,
avio_wl32,
avio_wb32,
avio_wl24,
avio_wb24,
avio_wl16,
avio_wb16,... | SimonDanisch/VideoIO.jl | src/libav/AVFormat/v54/avio.jl | Julia | mit | 5,907 |
module SpecialMatrices
# package code goes here
end # module
| finblarr/SpecialMatrices.jl | src/SpecialMatrices.jl | Julia | mit | 63 |
using ConfParser
using Base.Test
conf = ConfParse("confs/config.ini")
parse_conf!(conf)
@test retrieve(conf, "database", "user") == "dbuser"
@test retrieve(conf, "database", "password") == "abc123"
@test commit!(conf, "default", "database", "newuser") == true
@test erase!(conf, "foobarness") == true
save!(conf, "conf... | JuliaPackageMirrors/ConfParser.jl | test/testini.jl | Julia | mit | 523 |
using CTechCommon
# using FactCheck
using Base.Test
# @testset "all" begin
# @testset "arrays" begin
# r = 1:10
# x = collect(r)
# @test get(getith(r,3)) == 3
# @test get(getith(x,3)) == 3
# @test isnull(getith(x,11)) == true
# z = ([1,"one"], [2,"two"])
# z1, z2 = unzip(z)
# @test z1 == [1,2]
# @t... | tbreloff/CTechCommon.jl | test/runtests.jl | Julia | mit | 6,376 |
function mapper(arr)
for i = 1:18
for j = i+1:19
arr[j] = arr[j]%arr[i] == 0 ? arr[j]/arr[i] : arr[j]
end
end
arr
end
println(reduce(*, mapper(collect(2:20)))) | LanguageAdventures/Project-Euler-Julia | 005 - Smallest Multiple/005 - Smallest_Multiple.jl | Julia | mit | 200 |
abstract SeqRead
type FastaRead <: SeqRead
name::ASCIIString
sequence::Sequence
end
type FastqRead <: SeqRead
name::ASCIIString
sequence::Sequence
strand::ASCIIString
quality::Quality
end
"""
read1 and read2 of a FastqPair are considered with different directions
"""
type FastqPair
read1::FastqRead
read2::Fa... | OpenGene/OpenGene.jl | src/Base/Types/read.jl | Julia | mit | 2,741 |
## QUESTION 2
include("md.jl");
fname = "../../swp/1304_auto.mdv"
# Create a new simulation object
q = MolecularDynamicsTrial(
1000, # number of bodies
0.75, # particle density
1.304, # desired temperature; also use 1.304
0.032, # time step dx, in... | stefco/g6080 | common/md/run2.jl | Julia | mit | 955 |
using FlexLinearAlgebra
export random_average_height, true_average_height
"""
`random_average_height(P,reps=100)` gives the average height of the elements of `P`
in a random linear extension. See `random_linear_extension`.
"""
function random_average_height(P::SimplePoset{T}, reps::Int=100)::Dict{T,Float64} where T
... | scheinerman/SimplePosets.jl | src/average_height.jl | Julia | mit | 1,228 |
type RendererState
current::Dict{Symbol,Any}
saved::Vector{Dict{Symbol,Any}}
RendererState() = new(Dict{Symbol,Any}(),Dict{Symbol,Any}[])
end
function set(self::RendererState, name::Symbol, value)
self.current[name] = value
end
function get(self::RendererState, name::Symbol, notfound=nothing)
if ... | KristofferC/Winston.jl | src/renderer.jl | Julia | mit | 7,598 |
function showresult(value::AbstractString, opts; under = false, html = false)
raise(opts[:editor], "julia.result",
@d("value" => value,
"bounds" => opts[:bounds],
"under" => under,
"html" => html,
"info" => opts[:info]))
end
function showexception(req, value::Abst... | JuliaIDE/Jewel.jl | src/LightTable/display/commands.jl | Julia | mit | 649 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.