Skip to content

[BUG] DiagonalArrays.diagview(a::ITensor) broken #21

Open
@mtfishman

Description

@mtfishman
julia> using ITensorBase: Index

julia> using DiagonalArrays: diagview

julia> i, j = Index.((2, 2))
(Index(length=2|id=104), Index(length=2|id=166))

julia> a = randn(i, j)
named(2, Index(length=2|id=104))×named(2, Index(length=2|id=166)) ITensor with indices named(Base.OneTo(2), Index(length=2|id=104))×named(Base.OneTo(2), Index(length=2|id=166))
2×2 Matrix{Float64}:
  1.44795  0.55187
 -2.36249  0.553122

julia> diagview(a)
ERROR: MethodError: no method matching LinearIndices(::NamedDimsArrays.NaiveOrderedSet{Tuple{NamedDimsArrays.NamedUnitRange{…}, NamedDimsArrays.NamedUnitRange{…}}})
The type `LinearIndices` exists, but no method is defined for this combination of argument types when trying to construct it.

Closest candidates are:
  LinearIndices(::Tuple{})
   @ Base indices.jl:489
  LinearIndices(::Base.Broadcast.Broadcasted{<:Any, <:Tuple{Any}})
   @ Base broadcast.jl:257
  LinearIndices(::CartesianIndices{N, R}) where {N, R<:NTuple{N, AbstractUnitRange}}
   @ Base multidimensional.jl:581
  ...

Stacktrace:
 [1] LinearIndices(A::ITensor)
   @ Base ./indices.jl:494
 [2] diagindices(::IndexLinear, a::ITensor)
   @ DiagonalArrays ~/.julia/packages/DiagonalArrays/Nf92r/src/diaginterface/diaginterface.jl:53
 [3] diagindices(a::ITensor)
   @ DiagonalArrays ~/.julia/packages/DiagonalArrays/Nf92r/src/diaginterface/diaginterface.jl:50
 [4] diagview(a::ITensor)
   @ DiagonalArrays ~/.julia/packages/DiagonalArrays/Nf92r/src/diaginterface/diaginterface.jl:69
 [5] top-level scope
   @ REPL[11]:1
Some type information was truncated. Use `show(err)` to see complete types.

Probably this issue originates in NamedDimsArrays.jl and/or DiagonalArrays.jl and if so should be fixed there.

Metadata

Metadata

Assignees

No one assigned

    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