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.5.19"
version = "0.5.20"
authors = ["ITensor developers <support@itensor.org> and contributors"]

[workspace]
Expand Down
3 changes: 2 additions & 1 deletion src/abstractitensor.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using NamedDimsArrays: NamedDimsArrays, AbstractNamedDimsArray, LittleSet, NamedDimsArray,
denamed, dimnames, inds, mapinds
denamed, dimnames, dimnametype, inds, mapinds

abstract type AbstractITensor <: AbstractNamedDimsArray{Any, Any} end

NamedDimsArrays.nameddimsconstructor(::Type{<:IndexName}) = ITensor
NamedDimsArrays.dimnametype(::Type{<:AbstractITensor}) = IndexName

Base.ndims(::Type{<:AbstractITensor}) = Any

Expand Down
10 changes: 9 additions & 1 deletion test/test_basics.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using ITensorBase: ITensorBase, ITensor, Index, IndexName, gettag, hastag, plev, prime,
setplev, settag, tags, unsettag
using LinearAlgebra: factorize
using NamedDimsArrays: dename, denamed, inds, mapinds, name, named
using NamedDimsArrays: dename, denamed, dimnametype, inds, mapinds, name, named
using Test: @test, @test_broken, @test_throws, @testset

const elts = (Float32, Float64, Complex{Float32}, Complex{Float64})
Expand Down Expand Up @@ -108,6 +108,14 @@ const elts = (Float32, Float64, Complex{Float32}, Complex{Float64})
@test denamed(a) == dename(b, (i, j, k))
@test denamed(a) == permutedims(denamed(b), (2, 3, 1))
end
@testset "dimnametype" begin
i, j = Index.((2, 3))
a = randn(Float64, i, j)
@test a isa ITensor
@test dimnametype(a) === IndexName
@test dimnametype(typeof(a)) === IndexName
@test dimnametype(ITensor) === IndexName
end
@testset "show" begin
id = rand(UInt64)
i = Index(2; id)
Expand Down
Loading