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
+- 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 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
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 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 Base.Test | |
julia> # Quadratic objective function | |
# For (A*x-b)^2/2 | |
function quadratic!(x, g, AtA, Atb, tmp) | |
calc_grad = !(g === nothing) | |
A_mul_B!(tmp, AtA, x) | |
v = dot(x,tmp)/2 + dot(Atb,x) | |
if calc_grad | |
for i = 1:length(g) |
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 Base.Test | |
julia> # Quadratic objective function | |
# For (A*x-b)^2/2 | |
function quadratic!(x, g, AtA, Atb, tmp) | |
calc_grad = !(g === nothing) | |
A_mul_B!(tmp, AtA, x) | |
v = dot(x,tmp)/2 + dot(Atb,x) | |
if calc_grad |
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
\documentclass{standalone} | |
\usepackage{pgfplots} | |
\begin{document} | |
\usepgfplotslibrary{fillbetween} | |
\begin{tikzpicture} | |
\begin{axis} | |
\addplot[name path=function, domain=-1.5:1] {x^2}; | |
\path[name path=axis] (axis cs:-1.5,0.0) -- (axis cs:1,0.0); | |
\addplot[yellow] fill between[of = function and axis]; |
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 Benchmarks | |
mydot{T<:BLAS.BlasReal, TI<:Integer}(x::Vector{T}, rx::Union{UnitRange{TI},Range{TI}}, y::Vector{T}, ry::Union{UnitRange{TI},Range{TI}}) = BLAS.dot(sub(x, rx), sub(y, ry)) | |
mydot{T<:BLAS.BlasComplex, TI<:Integer}(x::Vector{T}, rx::Union{UnitRange{TI},Range{TI}}, y::Vector{T}, ry::Union{UnitRange{TI},Range{TI}}) = BLAS.dotc(sub(x, rx), sub(y, ry)) | |
n = 1000 | |
m = 20 | |
step_size = 5 | |
x = rand(n) | |
y = rand(n) | |
xc = rand(Complex128, n) |
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> @code_warntype [sprand(10,10,.1) rand(10,10)] | |
Variables: | |
#self#::Base.#hcat | |
Xin::Tuple{SparseMatrixCSC{Float64,Int64},Array{Float64,2}} | |
X::Array{SparseMatrixCSC{Tv,Ti<:Integer},1} | |
#temp#@_4::Int64 | |
#temp#@_5::Int64 | |
#temp#@_6::Int64 | |
x::Union{Array{Float64,2},SparseMatrixCSC{Float64,Int64}} | |
#temp#@_8::Int64 |