Skip to content

Ordering of output of external_indices #446

@obackhouse

Description

@obackhouse

Can I ask for clarification on the grouping in external_indices? The nested vector is constructed as

for (std::size_t i = 0; i < groups.ket.size(); ++i) {
cont.at(i).push_back(groups.ket[i]);
}
for (std::size_t i = 0; i < groups.bra.size(); ++i) {
cont.at(i).push_back(groups.bra[i]);
}
for (std::size_t i = 0; i < groups.aux.size(); ++i) {
cont.at(i).push_back(groups.aux[i]);
}

Is there a reason this is not

for (std::size_t i = 0; i < groups.ket.size(); ++i) { 
  cont.at(0).push_back(groups.ket[i]); 
} 
for (std::size_t i = 0; i < groups.bra.size(); ++i) { 
  cont.at(1).push_back(groups.bra[i]); 
} 
for (std::size_t i = 0; i < groups.aux.size(); ++i) { 
   cont.at(2).push_back(groups.aux[i]); 
}

This would return [[bra0, bra1, ...], [ket0, ket1, ...], [aux0, aux1, ...]] rather than [[bra0, ket0, aux0], [bra1, ket1, aux1], ...]. The former implicitly carries the bra/ket/aux ranks, whereas the latter does not, which makes it difficult to construct an appropriate output tensor when the ranks are not equal.

EDIT: Just noticed it's also ket, bra, aux rather than bra, ket, aux too?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions