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 Mimi
using OptiMimi
using Base.Test
# From http://www.purplemath.com/modules/linprog3.htm
# You need to buy some filing cabinets. You know that Cabinet X costs
# $10 per unit, requires six square feet of floor space, and holds eight
# cubic feet of files. Cabinet Y costs $20 per unit, requires eight
# square fe... | JuliaPackageMirrors/OptiMimi.jl | test/testlp.jl | Julia | mit | 2,906 |
##################### Analysis functions #########################
function compute_mean(soln::R) where {R <: PerturbationSolution}
if typeof(soln) <: FirstOrderSolutionStoch
mean_states = zeros(length(soln.hbar))
mean_jumps = zeros(length(soln.gbar))
elseif typeof(soln) <: SecondOrderSolut... | RJDennis/SolveDSGE.jl | src/analysis_functions.jl | Julia | mit | 91,336 |
function card_dict{C<:NastranCard}(::Type{C},deck::NastranDeck)
Dict{Int64,C}(map(filter(c -> typeof(c)<:C,deck)) do card
(card.id,card)
end)
end
# type Grid
# id::Int64
# csys_id::Int64
# xyz::XYZ
# end
# type Coord
# id::Int64
# csys::CoordinateSystem
# end
# Grid(card::GRID) = ... | drewkett/Nastran.jl | src/model.jl | Julia | mit | 6,677 |
using Gadfly, DataArrays, RDatasets
if VERSION < v"0.4-dev"
using Dates
else
using Base.Dates
end
economics = dataset("ggplot2", "economics")
dates = Date[Date(d) for d in economics[:Date]]
economics[:Date] = dates
p = plot(economics, x=:Date, y=:Unemploy, Geom.line)
| joehuchette/Gadfly.jl | test/timeseries_year_1.jl | Julia | mit | 281 |
type MakeBuilder <: AbstractBuilder
args
MakeBuilder(args=[]) = new(args)
end
function rules(package::AbstractPackage,::AbstractDebianizer, build::MakeBuilder; kwargs...)
debian_file("rules",
"#! /usr/bin/make -f",
"include /usr/share/cdbs/1/rules/debhelper.mk",
"include /usr/share/cdbs/1/class/makef... | UCL/DebbyPacker.jl | src/builders.jl | Julia | mit | 1,299 |
## Various possible plot interfaces
## Plot interfaces for functions
## plot(x, [y], args..., kwargs...) lineplot
## plot(x::Tuple{Vector}, args...; symboltype::String="o", kwargs...) scatter plot
## plot(fs::Tuple{Function}, a, b; kwargs) parametric plot
## plot(fs::Array{Function, 2}, a::Real, b::Real, args...; kw... | tkelman/Winston.jl | src/plot_interfaces.jl | Julia | mit | 1,536 |
### Abstract variable IOStreams
abstract VariableIOStream
### BasicVariableIOStream
type BasicVariableIOStream <: VariableIOStream
stream::IOStream
size::Tuple
n::Integer
end
BasicVariableIOStream(size::Tuple, n::Integer, filename::AbstractString, mode::AbstractString="w") =
BasicVariableIOStream(open(filen... | JuliaPackageMirrors/Lora.jl | src/iostreams/VariableIOStreams.jl | Julia | mit | 2,631 |
type BasicDiscUnvParameter <: Parameter{Discrete, Univariate}
key::Symbol
index::Integer
pdf::Union{DiscreteUnivariateDistribution, Void}
prior::Union{DiscreteUnivariateDistribution, Void}
setpdf::Union{Function, Void}
setprior::Union{Function, Void}
loglikelihood!::Union{Function, Void}
logprior!::Unio... | JuliaPackageMirrors/Lora.jl | src/variables/parameters/BasicDiscUnvParameter.jl | Julia | mit | 5,558 |
include("../utils/functions.jl")
include("../optimizers/activeset.jl")
using Gadfly
## Toy example
A = [1 1 1 0;
2 1/2 0 1]
b = Vector{Float64}([5, 8])
c = Vector{Float64}([-4, -2, 0, 0])
#assts = [true,false,true,false]
assts = [false,false,true,true]
#x = [4.,0.,1.,0.]
x = [0.,0.,5.,8.]
run_simplex(asst... | dicai/descent.jl | jupyter/simplex_algorithm.jl | Julia | apache-2.0 | 1,212 |
using MySQL
using FTPClient
using BioMedQuery.PubMed
using BioMedQuery.DBUtils
using LightXML
using DataFrames
using Distributed
"""
load_medline(db_con, output_dir; start_file=1, end_file=972, year=2019, test=false)
Given a MySQL connection and optionally the start and end files, fetches the medline files, parse... | bcbi/BioMedQuery.jl | src/Processes/medline_load.jl | Julia | mit | 5,634 |
# *****************************************************************************
# 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/FakeDataGen/src/FakeDataGen.jl | Julia | apache-2.0 | 7,931 |
# Contents of this file is generated. Do not edit by hand!
# MOSEK 7.1.0.41
export
MSK_SOLVE_DUAL,
MSK_SOLVE_FREE,
MSK_SOLVE_PRIMAL,
MSK_SOLVE_BEGIN,
MSK_SOLVE_END,
MSK_PI_CON,
MSK_PI_CONE,
MSK_PI_VAR,
MSK_PI_BEGIN,
MSK_PI_END,
MSK_ACC_CON,
MSK_ACC_VAR,
MSK_ACC_BEGIN,
MSK_ACC_END,
MSK_SEN... | edljk/Mosek.jl | src/msk7_enums.jl | Julia | mit | 107,076 |
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
using JuliaFEM
using JuliaFEM.Testing
ALL_ELEMENTS = [
Seg2, Seg3,
Tri3, Tri6, Tri7,
Quad4, Quad8, Quad9,
Tet4, Tet10,
Wedge6,
Hex8, Hex20, Hex27
]
@testset "Evaluating basi... | JuliaPackageMirrors/JuliaFEM.jl | test/test_lagrange.jl | Julia | mit | 1,599 |
using Plots
using LinearAlgebra
using Test
using FLoops
pyplot()
using Images
function Base.isapprox(n1::Nothing, n2::Nothing)
return true
end
# For now, all cameras are aligned on the z axis
struct Camera
# Set of all pixels, counts as scene resolution
pixels
# physical size of aperture
size::... | leios/simuleios | raytracing/3d.jl | Julia | mit | 11,180 |
@doc """
A SparseRollCall object is a variant of the ZeroOneRollCall encoding that
does not explicitly represent any of the missing or inactive votes. This
can be more efficient for model fitting since the missing and inactive notes
are ignored by many models.
""" ->
immutable SparseRollCall
n_legislators::Int
... | johnmyleswhite/RollCallDataIO | src/sparse_roll_call.jl | Julia | mit | 1,343 |
function update_derivs_pos!(state::Vector{Float64}, derivs::Vector{Float64} )
# Input: state = [x,y,vx,vy], a vector of two 2-d positions and velocities for a test particle
# Output: The derivatives of the position are updated in the preallocated array derivs.
@assert length(state) == 4
@assert length(deriv... | eford/Astro585_2015_Fall_Public | labs/4/leapfrog_eric.jl | Julia | mit | 4,504 |
function Base.sort!(df::DataFrame; cols=Any[], alg=nothing,
lt=isless, by=identity, rev=false, order=Forward)
if !(isa(by, Function) || eltype(by) <: Function)
msg = "'by' must be a Function or a vector of Functions. Perhaps you wanted 'cols'."
throw(ArgumentError(msg))
end
... | campanja-forks/DataFrames.jl | src/dataframe/sort.jl | Julia | mit | 831 |
function ising_local_MPO(::Type{T}, shift::Number=0.0; hz::Number=1.0, hx::Number=0.0)::MPO_open{T} where {T}
E = Matrix{Float64}(I,2,2)
X = [0.0 1.0; 1.0 0.0]
Z = [1.0 0.0; 0.0 -1.0]
h1_11 = -hz*Z - hx*X + shift*I
h1 = zeros(eltype(h1_11), 2,2,1,2)
h2 = zeros(eltype(h1_11), 2,2,2,1)
... | FuTen/puMPS.jl | src/models.jl | Julia | mit | 13,528 |
using JuMP
using Ipopt
using CPLEX
#using Gurobi
using Distributions
include("prob.jl")
include("cut.jl")
function master_problem(; file = "../data/nesta_case24_ieee_rts_nk.m", k = 4, solver = IpoptSolver(), model_constructor = SOCWRPowerModel, cut_constructor = "AC", initial_cut_file = "cascades_300/IEEE_300_2.txt")... | kaarthiksundar/n-k | stochastic/main.jl | Julia | mit | 11,254 |
using Iterators
# type definitions
immutable ProblemDescription{T<:FloatingPoint}
timestep::T
# organized in the order of x-y-z
boundary::Array{T,1}
discretesteps::Array{Int16,1}
tolerence::T
nstates::Int8
end
type SystemDescription{T<:FloatingPoint}
cres::Array{T, 1}
coordindex::It... | rajaths589/DiscreteSchrodinger | eigenspectrum.jl | Julia | mit | 13,410 |
SetCardType = CardType{:set}()
const SetCard = NastranCard{SetCardType}
type AEFACT <: SetCard
id::Int64
factors::Vector{Float64}
end
function convert(::Type{AEFACT},card)
id = card[2]::Int64
i_br = 0
for (i,f) in enumerate(card[3:end])
if f == ""
if i_br == 0
i_... | drewkett/Nastran.jl | src/set_cards.jl | Julia | mit | 908 |
module MDTools
import Base.Cartesian.@nexprs
export NeighbourList
"""`type NeighbourList`
Implements a fast neighbourlist computation, loosely based on
[https://github.com/libAtoms/matscipy](MatSciPy).
### Usage
#### Basic Usage
```
X = rand(2, 10_000) * 100 # random positions in 100 x 100 cell
nlist = Neigh... | cortner/LujiaLt | src/mdtools.jl | Julia | mit | 8,137 |
# Important note when extending the parser: make sure to call skipspace on the returned
# stream whenever the parsing method is successful. Since netlist format doesn't care about
# whitespace, this simplifies every other algorithm using these building blocks.
module Parser
using QSpice.Gates, QSpice.State
export Par... | Gustorn/quantum | src/parser.jl | Julia | mit | 9,846 |
## Run MMALA using a Bayesian logit model with a Normal prior N(0, priorVar*I)
## on the Swiss banknote data
using Distributions, GeometricMCMC
include("swiss.jl")
include("logitNormalPrior.jl")
# Create Model instance
model = Model(nPars, data, logPrior, logLikelihood, gradLogPosterior,
tensor, derivTensor, rand... | scidom/GeometricMCMC.jl | test/logitNormalPriorSwissMmala.jl | Julia | mit | 1,343 |
# This file is a part of AstroLib.jl. License is MIT "Expat".
# Copyright (C) 2016 Mosè Giordano.
function _eqpole(l::T, b::T, southpole::Bool) where {T<:AbstractFloat}
sgn = southpole ? -1 : 1
l = deg2rad(sgn*l)
b = deg2rad(sgn*b)
r = 18 * sqrt(2 * (1 - sin(b))) * 3.53553391
return r .* sincos(l)
... | giordano/AstroLib.jl | src/eqpole.jl | Julia | mit | 2,021 |
# This file is a part of StruckVMEDevices.jl, licensed under the MIT License (MIT).
module SIS3316Digitizers
using Base.Threads
using ArgCheck
using ArraysOfArrays
using BitOperations
using ElasticArrays
using Observables
using ParallelProcessingTools
using UnsafeArrays
using Sockets
using Tables
using TypedTables
... | mppmu/SIS3316.jl | src/SIS3316Digitizers/SIS3316Digitizers.jl | Julia | mit | 521 |
using TermWin
TermWin.initsession()
arr = map( x->utf8(x), readdir() )
v = newTwMultiSelect( rootTwScreen, arr, posy=:center, posx=:center, orderable=true, substrsearch=true )
v.title = "Input: "
activateTwObj( rootTwScreen )
ret = v.value
#unregisterTwObj( rootTwScreen, v )
TermWin.endsession()
println( "You chose ",... | JuliaPackageMirrors/TermWin.jl | test/multiselect.jl | Julia | mit | 338 |
#=
#define FMPR_RND_DOWN 0 RoundingMode{:Down}()
#define FMPR_RND_UP 1
#define FMPR_RND_FLOOR 2
#define FMPR_RND_CEIL 3
#define FMPR_RND_NEAR 4
=#
import Base.Rounding: rounding_raw, setrounding_raw, rounding, setrounding;
const ARB_ROUNDING_MODE = Ref{Cint}(0)
to_arb(::RoundingMode{:Nearest})... | JuliaArbTypes/ArbFloats.jl | src/math/rounding.jl | Julia | mit | 1,505 |
# a modifying sampler modifies one or more distribution samplers or other modifying samplers
# TODO perhaps better name is "MetaSampler"?
abstract ModifyingSampler <: Sampler
paramranges(s::ModifyingSampler) = paramranges(s.subsampler)
getparams(s::ModifyingSampler) = getparams(s.subsampler)
setparams!(s::Modifying... | simonpoulding/DataGenerators.jl | src/choice_model/samplers/modifying_samplers/modifying_sampler.jl | Julia | mit | 1,404 |
struct MeanFunction
fname::Symbol
f::Function
pf::Function
hyp::Vector{Float64}
end
function meanvec(f::MeanFunction,
x::Array,
hyp::Vector=gethyp(f))
μ = f.f(x, hyp)
return μ
end
function partial_meanvec(f::MeanFunction,
x::Array,
... | ElbaKramer/GaussianProcesses.jl | src/mean.jl | Julia | mit | 880 |
module LogisticRegression
include("plotData.jl")
include("costFunction.jl")
include("costFunctionReg.jl")
include("plotDecisionBoundary.jl")
include("sigmoid.jl")
include("predict.jl")
include("mapFeature.jl")
export plotData, costFunction, costFunctionReg, plotDecisionBoundary,
sigmoid, predict, mapFeature
e... | homuler/coursera-ml-julia | src/ex2/LogisticRegression.jl | Julia | mit | 323 |
module TestTwoInertiasAndIdealGearWithUnits
using Modia
@usingModiaPlot
using Test
TwoInertiasAndIdealGearWithUnits = Model(
J1 = 0.0025u"kg*m^2",
J2 = 170u"kg*m^2",
r = 105.0,
tau_max = 1u"N*m",
phi2 = Var(start = 0.5u"rad"),
w2 = Var(start = 0.0u"rad/s"),
tau2 = Var(start = 0u"N*m")... | ModiaSim/Modia.jl | test/TestTwoInertiasAndIdealGearWithUnits.jl | Julia | mit | 1,454 |
# An implementation of the Lanczos version of the conjugate gradient method
# for a family of shifted systems of the form (A + αI) x = b.
#
# The implementation follows
# A. Frommer and P. Maass, Fast CG-Based Methods for Tikhonov-Phillips Regularization,
# SIAM Journal on Scientific Computing, 20(5), pp. 1831--1850, 1... | JuliaOptimizers/Krylov.jl | src/cg_lanczos.jl | Julia | mit | 13,267 |
using Dates
struct FaceValueClaim <: AbstractClaim end
amount(::FaceValueClaim, ::Date, notional::Float64, recoveryRate::Float64) = notional * (1.0 - recoveryRate)
| pazzo83/JQuantLib | src/instruments/claim.jl | Julia | mit | 166 |
x = 2
macro tenTimesX()
println("hello"); # executed at parse time
:(x * 10) # expression returned at parse time
end
function f()
@tenTimesX() # replaced with x*10 at parse time
end # when called, f executes x=2; x*10
@assert f() == 20
@assert f() == 20
@assert f() ... | rtoal/ple | julia/simple_macro_example.jl | Julia | mit | 344 |
# 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... | kou/arrow | julia/Arrow/src/utils.jl | Julia | apache-2.0 | 6,508 |
module YAML
import Base: start, next, done, isempty, length, show
import Codecs
using Compat
if VERSION < v"0.4-dev"
using Dates
end
include("scanner.jl")
include("parser.jl")
include("composer.jl")
include("constructor.jl")
function load(ts::TokenStream)
ev... | peter1000/YAML.jl | src/YAML.jl | Julia | mit | 1,708 |
#==============================================================================#
# sdb.jl
#
# SimpleDB API. See http://aws.amazon.com/documentation/simpledb/
#
# Warning: It seems that Amazon has unofficially deprecated SimpleDB
# in favour of DynamoDB. SimpleDB is still a better tool for some tasks,
# but it’s future ... | samoconnor/OCAWS.jl | src/sdb.jl | Julia | mit | 3,483 |
# test the tools module
include("tools.jl")
LI = LinearInterp
using Plots
x = collect(sort(rand(10)))
y = sin.(10*x)
xfine = collect(x[1]:0.01:x[end])
intp1 = LI.interp1D(x, y)
yfine = intp1(xfine)
scatter(x, y, marker=:circle)
scatter!(xfine, yfine, marker=:s)
| simulkade/peteng | tools/tools_test.jl | Julia | mit | 268 |
type ScatterPlot <: Graph
dataGroups::Vector{DataGroup}
end
ScatterPlot(dg::DataGroup) = ScatterPlot([dg])
function plotData(g::ScatterPlot, showLegend::Bool, fid)
global dgCount
for x in 1:length(g.dataGroups)
dg = g.dataGroups[x]
if dg.lineColor == "blank"
dg.lineColor = goodColors[mod(x, length(goodColo... | rennis250/Sparrow.jl | src/scatterplot.jl | Julia | mit | 2,431 |
# A quartic function with nontrivial groups and
# repetitious elements.
# Source:
# Ph. Toint, private communication.
# classification SUR2-AN-V-0#
# Problem 57 in
# L. Luksan, C. Matonoha and J. Vlcek
# Modified CUTE problems for sparse unconstrained optimization,
# Technical Report 1081,
# Inst... | dpo/OptimizationProblems.jl | src/tquartic.jl | Julia | mit | 897 |
# Result tracking
import Base.Random: uuid4, UUID
type Result
id::UUID
value
data
end
Result(id, value) = Result(id, value, Dict())
displayinline(r::Result) =
Collapsible(span(strong("Result "), fade(string(r.id))),
DOM.div([applydisplayinline(r.value), applydisplayinline(r.data)]))
const res... | dlfivefifty/Jewel.jl | src/LightTable/interaction/interaction.jl | Julia | mit | 1,550 |
using TimeSeries, MarketData, Base.Dates
FactCheck.setstyle(:compact)
FactCheck.onlystats(true)
facts("update method works") do
new_cls = update(cl, today(), 111.11)
new_clv = update(cl, today(), [111.11])
new_ohlc = update(ohlc, today(), [111.11, 222.22, 333.33, 444.44])
context("update a single c... | JuliaPackageMirrors/TimeSeries.jl | test/modify.jl | Julia | mit | 2,032 |
function retrieverow(stmt, col)
#=
Retrieve the i-th value from the current row.
=#
coltype = api.sqlite3_column_type(stmt, col)
if coltype == api.SQLITE_INTEGER
if WORD_SIZE == 64
return api.sqlite3_column_int64(stmt, col)
else
return api.sqlite3_column_int... | Sean1708/sekelia.jl | src/utils/row.jl | Julia | mit | 2,246 |
using FactCheck
# awaiting JLD to mature to enable these test suites
# include("timearray.jl")
# include("dataframe.jl")
# include("auth_token.jl")
exitstatus()
| JuliaPackageMirrors/Quandl.jl | test/runtests.jl | Julia | mit | 163 |
using JLD, Serialization
using BenchmarkTools
using TypedTables
res = if endswith(ARGS[1], ".jld")
JLD.load(ARGS[1])
elseif endswith(ARGS[1], ".jls")
deserialize(ARGS[1])
else
error("Unknown file type")
end
serial_results = filter(x->!occursin("dagger", x[1]), res["results"])
@assert length(keys(serial_re... | shashi/ComputeFramework.jl | benchmarks/visualize.jl | Julia | mit | 5,730 |
using Documenter
using DataStructures
makedocs(
format = :html,
sitename = "DataStructures.jl",
pages = [
"index.md",
"deque.md",
"circ_buffer.md",
"circ_deque.md",
"stack_and_queue.md",
"priority-queue.md",
"accumulators.md",
"disjoint_sets.... | ScottPJones/DataStructures.jl | docs/make.jl | Julia | mit | 825 |
# This example starts a coroutine for websocket handling,
# which again splits input and output on different tasks.
# Note that if
using WebSockets
inbox = Channel{String}(10)
outbox = Channel{String}(10)
ws_task = @async WebSockets.with_logger(WebSocketLogger(stderr, Base.CoreLogging.Debug)) do
WebSockets.open(... | JuliaWeb/WebSockets.jl | examples/inbox_outbox.jl | Julia | mit | 1,323 |
using Pkg, Dates
if length(ARGS) < 3
println(stderr, "Usage: rr_capture.jl [buildnumber] [shortcommit] [command...]")
exit(2)
end
const TIMEOUT = 2*60*60 # seconds
run_id = popfirst!(ARGS)
shortcommit = popfirst!(ARGS)
num_cores = min(Sys.CPU_THREADS, 8, parse(Int, get(ENV, "JULIA_TEST_NUM_CORES", "8")))
ne... | staticfloat/julia-buildbot | commands/rr_capture.jl | Julia | mit | 3,137 |
export
ConvexPolygon,
CPAMemory,
CollisionCheckResult,
LineSegment,
to_oriented_bounding_box!,
get_oriented_bounding_box,
is_colliding,
is_potentially_colliding,
get_collision_time,
get_first_collision,
get_time_and_dist_of_closes... | tawheeler/AutomotiveDrivingModels.jl | src/2d/utils/main.jl | Julia | mit | 468 |
############################################################
## joMatrix - extra functions
# elements(jo)
#elements(A::joAbstractSAparallelToggleOperator) = throw(joAbstractSAparallelToggleOperatorException("elements: pointless operation for joSAdistribute/joSAgather operations"))
# hasinverse(jo)
# issquare(jo)
# ... | slimgroup/JOLI.jl | src/joAbstractSAparallelToggleOperator/extra_functions.jl | Julia | mit | 396 |
#!/usr/bin/env julia
#
# @license Apache-2.0
#
# Copyright (c) 2018 The Stdlib Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | stdlib-js/stdlib | lib/node_modules/@stdlib/stats/base/dists/lognormal/median/test/fixtures/julia/runner.jl | Julia | apache-2.0 | 1,756 |
#!/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/geometric/mode/test/fixtures/julia/runner.jl | Julia | apache-2.0 | 1,593 |
# This is a list of transitive Frobenius groups G with abelian Frobenius
# kernel K and solvable H = G/K and degree(G) <= 30.
#
# Frob := []l;
# for i in [1..30] do
# for j in [1..NumberOfTransitiveGroups(i)] do
# G := TransitiveGroup(i, j);
# fl := IsFrobenius(G);
# if not fl then
# continue;
# ... | thofma/Hecke.jl | src/FieldFactory/FrobeniusExtensions.jl | Julia | bsd-2-clause | 6,049 |
# From AnticNumberField into something
mutable struct MapDataFromAnticNumberField{T}
prim_image::T
isid::Bool
function MapDataFromAnticNumberField{T}(x::Bool) where T
@assert x
z = new{T}()
z.isid = true
return z
end
function MapDataFromAnticNumberField{T}(x::T) where T
z = new{T}(x, ... | thofma/hecke | src/Map/NumField.jl | Julia | bsd-2-clause | 5,398 |
using StructJuMP, JuMP
using StructJuMPSolverInterface
include("select_solver.jl")
#############
# A sample model
#############
scen = 2
m = StructuredModel(num_scenarios=scen)
@variable(m, x[1:2])
@variable(m, z[1:2])
@NLobjective(m, Min, x[1]^2+x[2]^2+x[1]*z[2] + x[1]*x[2])
@NLconstraint(m, x[1] + x[2]<= 100)
for... | fqiang/StructJuMP.jl | examples/pips/parmodel7.jl | Julia | mit | 811 |
using JLD
type Instruction
fname #file name
text #instruction as a list of tokens
path #path as a list of (x,y,orientation) tuples
map #map name
id
end
function getallinstructions(;fname="data/pickles/databag3.jld")
raw_data = load(fname, "raw_data")
grid = Instruction[]
jelly = Instruction[]
l = Instructi... | ozanarkancan/navigation | instruction.jl | Julia | mit | 2,249 |
# Test the calling interface for parsers
using Compat
using HDF5,JLD,KUparser,KUnet,Base.Test
infoln(x)=(println();info(x))
include("pxyequal.jl")
infoln("Loading data")
@date @load "conll07.tst.jld4"
@show nbatch = 4
@show nbeam = 4
@show ndeps = length(deprel)
@show ft = Flist.acl11eager
@show pt = ArcEager13
@show... | denizyuret/KUparser.jl | test/testcalls.jl | Julia | mit | 2,603 |
if VERSION < v"0.4.0-dev"
using Docile
end
# This line should have no code
f2(x) = 2x
if true
f3(x) = 3x
end
f4(x) = 4x; f5(x) = 5x
# This line should have no code
@doc """
`f6(x)` multiplies `x` by 6
""" ->
f6(x) = 6x
# This line should have no code
@doc """
`f7(x)` multiplies `x` by 7
""" ->
function f7(x)
... | jbn/Coverage.jl | test/data/testparser.jl | Julia | mit | 394 |
# require("Distributions")
# require("Cubature")
# require("Optim")
# require("NumericExtensions")
# require("StatsBase")
module KernelEstimator
using Compat
using Distributions
# using Cubature
using Optim
#using Yeppp
using StatsBase
using Cubature
import StatsBase: RealVector, RealMatrix
Compat.@irrational invs... | tkelman/KernelEstimator.jl | src/KernelEstimator.jl | Julia | mit | 795 |
using Gadfly
include("plotDataPoints.jl")
include("plotCentroidsLines.jl")
@doc """
PLOTPROGRESSKMEANS is a helper function that displays the progress of
k-Means as it is running. It is intended for use only with 2D data.
PLOTPROGRESSKMEANS(X, centroids, previous, idx, K, i) plots the data
points with col... | homuler/coursera-ml-julia | src/ex7/plotProgresskMeans.jl | Julia | mit | 1,010 |
#!/usr/bin/env julia
# A Julia script that reproduces expected results of the test module
# 'test/rationalTest.cpp'.
#
# From a shell, run the script as:
# julia /path/to/rational.jl
#
# From Julia, the script can be run as:
# include("path/to/rational.jl")
function rationalTest()
s = Rational(-12)
print... | jkovacic/math | scripts/test/rational.jl | Julia | apache-2.0 | 2,890 |
@testset "NumField/NfAbs" begin
include("NfAbs/ConjugatesNS.jl")
end
| thofma/hecke | test/NumField/NfAbs.jl | Julia | bsd-2-clause | 71 |
struct PriorTableEntry
key::Symbol
reg::Int64
fixed::Bool
tex_label::String
dist_id::String
mean::Float64
sd::Float64
end
struct PosteriorTableEntry
key::Symbol
reg::Int64
f... | FRBNY-DSGE/DSGE.jl | src/analysis/moments.jl | Julia | bsd-3-clause | 41,854 |
using Gcode
using Base.Test
def setUp(self):
self.outfile = TemporaryFile()
self.g = G(outfile=self.outfile, print_lines=False,
aerotech_include=False)
def tearDown(self):
self.g.teardown()
del self.outfile
del self.g
def test_init(self):
self.assertEqual(self.g.movement_mode,... | sjkelly/Gcode.jl | test/runtests.jl | Julia | mit | 8,015 |
# This line should have no code
f2(x) = 2x
if true
f3(x) = 3x
end
f4(x) = 4x; f5(x) = 5x
# This line should have no code
@doc """
`f6(x)` multiplies `x` by 6
""" ->
f6(x) = 6x
# This line should have no code
@doc """
`f7(x)` multiplies `x` by 7
""" ->
function f7(x)
7x
end
f8(x) = 8x
# This line should have no ... | gragusa/Coverage.jl | test/data/testparser.jl | Julia | mit | 410 |
# tests
using Base.Test
using Traits
check_return_types(true) # should test both true & false
## BUG flags: set to false once fixed to activate tests
# Julia issues:
return_types_bug1 = true # see Pr0 in traitdef.jl
function_types_bug1 = true # set to false if function types get implemented in Julia
# Traits.jl issue... | eschnett/Traits.jl | test/runtests.jl | Julia | mit | 2,314 |
C=[1 1 1 1; 0 1 0 1; 0 0 1 1; 0 0 0 1]
P=[1/3 1/3 1/3 0; 1/3 1/3 0 1/3; 1/3 0 1/3 1/3; 0 1/3 1/3 1/3 ]
C1=[1 1 1 1 1 1; 0 1 0 1 1 1; 0 0 1 1 1 1; 0 0 0 1 0 1; 0 0 0 0 1 1; 0 0 0 0 0 1]
P3=[1/2 1/6 0 1/3 0 0; 1/3 1/6 1/6 1/3 0 0; 1/3 1/6 0 1/3 1/6 0; 1/6 1/6 1/6 0 1/6 1/3; 1/6 0 1/6 1/6 1/3 1/6; 0 1/6 1/3 0 1/6 1/3]
P6... | PawelPamula/MarkovTools.jl | resources/monotonicities/monotonicities_test.jl | Julia | mit | 3,063 |
# This file is a part of Julia. License is MIT: http://julialang.org/license
function add1!(x,y)
x[y] .+= 1
end
function devec_add1!(x,y)
for i=1:length(y)
x[y[i]] += 1
end
end
function devec_add1_logical!(x,y)
for i=1:length(y)
if y[i]
x[i] += 1
end
end
end
| staticfloat/Perftests.jl | benchmarks/kernel/indexing.jl | Julia | mit | 318 |
export KrylovSolver, MinresSolver, CgSolver, CrSolver, SymmlqSolver, CgLanczosSolver,
CgLanczosShiftSolver, MinresQlpSolver, DqgmresSolver, DiomSolver, UsymlqSolver,
UsymqrSolver, TricgSolver, TrimrSolver, TrilqrSolver, CgsSolver, BicgstabSolver,
BilqSolver, QmrSolver, BilqrSolver, CglsSolver, CrlsSolver, CgneSolver, C... | JuliaOptimizers/Krylov.jl | src/krylov_solvers.jl | Julia | mit | 39,632 |
# This file is auto-generated by AWSMetadata.jl
using AWS
using AWS.AWSServices: location
using AWS.Compat
using AWS.UUIDs
"""
associate_tracker_consumer(consumer_arn, tracker_name)
associate_tracker_consumer(consumer_arn, tracker_name, params::Dict{String,<:Any})
Creates an association between a geofence col... | JuliaParallel/AWS.jl | src/services/location.jl | Julia | mit | 82,458 |
## hclust.jl (c) 2014 David A. van Leeuwen
## Hierarchical clustering, similar to R's hclust()
## Algorithms are based upon C. F. Olson, Parallel Computing 21 (1995) 1313--1325.
## This is also in types.jl, but that is not read...
## Mostly following R's hclust class
type Hclust{T<:Real}
merge::Matrix{Int}
he... | JuliaPackageMirrors/Clustering.jl | src/hclust.jl | Julia | mit | 11,725 |
#= -------------------------------------------------------------------------
# @file problema1_e.jl
#
# @date 11/03/16 17:01:36
# @author Martin Noblia
# @email martin.noblia@openmailbox.org
#
# @brief
#
# @detail
#
Licence:
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | elsuizo/Control1 | Tps_obligatorios/Tp1/Programas/problema1_e.jl | Julia | mit | 1,592 |
# gated recurrent units
type GFGRULayer # a single layer of a multi-layer RNN
# update gate params
wux::NNMatrix
wuh::NNMatrix
bu::NNMatrix
# reset gate params
wrx::NNMatrix
wrh::NNMatrix
br::NNMatrix
# candidate gate params
wcx::NNMatrix
... | haroldsoh/RecurrentNN | src/gfgru.jl | Julia | mit | 6,361 |
using StaticArrays
if isdefined(Base.SimdLoop, Symbol("@unroll_annotation"))
struct Const{T}
a::T
end
Base.getindex(A::Const{<:Array}, i1::Int) = Core.const_arrayref(A.is_star, i1)
@inline Base.getindex(A::Const{<:Array}, i1::Int, i2::Int, I::Int...) = Core.const_arrayref(A.is_star, i1, i2, I...)
@generated fun... | jeff-regier/Celeste.jl | src/aliasscopes.jl | Julia | mit | 1,646 |
#= -------------------------------------------------------------------------
# @file image_processing.jl
#
# @date 07/01/15 17:51:05
# @author Martin Noblia
# @email martin.noblia@openmailbox.org
#
# @brief
# Images processing functions in Julia language
# @detail
#
Licence:
# This program is free software: you can r... | elsuizo/Image_processing | Julia/image_processing.jl | Julia | mit | 5,944 |
using LinearAlgebra
mutable struct TridiagonalOperator
diagonal::Vector{Float64}
lowerDiagonal::Vector{Float64}
upperDiagonal::Vector{Float64}
temp::Vector{Float64}
n::Int
end
TridiagonalOperator(n::Int) = TridiagonalOperator(zeros(n), zeros(n - 1), zeros(n - 1), zeros(n), n)
TridiagonalOperator() = Tridiag... | pazzo83/JQuantLib | src/math/tridiagonal_operator.jl | Julia | mit | 3,756 |
using Gadfly, RDatasets
set_default_plot_size(6inch, 2inch)
plot(dataset("Zelig", "macro"), x=:Year, y=:Unem, color=:Country, Geom.point)
| dcjones/Gadfly.jl | test/testscripts/multicolumn_colorkey.jl | Julia | mit | 140 |
# Unit tests for utils.jl
using NumericExtensions
using Base.Test
@test eachrepeat(1:3, 2) == [1, 1, 2, 2, 3, 3]
@test eachrepeat(1:4, 1:4) == [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]
rmat = [1 1 2 2 3 3;
1 1 2 2 3 3;
1 1 2 2 3 3;
4 4 5 5 6 6;
4 4 5 5 6 6;
4 4 5 5 6 6]
@test eachrepe... | lendle/NumericExtensions.jl | test/utils.jl | Julia | mit | 649 |
module TestRanges
using Base.Test
using RLEVectors
@testset begin
# disjoin_length
@test disjoin_length([],[]) == 0
@test disjoin_length([4,5],[]) == 2
@test disjoin_length([],[9,10,12]) == 3
@test disjoin_length([1,2,3],[4,5,6]) == 6
@test disjoin_length([1,2,3],[3,5,6]) == 5
@test disjoin_length([1,3],[2,5,6]) == ... | JuliaPackageMirrors/RLEVectors.jl | test/test_ranges.jl | Julia | mit | 756 |
module Halfspace
using JLD
using StatsBase
using Convex
using SCS
include("common.jl")
include("opt.jl")
include("alg3.jl")
include("alg4.jl")
end # module
| innerlee/Halfspace | src/Halfspace.jl | Julia | mit | 159 |
f = open("hightemp.txt")
for line in readlines(f)
print(replace(line,"\t", " "))
end
| nzw0301/julia-nlp100knock | code/11.jl | Julia | mit | 87 |
const kDoubleSignificandSize = 53
function FillDigits32FixedLength(n1,requested_len,buffer,len)
for i = (requested_len-1):-1:0
buffer[len+i] = 0x30 + n1 % 10
n1 = div(n1,10)
end
return len + requested_len
end
function FillDigits32(n,buffer,len)
n_len = 0
while n != 0
digit ... | quinnj/Grisu.jl | src/fastfixedtoa.jl | Julia | mit | 6,648 |
#
# @description Implements the CBC (Cipher-Block Chaining) mode of operation algorithm.
#
# @author Alejandro Claro (alejandro.claro@gmail.com)
#
# Copyright 2015 All rights reserved.
# Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
#
export CbcModeCipher
exp... | alejandroclaro/Cryptography.jl | src/Ciphers/cbc_mode_cipher.jl | Julia | mit | 6,370 |
using Base.Test
using Mimi
using DataFrames
@defcomp foo1 begin
index1 = Index()
par1 = Parameter()
par2::Bool = Parameter(index=[time,index1], description="description par 1")
par3 = Parameter(index=[time])
var1 = Variable()
var2 = Variable(index=[time])
var3 = Variable(index=[time,index... | JuliaPackageMirrors/Mimi.jl | test/test_main.jl | Julia | mit | 1,344 |
"abstract Hyperparameters"
abstract AbstractHyperparam;
"Abstract Model Data Object"
abstract AbstractModelData;
"Abstract Model Buffer Object"
abstract AbstractModelBuffer;
| trappmartin/BNP.jl | src/common.jl | Julia | mit | 176 |
using CovInline
using Base.Test
@test f(2) == 4
@test g(2) == 8
@test h(2) == 16
@test k(2) == 32
| jlapeyre/CovInline.jl | test/runtests.jl | Julia | mit | 99 |
# lists table-specific iterators
iters(session::AccumuloSession, tablename::String) = listIterators(client(session), handle(session), tablename)
# get a single iterator with its settings
iter(session::AccumuloSession, tablename::String, itername::String, scope::Integer) = getIteratorSetting(client(session), handle(ses... | JuliaDB/Accumulo.jl | src/iter.jl | Julia | mit | 1,943 |
### Fit a full rank model with PRISMA
import FirstOrderOptimization: PRISMA, PrismaParams, PrismaStepsize
import LowRankModels: fit!, ConvergenceHistory
export PrismaParams, PrismaStepsize, fit!, PrismaParams
defaultPrismaParams = PrismaParams(stepsize=PrismaStepsize(Inf),
maxiter=... | madeleineudell/FullRankModels.jl | src/prisma.jl | Julia | mit | 2,784 |
function get_sunits_from_subfield_data(OK, N; recursive::Bool = false, compact::Bool = true)
K = nf(OK)
fbbound = Hecke.factor_base_bound_grh(OK)
S = prime_ideals_up_to(OK, fbbound)
@vprint :NormRelation 1 "Factor base bound: $fbbound\n"
c, UZK = _setup_for_norm_relation_fun(K, S)
docompact = false
... | thofma/hecke | src/NumField/NfAbs/NormRelation/Clgp.jl | Julia | bsd-2-clause | 1,726 |
import Base: convert, promote_rule, string, print, show
import Base.Dates: value, toms
# Convenience type for working with HH:MM:SS.
immutable Time <: TimePeriod
seconds::Int
end
const ZERO = Time(0)
function Time(hour::Integer, minute::Integer, second::Integer)
Time(hour * 3600 + minute * 60 + second)
end
f... | JuliaPackageMirrors/TimeZones.jl | src/time.jl | Julia | mit | 2,534 |
"""
LSIAF{F<:AbstractFloat}(Y::Array{F})
The function `LSIAF` performs the filtering via coordinate descent and takes only following input:
* y : Signal or time-series to be filtered (a vector of reals).
"""
function LSIAF{F<:AbstractFloat}(Y::Array{F})
## File Input
Y0 = Y
Ym = mean(Y)
Y ... | FelipeCalliari/AdaptiveLASSO.jl | src/LSIAF.jl | Julia | mit | 1,369 |
# strings
x = "ppzz!#"
r = RObject(x)
@test isa(r,RObject{StrSxp})
@test length(r) == 1
@test rcopy(r) == x
@test isascii(r)
@test isa(rcopy(r),ASCIIString)
@test rcopy(r[1]) == x
@test isa(r[1],RObject{CharSxp})
x = "aaα₁"
r = RObject(x)
@test isa(r,RObject{StrSxp})
@test length(r) == 1
@test rcopy(r) == x
@test isa(... | AndyGreenwell/RCall.jl | test/conversion.jl | Julia | mit | 5,068 |
using MLBase
# internal data structure for a random forest classifier
type Classifier
n_samples::Int
n_features::Int
n_max_features::Int
label_mapping::LabelMap
outtype::DataType
improvements::Vector{Float64}
oob_error::Float64
trees::Vector{Tree}
function Classifier(rf, x, y)
... | bicycle1885/RandomForests.jl | src/classifier.jl | Julia | mit | 3,883 |
# Vehicular traffic problem
# Test based on example 1 of:
# Bürger, Mulet, Villada, A difussion Corrected Multiclass LWR Traffic model
# with Anticipation Lengths and Reaction times, Advances in Applied Mathematics
# and mechanics, 2013
include("./../ConservationLawsDiffEq.jl")
using .ConservationLawsDiffEq
# Paramet... | Paulms/ConservationLawsAlgorithms | src/examples/test4.jl | Julia | mit | 2,228 |
# small scrip to compute the solution of Lippmann Schwinger equation
# We test that the density sigma can be properly factorized as a
# mu_slow*e^{i \omega \phi(x)} where $\phi$ accounts for the travel
# time within the geometrical optics solution
using PyPlot
using IterativeSolvers
using SpecialFunctions
include("..... | Forgotten/Lippmann-Schwinger | examples/example_fastconv_dual_GO.jl | Julia | mit | 3,486 |
__precompile__()
include("plain.jl")
| JuliaPackageMirrors/HDF5.jl | src/HDF5.jl | Julia | mit | 38 |
module JinGen
export JinGenParams, JinGenBuilder, FlawedJinGen, generate
using RouletteWheels
using Compat
immutable JinGenParams
r_0::Float64
r_1::Float64
γ::Float64
z_star::Int
barrier_iters::Int
n::Int
end
JinGenParams(n) = JinGenParams(
0.0005, 2.0, 0.005, 5, 1, n
)
immutable JinGen... | jbn/JinGen.jl | src/JinGen.jl | Julia | mit | 7,403 |
using Base.Test
import ProxAlgs
# Test proximal operators
include("operators.jl")
# Test algorithms
include("consensus.jl")
include("prox_descent.jl")
include("acc_prox_descent.jl")
| ahwillia/ProxAlgs.jl | test/runtests.jl | Julia | mit | 184 |
################################################################################
#
# Type declaration
#
################################################################################
mutable struct NfRelToNfRelNSMor{T} <: Map{NfRel{T}, NfRelNS{T}, HeckeMap, NfRelToNfRelNSMor}
header::MapHeader{NfRel{T}, Nf... | thofma/hecke | src/NumField/NfRel/NfRelNSMor.jl | Julia | bsd-2-clause | 20,620 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.