Fix Base.similar
for physical and contractible network types
#149
+31
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The (untested) current implementations of
Base.similar
for our different network types was broken, leading to anUndefRefError
in the checks on the virtual spaces in the inner constructor because all of theunitcell
entries areundef
. I patched it to really mapsimilar
over the unit cell entries, which I think is more in line with what we want here (e.g. to change the storage type of the entries insimilar(::TensorMap, ...)
style).For context, I encountered this when calling
similar
on anInfinitePEPS
, where I really expected the result to have the same virtual space structure. Alternatively, it's not clear that this is the proper way of implementingBase.similar
and since this was never used or tested, I could also useBase.copy
and just remove the brokenBase.similar
implementations.Either way, I didn't want to leave in the broken implementations.