This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Base.Test | |
Base.hcat(Xin::Union{SparseVector, SparseMatrixCSC}...) = hcat(map(SparseMatrixCSC, Xin)...) | |
Base.vcat(Xin::Union{SparseVector, SparseMatrixCSC}...) = vcat(map(SparseMatrixCSC, Xin)...) | |
Base.hcat(Xin::Union{Vector, AbstractSparseVector}...) = hcat(map(sparse, Xin)...) | |
Base.vcat(Xin::Union{Vector, AbstractSparseVector}...) = vcat(map(sparse, Xin)...) | |
function Base.hcat(Xin::Union{Matrix, Vector, SparseMatrixCSC}...) | |
X = SparseMatrixCSC[issparse(x) ? x : sparse(x) for x in Xin] | |
hcat(X...) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
julia> using Plots | |
INFO: Precompiling module Plots... | |
WARNING: Base.writemime is deprecated. | |
likely near /home/pkm/.julia/v0.5/Plots/src/backends/gadfly.jl:696 | |
WARNING: Base.writemime is deprecated. | |
likely near /home/pkm/.julia/v0.5/Plots/src/backends/gadfly.jl:696 | |
WARNING: Base.writemime is deprecated. | |
likely near /home/pkm/.julia/v0.5/Plots/src/backends/gadfly.jl:696 | |
WARNING: Base.writemime is deprecated. | |
likely near /home/pkm/.julia/v0.5/Plots/src/backends/gadfly.jl:696 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using CUTEst | |
patho_problems=[ "ARGTRIGLS" | |
"BENNETT5LS" | |
"BOXBODLS" | |
"BROYDN3DLS" | |
"BROYDNBDLS" | |
"CHWIRUT1LS" | |
"CHWIRUT2LS" | |
"CKOEHELB" | |
"DANWOODLS" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+- Any << abstract immutable size:0 >> | |
. +- Cycle = Base.Cycle{I} << concrete immutable size:8 >> | |
. +- Tuple = Tuple{Vararg{Char}} << concrete immutable size:0 >> | |
. . +- Union{AbstractArray{A<:AbstractArray{Int64,1},1},AbstractArray{Range{Int64},1},AbstractArray{UnitRange{Int64},1},Tuple{Vararg{Union{AbstractArray{Int64,1},Range{T}}}}} | |
. . . +- RangeVecIntList = Union{AbstractArray{A<:AbstractArray{Int64,1},1},AbstractArray{Range{Int64},1},AbstractArray{UnitRange{Int64},1},Tuple{Vararg{Union{AbstractArray{Int64,1},Range{T}}}}} | |
. . +- Chars = Union{AbstractArray{Char,1},Char,Set{Char},Tuple{Vararg{Char}}} | |
. +- AbstractCmd = Base.AbstractCmd << abstract immutable size:0 >> | |
. +- NewvarNode << concrete immutable size:8 >> | |
. +- TopNode << concrete immutable size:8 >> | |
. . +- ExprNode = Union{Expr,GlobalRef,GotoNode,LabelNode,LineNumberNode,QuoteNode,SymbolNode,TopNode} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BenchmarkTools | |
A = rand(10000) | |
B = Vector[rand(10) for i = 1:1000] | |
C = rand(10,1000) | |
D = rand(10000) | |
E = Vector[rand(10) for i = 1:1000] | |
F = rand(10, 1000) | |
function fast!(a, c) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BenchmarkTools | |
A = rand(10000) | |
B = Vector[rand(10) for i = 1:1000] | |
C = rand(10,1000) | |
D = rand(10000) | |
E = Vector[rand(10) for i = 1:1000] | |
F = rand(10, 1000) | |
function fast!(a, c) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
julia> using Optim | |
julia> function rosenbrock(x) | |
N = length(x) | |
fval = 0.0 | |
for i in 1:div(N, 2) | |
fval += 100(x[2i-1]^2 - x[2i])^2 + (x[2i-1] - 1.0)^2 | |
end | |
fval | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function LearnBase.learn!(solver::CrossEntropyMethod, env::AbstractEnvironment, doanim = false) | |
# !!! INIT: | |
# this is a mappable function of θ to reward | |
cem_episode = θ -> begin | |
π = cem_policy(env, θ) | |
R, T = episode!(env, π; maxiter = solver.options[:maxiter]) | |
R | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
K = 5 | |
N = 3 | |
z = [rand(20000, K) for i =1:N] | |
P = [rand(20000) for i = 1:N] | |
Pm = rand(20000, N) | |
Pv = [@view Pm[:, j] for j = 1:N] | |
cache = zeros(20000, K) | |
function test1(P, z) | |
for i in eachindex(P) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BenchmarkTools | |
K = 5 | |
N = 3 | |
z = [rand(20000, K) for i =1:N] | |
P = [rand(20000) for i = 1:N] | |
cache = zeros(20000, K) | |
function test1(P, z) | |
for i in eachindex(P) | |
cache .= P[i].*z[i] |