Skip to content

Instantly share code, notes, and snippets.

@pkofod
Created April 25, 2016 11:02
Show Gist options
  • Save pkofod/0e8fa1bbadebca9127d68fa5ec5dd0b0 to your computer and use it in GitHub Desktop.
Save pkofod/0e8fa1bbadebca9127d68fa5ec5dd0b0 to your computer and use it in GitHub Desktop.
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
#temp#@_9::Any
Body:
begin # sparse/sparsematrix.jl, line 2874:
NewvarNode(:(X::Array{SparseMatrixCSC{Tv,Ti<:Integer},1}))
GenSym(1) = (Base.nfields)(Xin::Tuple{SparseMatrixCSC{Float64,Int64},Array{Float64,2}})::Int64
GenSym(2) = (top(ccall))(:jl_alloc_array_1d,(top(apply_type))(Core.Array,SparseMatrixCSC{Tv,Ti<:Integer},1)::Type{Array{SparseMatrixCSC{Tv,Ti<:Integer},1}},(top(svec))(Core.Any,Core.Int)::SimpleVector,Array{SparseMatrixCSC{Tv,Ti<:Integer},1},0,GenSym(1),0)::Array{SparseMatrixCSC{Tv,Ti<:Integer},1}
#temp#@_4::Int64 = 1
#temp#@_5::Int64 = 1
#temp#@_6::Int64 = 0
8:
unless (Base.box)(Base.Bool,(Base.not_int)((#temp#@_6::Int64 === GenSym(1))::Bool)) goto 36
GenSym(3) = (Base.box)(Int64,(Base.add_int)(#temp#@_6::Int64,1))
#temp#@_6::Int64 = GenSym(3)
GenSym(9) = (Base.getfield)(Xin::Tuple{SparseMatrixCSC{Float64,Int64},Array{Float64,2}},#temp#@_5::Int64)::Union{Array{Float64,2},SparseMatrixCSC{Float64,Int64}}
GenSym(10) = (Base.box)(Int64,(Base.add_int)(#temp#@_5::Int64,1))
#temp#@_8::Int64 = 1
GenSym(11) = GenSym(9)
GenSym(12) = (Base.box)(Int64,(Base.add_int)(1,1))
x::Union{Array{Float64,2},SparseMatrixCSC{Float64,Int64}} = GenSym(11)
#temp#@_8::Int64 = GenSym(12)
GenSym(13) = GenSym(10)
GenSym(14) = (Base.box)(Int64,(Base.add_int)(2,1))
#temp#@_5::Int64 = GenSym(13)
#temp#@_8::Int64 = GenSym(14)
unless (Base.SparseArrays.issparse)(x::Union{Array{Float64,2},SparseMatrixCSC{Float64,Int64}})::Bool goto 26
#temp#@_9::Any = x::Union{Array{Float64,2},SparseMatrixCSC{Float64,Int64}}
goto 28
26:
#temp#@_9::Any = (Base.SparseArrays.sparse)(x::Union{Array{Float64,2},SparseMatrixCSC{Float64,Int64}})::SparseMatrixCSC{Float64,Int64}
28:
GenSym(7) = #temp#@_9::Union{Array{Float64,2},SparseMatrixCSC{Float64,Int64}}
$(Expr(:inbounds, true))
(top(setindex!))(GenSym(2),GenSym(7),#temp#@_4::Int64)::Array{SparseMatrixCSC{Tv,Ti<:Integer},1}
$(Expr(:inbounds, :pop))
#temp#@_4::Int64 = (Base.box)(Int64,(Base.add_int)(#temp#@_4::Int64,1))
34:
goto 8
36:
37:
X::Array{SparseMatrixCSC{Tv,Ti<:Integer},1} = GenSym(2) # sparse/sparsematrix.jl, line 2875:
return (top(_apply))(Base.SparseArrays.hcat,X::Array{SparseMatrixCSC{Tv,Ti<:Integer},1})::Union{Array{Any,1},SparseMatrixCSC{Tv,Ti<:Integer}}
end::Union{Array{Any,1},SparseMatrixCSC{Tv,Ti<:Integer}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment