Skip to content

[ITensors] Better prime and tag defaults for polar and qr #525

Open
@mtfishman

Description

@mtfishman

The functions polar and qr don't have great tag and prime defaults, for example:

l = Index(3, "l")
s = Index(2, "s")
A = randomITensor(l', s, l)


Q, R = qr(A, (l', s))
@show inds(Q)
@show inds(R)

gives:

inds(Q) = IndexSet{3} (dim=3|id=902|"l")' (dim=2|id=226|"s") (dim=3|id=728|"Link,qr")
inds(R) = IndexSet{2} (dim=3|id=728|"Link,qr") (dim=3|id=902|"l")

and

U, P = polar(A, (l', s))
@show inds(U)
@show inds(P)

gives:

inds(U) = IndexSet{3} (dim=3|id=902|"l")' (dim=2|id=226|"s") (dim=3|id=902|"l")' 
inds(P) = IndexSet{2} (dim=3|id=902|"l")' (dim=3|id=902|"l") 

For polar, the tricky part is that the new Index must be made so that it doesn't clash with any of the existing indices. However, in general it has the same space as the right set of indices, so right now it is set to have the same ID. It may be too difficult in general to ensure it has a unique set of indices, so it may be best to give it a unique ID (we could give it a special set of tags, but I am hesitant to do that since if you add on tags, an index may run out of tag slots).

Metadata

Metadata

Assignees

Labels

apiIssues related to the interfacebreakingThis would require a breaking changebugSomething isn't workingdecompositionsIssues related to tensor decompositions.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions