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 DataDeps
register(DataDep(
"zoo",
"http://archive.ics.uci.edu/ml/datasets/Zoo",
"http://archive.ics.uci.edu/ml/machine-learning-databases/zoo/zoo.data",
"cddc71c26ab9bc82795b8f4ff114cade41885d92720c6af29ffb69bcf73f0315",
post_fetch_method=(path -> begin
UCIData.process_dataset(path,
target_... | JackDunnNZ/uci-data | src/data/classification/zoo.jl | Julia | mit | 440 |
#! /usr/bin/julia
# Rosetta Code, Copy a string
s = "Rosetta Code"
t = s
println("s = \"", s, "\" and, after \"t = s\", t = \"", t, "\"")
s = "Julia at "*s
println("s = \"", s, "\" and, after this change, t = \"", t, "\"")
| MichaeLeroy/rosetta-code | julia/completed/copy_string.jl | Julia | mit | 229 |
function getIncomeGrid()
# A function that returns:
# 1. an income grid
# 2. A Markovian transition matrix (Q) over income realisations
# 3. A vector of minimum incomes in each year
# 4. A vector of maximum incomes in each year
# ------------------------------------------------------------------------
# De... | floswald/ucl-econ-julia | LifecycleCostaDias/v5_julia/code_gridsInputs/getIncomeGrid.jl | Julia | mit | 4,655 |
# dag.jl:
# ======
# Node types for DAG
#
load("utils/req.jl")
req("utils/utils.jl")
abstract Expression
# == Node =====================================================================
type Node{T<:Expression}
val::T
args#::Vector{Node} # todo: add back once type inference bug is fixed
name::Union(Sy... | toivoh/julia-kernels | dag/dag.jl | Julia | mit | 4,054 |
using BenchmarkTools
using DelimitedFiles, LinearAlgebra, Printf, SparseArrays
using Pkg.Artifacts
using MatrixMarket
using Metis, SymRCM, AMD
using LDLFactorizations, SolverBenchmark
const SUITE = BenchmarkGroup()
SUITE["no_ordering"] = BenchmarkGroup()
SUITE["amd"] = BenchmarkGroup()
SUITE["symamd"] = BenchmarkGrou... | JuliaOptimizers/AMD.jl | benchmark/benchmarks.jl | Julia | mit | 2,062 |
(nworkers() < ncpu) && (addprocs(ncpu - nprocs() + 1))
require("CUDArt")
@everywhere CUDArt.device((myid()-1) % CUDArt.devcount())
require("CUBLAS")
require("KUnet")
require("KUparser")
| denizyuret/KUparser.jl | test/initworkers.jl | Julia | mit | 187 |
#==============================================================================
Problem
Figure 2. The probability of any outcome (leaf) in a probability tree diagram
is given by the product of probabilities from the start of the tree to the
outcome. For example, the probability that X is blue and Y is blue is equal
... | binnisb/RosalindJulia | MendelsFirstLaw.jl | Julia | mit | 2,850 |
# Implementation of
# "Table-driven Implementation of the Logarithm Function in IEEE Floating-point Arithmetic"
# Tang, Ping-Tak Peter
# ACM Trans. Math. Softw. (1990), 16(4):378--400
# http://dx.doi.org/10.1145/98267.98294
# Other implementations:
# Apple OS X libm (APSL v2)
# http://www.opensource.apple.com/s... | simonbyrne/libm.jl | src/log_tang.jl | Julia | mit | 8,044 |
# This file is a part of AstroLib.jl. License is MIT "Expat".
# Copyright (C) 2016 Mosè Giordano.
function kepler_solver(_M::Real, e::Real)
@assert 0 <= e <= 1 "eccentricity must be in the range [0, 1]"
# M must be in the range [-pi, pi], see Markley (1995), page 2.
M = rem2pi(_M, RoundNearest)
T = flo... | giordano/AstroLib.jl | src/kepler_solver.jl | Julia | mit | 3,488 |
#=
This is a port of H5Zlz4.c to Julia
https://github.com/HDFGroup/hdf5_plugins/blob/master/LZ4/src/H5Zlz4.c
https://github.com/nexusformat/HDF5-External-Filter-Plugins/blob/master/LZ4/src/H5Zlz4.c
https://github.com/silx-kit/hdf5plugin/blob/main/src/LZ4/H5Zlz4.c
H5Zlz4 is originally a copyright of HDF Group. License:... | JuliaIO/HDF5.jl | filters/H5Zlz4/src/H5Zlz4.jl | Julia | mit | 7,432 |
include("read_graph.jl")
function CI(g,n)
CI = zeros(nv(g))
for v in 1:nv(g)
vec = neighbors(g, vertices(g)[v])
vec2 = vec
vec = vcat(vertices(g)[v],vec)
todos = vec
distn = Array(Int64,0)
for l in 1:(n-1)
todos = union(vec,vec2)
for m in vec2
vec2 = union(vec2,neighbors... | ollin18/All-InNet | Scripts/CI.jl | Julia | mit | 1,005 |
## functions for generic programming within SymPy
## if a generic method should apply to a sympy variable, it would
## be defined here.
## Iterator for Sym
import Base.iterate
iterate(x::Sym) = (x.__pyobject__, 0)
iterate(x::Sym, state) = nothing
Base.isless(a::Sym, b::Sym) = (a != sympy.nan && b != sympy.nan) && ... | JuliaPy/SymPy.jl | src/generic.jl | Julia | mit | 3,395 |
"""
`Maker.DirectoryTarget`
The type created by `directory()`. Fields expected to be accessed publicly
include:
- `name::UTF8String`
- `dependencies::Vector{UTF8String}`
- `description::UTF8String`
"""
type DirectoryTarget <: AbstractTarget
name::UTF8String
dependencies::Vector{UTF8String}
description::... | tshort/Maker.jl | src/directory.jl | Julia | mit | 2,062 |
""" `zpk(gain[, Ts]), zpk(num, den, k[, Ts]), zpk(sys)`
Create transfer function on zero pole gain form. The numerator and denominator are represented by their poles and zeros.
`sys::TransferFunction{SisoZpk{T,TR}} = k*numerator/denominator`
where `T` is the type of `k` and `TR` the type of the zeros/poles, usually F... | JuliaControl/Control.jl | src/types/zpk.jl | Julia | mit | 3,361 |
module Common
export sqerr,
sqerr_deriv,
nlogsig,
nlogsig_deriv,
heaviside,
sigmoid
"""Squared error"""
sqerr(p::Number, y::Number) = (p - y)^2
sqerr_deriv(p::Number, y::Number) = 2(p - y)
"""Negative logistic sigmoid"""
nlogsig(p::Number, y::Number) = -log(sigmoid(p * y... | btwardow/FactorizationMachines.jl | src/common.jl | Julia | mit | 544 |
using Pivot
import Pivot: Static, Filter, Security, Logger, Rendering
import Security: setin_session!, getin_session, setin_cookie!, getin_cookie
# Setting up a relative directory for a home path
appdir = @__FILE__() |> abspath |> dirname
app = Engine()
# middleware -------------------------------------------------... | ZehCnaS34/Pivot.jl | example/app.jl | Julia | mit | 2,524 |
using Documenter, DiscreteEvent
makedocs(sitename="Manual for DiscreteEvent.jl")
| pbayer/PFlow.jl | doc/make.jl | Julia | mit | 82 |
VERSION >= v"0.4" && __precompile__(true)
module AutoHashEquals
export @auto_hash_equals
function auto_hash(name, names)
function expand(i)
if i == 0
:(hash($(QuoteNode(name)), h))
else
:(hash(a.$(names[i]), $(expand(i-1))))
end
end
quote
functio... | JuliaPackageMirrors/AutoHashEquals.jl | src/AutoHashEquals.jl | Julia | mit | 2,335 |
module AnalyticsSpecs
using SessionAnalytics
using Base.Test
const sessionInfo = SessionInfo("CodeJugalbandi", [1, 2, 3], [4, 5, 6])
function run()
# call tests here
sessionRatingBasedOnWeightedAverageOfMeanDelegatesRatingsAndMeanSpeakerParticipantsRatings()
println("Tests passing. Good job.")
... | DhavalDalal/SessionAnalytics | test/analytics/AnalyticsSpecs.jl | Julia | mit | 587 |
@doc """
CHECKCOSTFUNCTION Creates a collaborative filering problem
to check your cost function and gradients
CHECKCOSTFUNCTION(lambda) Creates a collaborative filering problem
to check your cost function and gradients, it will output the
analytical gradients produced by your code and the numerical grad... | homuler/coursera-ml-julia | src/ex8/checkCostFunction.jl | Julia | mit | 1,461 |
immutable LsqFitResult{T}
# simple type container for now, but can be expanded later
dof::Int
param::Vector{T}
resid::Vector{T}
jacobian::Matrix{T}
end
function lmfit(f::Function, p0; kwargs...)
# this is a convenience function for the curve_fit() methods
# which assume f(p) is the cost functionj i.e. the resi... | Vgrunert/LsqFit.jl | src/curve_fit.jl | Julia | mit | 2,786 |
# an example on mixed integer programming
#
# maximize x + 2 y + 5 z
#
# s.t. x + y + z <= 10
# x + 2 y + z <= 15
#
# x is continuous: 0 <= x <= 5
# y is integer: 0 <= y <= 10
# z is binary
#
using CPLEX
env = CPLEX.Env()
model = CPLEX.Model(env, "mip_01")
CPLEX.set_sense!(model,... | sbebo/CPLEX.jl | test/mip_01.jl | Julia | mit | 795 |
export number_neighbors, all_neighbors, random_neighbor,
neutral_neighbors, fitter_neighbors, fitness_range_neighbors,
fittest_neighbors, fittest_neighbor
@doc """neighbors(g::Genotype)
Returns a list of neighbors of Genotype g.
"""
# TODO: Implement all four of Nowak and Krug's methods.
function neighbors(g... | glesica/NK.jl | src/neighbors.jl | Julia | mit | 3,484 |
# Julia wrapper for header: /usr/include/libavdevice/avdevice.h
# Automatically generated using Clang.jl wrap_c, version 0.0.0
export
#avdevice_version,
avdevice_configuration,
avdevice_license,
avdevice_register_all
function avdevice_version()
ccall((:avdevice_version,libavdevice),Uint32,())
en... | SimonDanisch/VideoIO.jl | src/libav/AVDevice/v53/avdevice.jl | Julia | mit | 608 |
using Gadfly
plot([sin, cos], 0, 25, Scale.color_discrete_manual("red", "purple"))
| jiahao/Gadfly.jl | test/discrete_color_manual.jl | Julia | mit | 88 |
# ambiguity resolution
convert{T<:SysFloat}(::Type{Bool}, x::FloatFloat{T}) = (x.hi != zero(T))
convert{T<:SysFloat}(::Type{FloatFloat{T}}, x::Bool) = x ? one(FloatFloat{T}) : zero(FloatFloat{T})
convert{T<:SysFloat}(::Type{FloatFloat{T}}, x::Integer) =
convert(FloatFloat{T}, convert(BigFloat,convert(BigInt,x)))
... | Jeffrey-Sarnoff/FloatFloats.jl | src/type/convert.jl | Julia | mit | 3,587 |
#
# @description Implements the ECB (Electronic Codebook) mode of operation algorithm.
#
# @author Alejandro Claro (alejandro.claro@gmail.com)
#
# Copyright 2017 All rights reserved.
# Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
#
export EcbModeCipher
expor... | alejandroclaro/Cryptography.jl | src/Ciphers/ecb_mode_cipher.jl | Julia | mit | 4,583 |
using GHF
using Base.Test
# write your own tests here
@test 1 == 1
| andferrari/GHF.jl | test/runtests.jl | Julia | mit | 68 |
# This code is duplicated from TerminalExtensions
# Maybe they will be reunified in the future
function prepare_display_file(buf;filename="Unnamed file", size=nothing, width=nothing, height=nothing, preserveAspectRatio::Bool=true, inline::Bool=false)
q = "\e]1337;File="
options = String[]
filename != "Unna... | Keno/TerminalUI.jl | src/iterm2.jl | Julia | mit | 1,470 |
#! /usr/bin/julia
# Rosetta Code, One-dimensional cellular automata
function next_gen(a::BitArray{1}, isperiodic=false)
b = copy(a)
if isperiodic
ncnt = [a[end], a[1:end-1]] + [a[2:end], a[1]]
else
ncnt = [false, a[1:end-1]] + [a[2:end], false]
end
b[ncnt .== 0] = false
b[ncnt ... | MichaeLeroy/rosetta-code | julia/completed/oned_cell_automata.jl | Julia | mit | 919 |
# simple arithmetic expression generator
# note: no recursion so as to avoid issue of infinite strings
@generator EXSimpleExprGen begin
start() = expression()
expression() = operand() * " " * operator() * " " * operand()
operand() = (choose(Bool) ? "-" : "") * join(plus(digit))
digit() = string(choose... | simonpoulding/DataGenerators.jl | test/examples/simple_arithmetic_expression.jl | Julia | mit | 751 |
import Base.println, Base.flush
FILE_SIZE = 5000 * 1028
type FileRoller <: IO
prefix::String
folder::String
filepath::String
file::IO
end
function getsuffix(n::Integer)
str = string(n)
for i = 1:(4 - length(str))
str = "0"*str
end
str
end
function getfile(folder::String, pre... | tmlbl/Lumberjack.jl | src/FileRoller.jl | Julia | mit | 907 |
A = [1 2 ; 3 4]
B = [10, 10]
sum!(B, A)
sum!(A, B)
using ReverseDiffSource
Nn = [20,10,1]
function ann(l1, l2, x1)
x2 = l1 * x1
x2 = max(0., x2) #relu
x3 = l2 * x2
x3 = (max(0., x3[1]))^2 #relu
end
# ls = Array[ ... | fredo-dedup/SimpleNeuralNets | test/NN.jl | Julia | mit | 3,029 |
using DataArrays, DataFrames, FixedEffectModels, Base.Test
df = DataFrame(v1 = @data(["ok", NA, "ok", "first"]), v2 = @data([1, 3, 2, 1]), v3 = @data([NA, 1, 1, NA]))
@test group(df[[:v1]]).pool == [1, 2]
@test group(df[[:v1]]).refs == [2, 0, 2, 1]
@test group(df[[:v2]]) == pool(df[:v2])
@test group(df[[:v2]]) == p... | JuliaPackageMirrors/FixedEffectModels.jl | test/utils.jl | Julia | mit | 719 |
import Base: getindex
import AxisAlgorithms: A_ldiv_B_md!, _A_ldiv_B_md!
### Tridiagonal inversion along a particular dimension, first offsetting the values by b
A_ldiv_B_md!(dest, ::Nothing, src, dim::Integer, ::Nothing) = dest
function A_ldiv_B_md!(dest, F, src, dim::Integer, b::AbstractVector)
1 <= dim <= max... | tlycken/Interpolations.jl | src/filter1d.jl | Julia | mit | 3,593 |
using Jacobi, Plots
gr(size=(700,700))
ProjDir = dirname(@__FILE__)
cd(ProjDir) #do
if !isdefined(Main, :lgt)
function lgt(Q, nx, lb, ub)
z = zglj(Q)
x = collect(linspace(lb, ub, nx))
y = zeros(nx, Q)
for k = 1:Q, i=1:nx
y[i,k]=lagrange(k,x[i],z)
end
(x, y)
end
... | goedman/NMfE.jl | examples/ch05/lagrange.jl | Julia | mit | 777 |
#!/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/hypergeometric/mode/test/fixtures/julia/runner.jl | Julia | apache-2.0 | 1,889 |
include("logger.jl")
x = include("load_data.jl")
include("k-means.jl")
## visualize raw data
#using Gadfly
#plot(x=x[1, :], y=x[2, :])
function compute_final_error(centroids, nearest_centroids)
sum = 0.0
for (i, c) in nearest_centroids
real_centroid = get_real_centroid(i)
diff = real_centroid ... | zxteloiv/julia-ex | clustering/main_kmeans.jl | Julia | bsd-2-clause | 1,257 |
#-------------------------------------------------------------------
#* EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC.
#*
#* This LIBRARY is free software; you can distribute it and/or modify
#* it under the therms of the ALSOC FREE LICENSE as available at
#* http://www.enq.ufrgs.br/alsoc.
#*
#* EMSO Copyrig... | DANA-Laboratory/EMSOModelLibrary.jl | JuliaEMSOModels/types/currency.jl | Julia | mit | 1,419 |
## reductions ##
###### Functors ######
# Note that functors are merely used as internal machinery to enhance code reuse.
# They are not exported.
# When function arguments can be inlined, the use of functors can be removed.
abstract Func{N}
type IdFun <: Func{1} end
type AbsFun <: Func{1} end
type Abs2Fun <: Func{... | shubhamg31/columbus_julia | lib/julia/base/reduce.jl | Julia | apache-2.0 | 11,347 |
function test_glob()
println("-- Testing glob Utilities")
files = Mocha.glob("layers", r".*\.jl$")
for file in files
@test endswith(file, ".jl")
end
@test_throws ErrorException Mocha.glob("layers", r".*.jl$", sort_by=:foobar)
files = Mocha.glob("layers", r".*\.jl$", sort_by=:name)
for i = 1:length(... | manashmndl/Mocha.jl | test/utils/glob.jl | Julia | mit | 576 |
#- Other VISA Definitions --------------------------------------------------*/
const VI_NULL = 0
const VI_TRUE = 1
const VI_FALSE = 0
#- Attributes (platform independent size) ----------------------------------*/
const VI_ATTR_RSRC_CLASS = 0xBFFF0001
const VI_ATTR_RSRC_NAME = 0x... | JuliaPackageMirrors/Instruments.jl | src/visa/constants.jl | Julia | mit | 21,503 |
using Printf
import Memento: debug
export info, warn, debug, @timing,
configure_logger, add_file_logger
global LOGGER = Memento.getlogger(@__MODULE__)
const DEFAULT_LOG_LEVEL = "warn"
"""
info(msg)
Prints a message on info level.
### Input
- `msg` - message string
"""
@inline function info(msg::Strin... | JuliaReach/Reachability.jl | src/logging.jl | Julia | mit | 2,871 |
function scaleto8(G)
# Read a grid with GMT and return an image object of it scaled to [1 255]
add_off = 1;
range = 254. / (G.hdr[6] - G.hdr[5])
img = zeros(UInt8, G.n_rows, G.n_columns)
GMT_grid_flip_vertical(convert(Ptr{Void}, pointer(G.z)), G.n_columns, G.n_rows, 0, sizeof(G.z[1]))
for (k = 1:G.n_columns * G.... | joa-quim/Mirone.jl | src/scaleto8.jl | Julia | mit | 981 |
export tensor,
initTensor,
matricization,
unmatricization,
KRP,
recursiveKRP,
tnorm,
ttv,
ttm,
patch,
getPatchDir,
getOnePatch,
WrapTaper,
Taper,
UnPatch,
PatchProcess,
SeisMixEvents3D
# include("basicOperat... | WneleiGao/SAIGtensor.jl | src/basic/basic.jl | Julia | mit | 409 |
# *****************************************************************************
# 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_CE/src/ACASX_CE.jl | Julia | apache-2.0 | 5,496 |
import Base: size, axpy!
import Base.LinAlg.scale!
import Base.BLAS: gemm!
import ArrayViews: view, StridedView, ContiguousView
abstract AbstractGLRM
export AbstractGLRM, GLRM, getindex, size
typealias ObsArray Union(Array{Array{Int,1},1}, Array{UnitRange{Int},1})
### GLRM TYPE
type GLRM{L<:Loss, R<:Regularizer}<:A... | jaehyunp/LowRankModels.jl | src/glrm.jl | Julia | mit | 4,283 |
# Julia wrapper for header: /home/kevin/src/vlfeat/vl/imopv.h
# Automatically generated using Clang.jl wrap_c, version 0.0.0
export
vl_imconvcol_vf,
vl_imconvcol_vd,
vl_imconvcoltri_f,
vl_imconvcoltri_d,
vl_imintegral_f,
vl_imintegral_d,
vl_imintegral_i32,
vl_imintegral_ui32,
vl_im... | IHPostal/VLFeat.jl | src/libvl/imopv.jl | Julia | bsd-2-clause | 6,862 |
#=
lhfs
Description:
Computes value and possibly source-derivatives of fundamental solution at
a series of target points and energies, with the source at the origin.
Parameters:
x (input) - array of x coordinates in the cartesian plane
y (input) - array of y coordinates in the cartesian p... | ApproxFun/SIE.jl | src/FundamentalSolutions/lhfs.jl | Julia | bsd-3-clause | 4,890 |
#
# Calculates requests per second from client to server without response, but
# using only naked sockets.
# Results: rps: 29303.170665295427, time: 34.12599992752075
#
server = listen(2000)
sock = accept(server)
function run()
for i=1:1000000 serialize(sock, rand(1:100)) end
end
| tmptrash/jevo | tmp/perf/ServerSerialize.jl | Julia | mit | 286 |
function parsedatetime(dt::String)
res = match(r"(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})\s(\w{3})",dt).captures
datetime(int(res[1]),int(res[2]),int(res[3]),int(res[4]),int(res[5]),int(res[6]),0,eval(parse(res[7])))
end
function parsedatetime1(dt::String)
res = match(r"(\d{4})-(\d{2})-(\d{2})\s(\... | JuliaQuant/FinancialSeries.jl | src/utilities.jl | Julia | mit | 1,376 |
## Script which prints out the hostnames of the worker processes
# Used in conjunction with a job script to ensure multi-node parallelism
hosts = @parallel for i=1:120
run(`hostname`) end
println(hosts)
| UCIDataScienceInitiative/IntroToJulia | ExampleCode/test.jl | Julia | mit | 211 |
include("SegyStruct.jl")
include("Header.jl")
function SeisToSegy(in,out,su=true)
if (su==true)
file_hsize = 0
else
file_hsize = 900
# add commands here to read text and binary headers out.thead and out.bhead and write them to out
end
stream_h = open(join([in ".seish"]))
seek(stream_h, file_hsize + h... | Lanzafame/Seismic.jl | src/Utils/SeisToSegy.jl | Julia | mit | 930 |
# This was formerly a part of Julia. License is MIT: http://julialang.org/license
import Base.Order.Reverse
@testset "PriorityQueue" begin
# Test dequeing in sorted order.
function test_issorted!(pq::PriorityQueue, priorities, rev=false)
last = dequeue!(pq)
while !isempty(pq)
val... | JuliaLang/DataStructures.jl | test/test_priority_queue.jl | Julia | mit | 9,430 |
# Copyright 2021 Google LLC
#
# 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
#
# Unless required by applicable law or agreed to in writing, s... | google-research/LargeScaleLpInfeasibility | run_bilinear_experiment.jl | Julia | apache-2.0 | 1,981 |
# This file is auto-generated by AWSMetadata.jl
using AWS
using AWS.AWSServices: elastic_inference
using AWS.Compat
using AWS.UUIDs
"""
describe_accelerator_offerings(location_type)
describe_accelerator_offerings(location_type, params::Dict{String,<:Any})
Describes the locations in which a given accelerator ... | JuliaCloud/AWS.jl | src/services/elastic_inference.jl | Julia | mit | 7,173 |
module BoundingBoxes
export @boundingbox
macro boundingbox(ex)
bound_name = ex.args[1]
axes = ex.args[2:end]
# construct Bounding Box type
types = [Expr(:(::),Symbol(axe*"_max"),:T) for axe in axes]
append!(types,[Expr(:(::),Symbol(axe*"_min"),:T) for axe in axes])
curly = Expr(:curly, bound_n... | JuliaPackageMirrors/BoundingBoxes.jl | src/BoundingBoxes.jl | Julia | mit | 3,281 |
module TestGrouping
using Base.Test
using DataFrames
df = DataFrame(a=rep(1:4, 2), b=rep(2:-1:1, 4), c=randn(8))
#df[6, :a] = NA
#df[7, :b] = NA
cols = [:a, :b]
f(df) = DataFrame(cmax = maximum(df[:c]))
sdf = sort(df, cols=cols)
bdf = by(df, cols, f)
@test bdf[cols] == uniqu... | pwoolcoc/DataFrames.jl | test/grouping.jl | Julia | mit | 740 |
module DynamicDiscreteChoice
include("general/general.jl")
include("nfxp/nfxp.jl")
end # module
| cpritcha/DynamicDiscreteChoice | src/DynamicDiscreteChoice.jl | Julia | mit | 98 |
####################################
#
# options
#
####################################
struct CDOptions
maxIter::Int64
optTol::Float64
randomize::Bool # coordinate are visitied in a randomized order or not
warmStart::Bool # when running CD, should we do path following or not
numSteps::In... | mlakolar/HD.jl | src/utils.jl | Julia | mit | 4,093 |
using BinDeps
using Compat
using Compat.Sys: iswindows, isapple, isunix
@BinDeps.setup
version = "3370"
baseurl = "ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/"
if isunix()
archivename = "cfitsio$(version).tar.gz"
elseif iswindows()
archivename = "cfitsio_MSVC_$(Sys.WORD_SIZE)bit_DLL_$(version).zip"
end
l... | kbarbary/FITSIO.jl | deps/build.jl | Julia | mit | 2,206 |
importall Base
##########
# ANGLES #
##########
"""
Encodes the angle
2pi/N*(val + slice)
where val is always assumed to be in [0,1)
"""
immutable Angle{N, T<:Real}
val::T # value in the camembert slice
slice::Int # camembert slice
function Angle(val, n)
if 0<=val<1
... | dprn/ApApproximation.jl | src/bispectralset.jl | Julia | mit | 9,091 |
# this just exports all the keys to forward them from GLFW to the user.
KEY_ESC = GLFW.KEY_ESC
export KEY_ESC
| ssfrr/Draw3D.jl | src/keyexports.jl | Julia | mit | 111 |
_hold = false
hold() = (global _hold = !_hold)
hold(h::Bool) = (global _hold = h)
function ghf()
if !_hold
global _pwinston = FramedPlot()
end
_pwinston
end
ghf(p) = (global _pwinston = p)
savefig(fname::String, args...; kvs...) = savefig(_pwinston, fname, args...; kvs...)
@deprecate file savefig... | KristofferC/Winston.jl | src/plot.jl | Julia | mit | 21,155 |
macro nogc(ex)
quote
local val
try
gc_enable(false)
val = $(esc(ex))
finally
gc_enable(true)
end
val
end
end | claesenm/optunity | wrappers/julia/nogc.jl | Julia | bsd-3-clause | 150 |
using GLVisualize, NPZ
function volume_data(N)
volume = Float32[sin(x/15.0)+sin(y/15.0)+sin(z/15.0) for x=1:N, y=1:N, z=1:N]
max = maximum(volume)
min = minimum(volume)
volume = (volume .- min) ./ (max .- min)
end
const vol_data = volume_data(128)
| staticfloat/GLVisualize.jl | examples/volume.jl | Julia | mit | 260 |
export Logic,
handle
import Nettle
function solution_hash(word::UTF8String, nick::UTF8String)
Nettle.hexdigest("sha256", word * nick)
end
matches(puzzle::Puzzle, word::Word) = sort_and_normalize(puzzle.v) == sort_and_normalize(word.v)
function string_to_dict{T}(s::T)
d = Dict{Char, Int}()
for c i... | dandeliondeathray/Niancat.jl | src/logic.jl | Julia | mit | 4,958 |
include(joinpath(dirname(@__FILE__), "PlainDocs.jl"))
include(joinpath(dirname(@__FILE__), "ExampleAside.jl"))
include(joinpath(dirname(@__FILE__), "NoNewline.jl"))
Docile.Cache.register_module(joinpath(dirname(@__FILE__), "PlainDocs.jl"))
Docile.Cache.register_module(joinpath(dirname(@__FILE__), "ExampleAside.jl"))
... | hayd/Docile.jl | test/Collector/facts.jl | Julia | mit | 9,198 |
function alphavalue(c)
int(c) - int('A') +1
end
function totalalphavalue(s)
mapreduce(alphavalue, +, collect(s))
end
function main()
filepath = pwd() * "/p022_names.txt"
text = open(readall, filepath)
text = replace(text, ['"','\\'], "")
names = split(text,',')
sort!(names)
namevalues = map(totalalphavalue,... | cmey/euler | problem22.jl | Julia | mit | 384 |
pushopt(options::Dict,expr::Expr) = Base.Meta.isexpr(expr,:(=)) && (options[expr.args[1]] = expr.args[2])
type MarkupInput
codestart::Regex
codeend::Regex
end
type ScriptInput
doc_line::Regex
doc_start::Regex
opt_line::Regex
opt_start::Regex
end
const input_formats = Dict{AbstractString, Any}(
... | JuliaPackageMirrors/Weave.jl | src/readers.jl | Julia | mit | 6,715 |
###############################################
## Reading and writing Julia data .jld files ##
###############################################
module JLD
using HDF5, Compat
# Add methods to...
import HDF5: close, dump, exists, file, getindex, setindex!, g_create, g_open, o_delete, name, names, read, write,
... | zhmz90/JLD.jl | src/JLD.jl | Julia | mit | 38,113 |
module ModificationCaches
using LinearAlgebra
using SparseArrays
export
VectorModificationCache,
MatrixModificationCache,
ProblemModificationCache,
WarmStartCache,
processupdates!
import OSQP
mutable struct VectorModificationCache{T}
data::Vector{T}
dirty::Bool
VectorModificationCach... | bstellato/OSQP.jl | src/modcaches.jl | Julia | apache-2.0 | 5,664 |
module Interface
using Compat; import Compat.String
import ..Legacy:
AbstractEntry,
Comment,
Docs,
Entry,
Manual,
Metadata,
Page
import ..Utilities: Utilities
import ..Cache
import ..Formats
include("legacy.jl")
end
| JuliaPackageMirrors/Docile.jl | src/Interface/Interface.jl | Julia | mit | 250 |
# Parameters:
# FFT1::Array{Array{Float64, 2}, 1}
# - the first Fourier transform
# FFT2::Array{Array{Float64, 2}, 1}
# - the second Fourier transform
# Return Values:
# Correlation::Array{Array{Float64, 2}, 1}
# - the correlation of FFT1 and FFT2
# Notes:
# - FFT1 and FFT2 have to be Fourier transforms of functions ov... | JuliaPackageMirrors/SnFFT.jl | src/Correlation.jl | Julia | mit | 721 |
# Are only really needed for cases when we accept general LTISystem
# we should either use them consistently, with a good definition, or remove them
numeric_type(::Type{SisoRational{T}}) where T = T
numeric_type(::Type{<:SisoZpk{T}}) where T = T
numeric_type(sys::SisoTf) = numeric_type(typeof(sys))
numeric_type(::Type... | JuliaControl/Control.jl | src/utilities.jl | Julia | mit | 7,709 |
module CoNLLReader
export BaseToken, format, read
typealias String AbstractString
macro format(t_name, args...)
token_t = :(type $t_name end)
token_fields = token_t.args[3].args
init = parse("""function $t_name(line::AbstractString)
items = split(strip(line), "\t")
end""")
init_args = ... | masashi-y/CoNLLReader.jl | src/CoNLLReader.jl | Julia | mit | 2,473 |
@inbounds for i = ix:ix-1+n
x[i] = $op( a, x[i] )
end
| JuliaPackageMirrors/FastArrayOps.jl | src/templates/scalarr1_for_inc1.jl | Julia | mit | 58 |
#Different boundary conditions
#Standard continuous boundaries (allows outflow)
function apply_bcs(hyd::data2d)
#arrays starting from zero
# |g |n-g #
#[0 1 2 x x x ..... x x x 7 8 9]
#arrays starting from 1
# |g |n-g #
#[1 2 3 x x x ..... x ... | natj/hydro | src/boundaries.jl | Julia | mit | 4,638 |
function test_craig(A, b; λ=0.0)
(x, y, stats) = craig(A, b, λ=λ)
r = b - A * x
# if λ > 0
# s = r / sqrt(λ)
# r = r - sqrt(λ) * s
# end
resid = norm(r) / norm(b)
return (x, y, stats, resid)
end
@testset "craig" begin
craig_tol = 1.0e-6
for FC in (Float64,)
@testset "Data Type: $FC" begin
... | JuliaOptimizers/Krylov.jl | test/test_craig.jl | Julia | mit | 4,533 |
# Functions for Bayesian logit model with a Normal prior N(0, priorVar*I)
function logPrior(pars::Vector{Float64}, nPars::Int, data::Dict{Any, Any})
return (-dot(pars,pars)/data["priorVar"]
-nPars*log(2*pi*data["priorVar"]))/2
end
function logLikelihood(pars::Vector{Float64}, nPars::Int, data::Dict{Any, Any})
... | scidom/GeometricMCMC.jl | test/logitNormalPrior.jl | Julia | mit | 1,321 |
@test adjacency_matrix(g3)[3,2] == 1
@test adjacency_matrix(g3)[2,4] == 0
@test laplacian_matrix(g3)[3,2] == -1
@test laplacian_matrix(g3)[1,3] == 0
@test laplacian_spectrum(g3)[5] == 3.6180339887498945
@test adjacency_spectrum(g3)[1] == -1.732050807568878
| jpfairbanks/LightGraphs.jl | test/linalg.jl | Julia | bsd-2-clause | 257 |
@testset "collect_pair" begin
# test of collect on pair rdds
sc = SparkContext(master="local")
nums1 = parallelize(sc, 1:2)
nums2 = parallelize(sc, 11:12)
pairs = cartesian(nums1, nums2)
values = collect(pairs)
@test values == [(1,11), (1,12), (2, 11), (2, 12)]
close(sc)
end
| dfdx/Sparta.jl | test/collect_pair.jl | Julia | mit | 282 |
@testset "NumField/Elem" begin
k = wildanger_field(3, 13)[1]
c = cyclotomic_field(3)[1]
q = quadratic_field(17)[1]
@testset for K in [k, c, q]
R, x = PolynomialRing(K, 3)
f = sum(x)^2
g = sum(x) * sum(t+2 for t = x)
h = sum(x)
@test gcd(f,g) == h
@test isone(gcd(f+1,g))
end
end
| thofma/Hecke.jl | test/NfAbs/MPolyGcd.jl | Julia | bsd-2-clause | 320 |
selty = sizeof($(elty))
px = convert(Ptr{$(elty)},x) + (ix-1)*selty
py = convert(Ptr{$(elty)},y) + (iy-1)*selty
ccall(:memcpy, Ptr{Void}, (Ptr{Void}, Ptr{Void}, Uint),
px, py, n*selty)
| JuliaPackageMirrors/FastArrayOps.jl | src/templates/c_memcpy.jl | Julia | mit | 189 |
# Poly type manipulations
isdefined(Base, :__precompile__) && __precompile__()
module Polynomials
#todo: sparse polynomials?
using Compat
export Poly, poly
export degree, coeffs, variable
export polyval, polyint, polyder, roots, polyfit
export Pade, padeval
import Base: length, endof, getindex, setindex!, copy, ze... | JuliaPackageMirrors/Polynomials.jl | src/Polynomials.jl | Julia | mit | 13,937 |
function recursive_brim!(M::Modular)
#=
Recursive BRIM as in Barber
=#
# -2- R and T sub-matrices
n_rows, n_cols = size(M.A)
m = sum(M.A)
R = M.S[[1:n_cols],:]
T = M.S[[(n_cols+1):end],:]
B = M.A - kron(sum(M.A, 1), sum(M.A, 2)) ./ m
# -3- Recursive BRIM
old_Q = 0.0
new_Q = 0.00000... | tkelman/Brim.jl | src/recursive_brim.jl | Julia | mit | 1,037 |
#!/usr/bin/env julia
using ArgParse
import SpikeSorter
#set up arguments
s = ArgParseSettings()
@add_arg_table s begin
"--session"
help = "The name of the session to be checked"
"--channel"
help = "The channel to be processed"
arg_type = Int
"--chunk"
help = "The chunk for process"
arg_type = Int
"--dir"
... | grero/SpikeSorter.jl | src/get_valid_template_files.jl | Julia | mit | 1,076 |
abstract AbstractLotkaVolterra
#abstract
"""The per capita growth rate of each speicies in the ecosystem"""
specificrate(Z::AbstractLotkaVolterra,x::Vector{Float64}) = intrinsicrate(Z)+communitymatrix(Z)*x
"""The total growth rate of each species in the ecosystem"""
rate(Z::AbstractLotkaVolterra,x::Vector{Float64}) = ... | gajomi/LotkaVolterra.jl | src/abstract.jl | Julia | mit | 4,924 |
export std_dev, variance, dist, rms, angle, gram_schmidt
function std_dev(x)
return vecnorm(x - mean(x))/sqrt(length(x))
end
function variance(x)
return sum((x - mean(x)).^2)/length(x)
end
function dist(x, y)
return vecnorm(x - y)
end
function rms(x)
return vecnorm(x)/sqrt(length(x))
end
function angle(x, ... | davidlizeng/MMA.jl | src/math.jl | Julia | mit | 1,551 |
# warn("Must remove optional dev/ISAMRemoteSolve.jl dependency here.")
# include("dev/ISAMRemoteSolve.jl")
immutable RangeAzimuthElevation
range::Float64
azimuth::Float64
elevation::Union{Void,Float64}
end
function convert{T <: CoordinateTransformations.AffineMap}(::Type{T}, x::SE3)
q = convert(TransformUti... | dehann/RoME.jl | src/RobotUtils.jl | Julia | mit | 24,591 |
module TestNameManager
using MXNet
using Base.Test
function test_default()
info("NameManager::default")
name = :_____aaaaa_____
@test get!(mx.DEFAULT_NAME_MANAGER, name, "") == name
@test get!(mx.DEFAULT_NAME_MANAGER, string(name), "") == name
hint = name
@test get!(mx.DEFAULT_NAME_MANAGER, "", hint) == ... | JuliaPackageMirrors/MXNet.jl | test/unittest/name.jl | Julia | apache-2.0 | 754 |
export Jacobi,Legendre
#TODO Type
immutable Jacobi{D<:Domain} <: PolynomialSpace{D}
a::Float64
b::Float64
domain::D
end
Legendre(domain)=Jacobi(0.,0.,domain)
Legendre()=Legendre(Interval())
Jacobi(a,b,d::Domain)=Jacobi{typeof(d)}(a,b,d)
Jacobi(a,b,d)=Jacobi(a,b,Domain(d))
Jacobi(a,b)=Jacobi(a,b,Interval())... | yuyichao/ApproxFun.jl | src/Spaces/Jacobi/Jacobi.jl | Julia | bsd-3-clause | 6,488 |
function convert_second_order(model::M) where M <: Lombardo_Sutherland_Soln
ssh = copy(model.ssh)
hx = copy(model.hx)
hxx = copy(model.hxx)
ssg = copy(model.ssg)
gx = copy(model.gx)
gxx = copy(model.gxx)
eta = copy(model.eta)
sigma = copy(model.sigma)
g... | RJDennis/SolveDSGE | src/old/convert_second_order.jl | Julia | mit | 1,120 |
function horizon(; x::AbstractVector = [], y::AbstractVector = [])
#Base for code to modify
v = areaplot(x = x, y = y)
v.height = 100
v.name = "horizon"
#Add signals to deal with mouse-clicks
v.signals = [
Dict{Any, Any}("name" => "layers",
"init... | johnmyleswhite/Vega.jl | src/derived/horizon.jl | Julia | mit | 5,025 |
using ApproxFun, SpectralMeasures, Test, LinearAlgebra
import ApproxFun: ldiv_coefficients
############
### Tests
############
@testset "Spectral measures" begin
@testset "Chebyshev U" begin
a = Float64[]; b= Float64[]
@time μ=spectralmeasure(a,b)
@test μ.(-.99:.01:.99) ≈ sqrt.(1 .-(-.9... | ApproxFun/SpectralMeasures.jl | test/runtests.jl | Julia | mit | 3,603 |
function open(filename::String, new::Bool=false)
Base.warn_once("ZipFile.open is deprecated, use ZipFile.Reader or ZipFile.Writer.")
new ? Writer(filename) : Reader(filename)
end
const Dir = Reader
const WritableDir = Writer
const File = ReadableFile
| jbn/ZipFile.jl | src/deprecated.jl | Julia | mit | 255 |
# Test of vbroadcast
using NumericExtensions
using Base.Test
#### 2D ####
x = randn(5, 6)
yr = rand(6) .+ 0.5
yrm = reshape(yr, 1, 6)
yc = rand(5) .+ 0.5
# badd
@test_approx_eq badd(x, yc, 1) x .+ yc
@test_approx_eq badd(x, yr, 2) x .+ yrm
r = copy(x); badd!(r, yc, 1)
@test_approx_eq r x .+ yc
r = copy(x); badd!... | simonster/NumericExtensions.jl | test/vbroadcast.jl | Julia | mit | 1,777 |
using Gadfly
plot([sin, cos], 0, 25)
| Roger-luo/Gadfly.jl | test/function_plots.jl | Julia | mit | 39 |
# Another function with nontrivial groups and
# repetitious elements.
# NB: scaled version of COSINE
# Source:
# N. Gould, private communication.
# classification OUR2-AN-V-0
# Problem 50 in
# L. Luksan, C. Matonoha and J. Vlcek
# Modified CUTE problems for sparse unconstrained optimization,
# Te... | dpo/OptimizationProblems.jl | src/scosine.jl | Julia | mit | 1,123 |
module SafetyAndPlanningModule
using PyPlot
using Unitful #allow SI units to be used + manipulations
export check_coor,create_data,convert2unit,volume_patches,plot_patches
export geometry,circle,rectangle,hexagon,triangle,wanted_volume,amplitude,gradient_scan
export scanner_reg,scanner_small,clearance,x_min_ro... | flo12345678/SafetyAndPlanningModule | src/SafetyAndPlanningModule.jl | Julia | mit | 1,804 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.