-
-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vcat ambiguity with SparseArrays method #222
Comments
The underlying code in the package using ComponentArrays # version: [b0b7db55] ComponentArrays v0.15.2
u0 = ComponentArray(
GWAT = (mm = 0.0, d18O = 0.0, d2H = 0.0),
INTS = (mm = 0.0, d18O = 0.0, d2H = 0.0),
INTR = (mm = 0.0, d18O = 0.0, d2H = 0.0),
accum = (cum_d_prec = 0.0, ))
reduce(vcat, [u0.GWAT.mm, u0.INTS.mm, u0.INTR.mm]) # works
reduce(vcat, [u0.GWAT.mm, u0.INTS.mm, u0.INTR.mm, u0.accum]) # doesn't work giving the error: julia> reduce(vcat, [u0.GWAT.mm, u0.INTS.mm, u0.INTR.mm, u0.accum]) # doesn't work
ERROR: MethodError: vcat(::Vector{Float64}, ::ComponentVector{Float64, SubArray{Float64, 1, Vector{Float64}, Tuple{UnitRange{Int64}}, true}, Tuple{Axis{(cum_d_prec = 1,)}}}) is ambiguous.
Candidates:
vcat(x::AbstractVector, y::ComponentVector)
@ ComponentArrays ~/.julia/packages/ComponentArrays/NnCVQ/src/array_interface.jl:37
vcat(X::Union{Number, AbstractVecOrMat{<:Number}}...)
@ SparseArrays ~/.julia/juliaup/julia-1.10.0-beta2+0.x64.apple.darwin14/share/julia/stdlib/v1.10/SparseArrays/src/sparsevector.jl:1229
Possible fix, define
vcat(::AbstractVector{<:Number}, ::ComponentVector{<:Number})
Stacktrace:
[1] _mapreduce(f::typeof(identity), op::typeof(vcat), ::IndexLinear, A::Vector{Any})
@ Base ./reduce.jl:443
[2] _mapreduce_dim(f::Function, op::Function, ::Base._InitialValue, A::Vector{Any}, ::Colon)
@ Base ./reducedim.jl:365
[3] mapreduce
@ Base ./reducedim.jl:357 [inlined]
[4] reduce(op::Function, A::Vector{Any})
@ Base ./reducedim.jl:406
[5] top-level scope
@ REPL[8]:1 |
the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was looking at a question in Discourse and ran into a MethodError.
Reading the comment in https://github.com/jonniedie/ComponentArrays.jl/blob/v0.15.2/src/array_interface.jl#L34-L35 I guess this may be of interest here. Defining the "possible fix" from the error below fixes it:
It looks like #169 is related, not sure if that also fixes the issue, the branch needs work.
The text was updated successfully, but these errors were encountered: