Hi Madeleine,

Is there any chance you have two versions of julia installed, and are running 
the wrong one? (Confession: I make that mistake surprisingly frequently!) The 
reason I ask is that on current master:

julia> methodswith(Array, kron)
0-element Array{Method,1}

In master (which is what you linked to) they have all been abstract-ized, yet 
in the julia session you showed, the "closest candidates" list includes 
several methods specific for `Array`.

Best,
--Tim

On Thursday, July 14, 2016 1:53:28 PM CDT Madeleine Udell wrote:
> Convex.jl defines an abstract type AbstractExpr, from which all important
> concrete types in the package are descended. We've defined a bunch of
> functions that allow users to treat AbstractExprs as though they were
> matrices: indexing, hcat, vcat, multiplication, addition, subtraction, etc.
> Can we use these to automatically get more advanced functions, like (for
> example) kron?
> 
> The code for kron
> <https://github.com/JuliaLang/julia/blob/master/base/linalg/dense.jl#L134>
> uses only indexing and multiplication operators. But I'm not sure how to
> make AbstractExpr (and its subtypes) subtype AbstractMatrix{Float64} or
> subtype AbstractArray{Float64,2} to make this transition seamless.
> 
> Simply defining
> 
> abstract AbstractExpr <: AbstractArray{Float64,2}
> 
> results in a method error: (Variable is defined as a subtype of
> AbstractExpr)
> 
> julia> kron(A,B)
> ERROR: MethodError: `kron` has no method matching kron(::Array{Float64,2},
> 
> ::Convex.Variable)
> 
> Closest candidates are:
>   kron(::Any, ::Any, ::Any, ::Any...)
>   kron{T,S}(::Array{T,2}, ::Array{S,2})
>   kron(::Union{Array{T,1},Array{T,2}}, ::Number)
> 
> 1) Is it possible to have Convex's AbstractExpr inherit from AbstractArray?
> What other methods would we need to implement to make this work?
> 2) Is it a terrible idea, for reasons I haven't thought of?
> 
> Thanks!
> Madeleine


Reply via email to