Skip to content

[BUG] Array(a::ITensor) is broken #24

@mtfishman

Description

@mtfishman

For example:

julia> Array(randn(Index(2)))
ERROR: MethodError: no method matching Array{Any, Any}(::UndefInitializer, ::NamedDimsArrays.NaiveOrderedSet{Tuple{NamedDimsArrays.NamedInteger{Int64, Index{}}}})
The type `Array{Any, Any}` exists, but no method is defined for this combination of argument types when trying to construct it.

Closest candidates are:
  Array{T, N}(::Missing, ::Any...) where {T, N}
   @ Base baseext.jl:43
  Array{T, N}(::Nothing, ::Any...) where {T, N}
   @ Base baseext.jl:42
  Array{T, N}(::FillArrays.AbstractOnes{V, N}) where {T, V, N}
   @ FillArrays ~/.julia/packages/FillArrays/lVl4c/src/FillArrays.jl:553
  ...

Stacktrace:
 [1] Array{Any, Any}(x::ITensor)
   @ Base ./array.jl:626
 [2] Array(A::ITensor)
   @ Core ./boot.jl:605
 [3] top-level scope
   @ REPL[76]:1
Some type information was truncated. Use `show(err)` to see complete types.

Probably best to fix this in NamedDimsArrays by defining Base.AbstractArray(a::AbstractNamedDimsArray) = AbstractArray{eltype(a),ndims(a)}(a), and then define Base.AbstractArray{T,N}(a::AbstractNamedDimsArray) where {T,N} = AbstractArray{T,N}(dename(a)).

Also broken:

Array{Float64}(randn(Index(2)))
Vector{Float64}(randn(Index(2)))
Vector(randn(Index(2)))

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions