Skip to content
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

AbstractArray(A) throw method error while AbstractArray{Float64}(A) does not. #26177

Open
dlfivefifty opened this issue Feb 23, 2018 · 1 comment
Labels
domain:arrays [a, r, r, a, y, s]

Comments

@dlfivefifty
Copy link
Contributor

The following seems inconsistent to me:

julia> A = rand(5,5)
5×5 Array{Float64,2}:
 0.302006   0.855053  0.661854   0.756174  0.163208
 0.954073   0.919937  0.499419   0.766859  0.69692 
 0.651032   0.18593   0.071093   0.144807  0.100126
 0.0723692  0.710081  0.0466832  0.864155  0.101641
 0.764091   0.134407  0.636173   0.121791  0.211467

julia> AbstractArray{Float64}(A)
5×5 Array{Float64,2}:
 0.302006   0.855053  0.661854   0.756174  0.163208
 0.954073   0.919937  0.499419   0.766859  0.69692 
 0.651032   0.18593   0.071093   0.144807  0.100126
 0.0723692  0.710081  0.0466832  0.864155  0.101641
 0.764091   0.134407  0.636173   0.121791  0.211467

julia> AbstractArray(A)
ERROR: MethodError: no method matching AbstractArray(::Array{Float64,2})
Closest candidates are:
  AbstractArray(::Any) where T<:AbstractArray at abstractarray.jl:21
  AbstractArray(::Union{QR, LinearAlgebra.QRCompactWY}) at /Users/solver/Projects/julia7/usr/share/julia/site/v0.7/LinearAlgebra/src/qr.jl:414
  AbstractArray(::QRPivoted) at /Users/solver/Projects/julia7/usr/share/julia/site/v0.7/LinearAlgebra/src/qr.jl:421
  ...
Stacktrace:
 [1] AbstractArray(::Array{Float64,2}) at ./abstractarray.jl:21
 [2] top-level scope
@nalimilan
Copy link
Member

Sounds like a good idea in the perspective of supporting Vector(x) and AbstractVector(x) as alternatives/replacements to collect, see #16029 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:arrays [a, r, r, a, y, s]
Projects
None yet
Development

No branches or pull requests

3 participants