Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ITensorBase"
uuid = "4795dd04-0d67-49bb-8f44-b89c448a1dc7"
version = "0.16.3"
version = "0.16.4"
authors = ["ITensor developers <support@itensor.org> and contributors"]

[workspace]
Expand Down
6 changes: 5 additions & 1 deletion src/abstractnamedtensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,12 @@ Base.Array{<:Any, N}(a::AbstractNamedTensor) where {N} = Array{eltype(a), N}(a)
# Read the parent's axes through TensorAlgebra's interface (not `Base.axes`) so a non-array
# backend like a TensorMap, whose axes are its native spaces, is supported.
function Base.axes(a::AbstractNamedTensor)
return NamedUnitRange.(TensorAlgebra.axes(unnamed(a)), Tuple(names(a)))
return namedaxes(TensorAlgebra.axes(unnamed(a)), names(a))
end
# A function barrier: an `ITensor`'s parent is untyped, so its axes are only known at runtime.
# The names are indexed by position rather than converted with `Tuple`, since they may be stored
# in a `Vector` whose length is unknown to the compiler.
namedaxes(axs::Tuple, ns) = ntuple(i -> NamedUnitRange(axs[i], ns[i]), Val(length(axs)))
function Base.size(a::AbstractNamedTensor)
return length.(axes(a))
end
Expand Down
Loading