Skip to content

[ITensors] Add a debug check that sets of Index are unique #415

@mtfishman

Description

@mtfishman

Right now, this is allowed, even in debug mode:

julia> i = Index(2)
(dim=2|id=241)

julia> is = IndexSet(i, i)
IndexSet{2} (dim=2|id=241) (dim=2|id=241) 

julia> ENV["JULIA_DEBUG"] = "ITensors"
"ITensors"

julia> is = IndexSet(i, i)
IndexSet{2} (dim=2|id=241) (dim=2|id=241) 

This could be done in the IndexSet constructor, with the Julia function allunique, i.e. just add @debug allunique(data) || error("Indices must all be unique in IndexSet") here.

Metadata

Metadata

Assignees

Labels

error messagesIssues related to improving error messages.indexsetIssues related to IndexSets.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions