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.
This is the beginning of some more code sharing for the sector definitions. (very much WIP)
I feel lilke there are many things to discuss here and some opinionated changes, so let me try and outline some of my thoughts here.
As we discussed, we can try and keep the types here, but that leads to a very big chunk of duplicated code, and conversions back and forth. To be honest, in that case it does not really seem worth it to reimplement everything by sending it to TensorKitSectors, since it takes more work to convert than it does to implement the minimal set of functions.
One different option might be to instead use:
const AbstractSector = TensorKitSectors.Sector
. As outlined in thetensorkitsector.jl
file, it is relatively straightforward to forward the required methods for any<: TensorKitSectors.Sector
, and this change would avoid having to rewrap them. Basically, this would simply make allSector
types available to be used inGradedArrays
(and vice versa)If we go on with that change, we might re-evaluate which types to keep, and which ones to simply adopt.
For example, the data representation of
O2
differs slightly from theCU1Irrep
, even though they represent the same group.Here it makes sense to define
struct O2 <: Sector
to follow the conventions defined here, which would then also make that available toTensorKit
.Conversely, the
Z{N}
types are virtually equal, so we might decide to useconst Z{N} = ZNIrrep{N}
instead.I wouldn't really have any strong opinions about that, since they could still be used interchangably since they have the same abstract supertype.
In the long run, this seems like a very nice convenience feature, since this would allow conversion between the different array types, which might be useful for testing, comparing, and interoperability.
Before I go in and do so, I wanted to see how you all feel about this though.
Concretely and long story short: I would suggest adopting the abstract type from
TensorKitSectors
and building on top of that, such that effectively sectors can be shared between the two, in two directions.