Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy species #38544

Draft
wants to merge 138 commits into
base: develop
Choose a base branch
from
Draft

Lazy species #38544

wants to merge 138 commits into from

Conversation

mantepse
Copy link
Collaborator

We provide an implementation of combinatorial species based on the lazy series framework and #38446.

Newtech66 and others added 30 commits May 12, 2024 19:59
…groups

Also added various miscellaneous functions
Co-authored-by: Martin Rubey <axiomize@yahoo.de>
Also some fixes to _element_constructor_ ConjugacyClassesOfSubgroups
Added _repr_ for ConjugacyClassesOfSubgroups
I now output B[(gens or name if available)] as _repr_ for generators, for example B[1] + 2*B[(2,3,4)]
Comment on lines 148 to 154
def add_structures(labels):
yield from self.structures(labels)
yield from other.structures(labels)

result = super()._add_(other)
result.structures = add_structures
return result
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tscrim, I'm not sure whether this is the best way to do it. I tried to create a separate class SumSpeciesElement inheriting from LazySpeciesElement that only overrides the method structures (and will override generating_series, etc.), but got stuck.

I think I would like to turn the result of super()._add_(other) into a SumSpeciesElement instance.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One other thing: I am not sure, but perhaps it would actually be nice to take some decisions of LazyModuleElement._add_ into account. For example, if one of the arguments is zero, I might not want to return a SumSpeciesElement, but rather the other summand.

However, this smells badly like duplicating a lot of code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rethinking this: I guess it happens next to never that we are in one of the cases treated specially by LazyModuleElement._add_ (or _mul_, etc.) So maybe my afterthought is thinking about the empty set.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the following look correct to you? At least it works. I admit that the arguments super requires are not super-clear to me.

class LazySpeciesElement(LazyCompletionGradedAlgebraElement):
...
    def _add_(self, other):
        return SumSpeciesElement(self, other)
...
class SumSpeciesElement(LazySpeciesElement):
    def __init__(self, left, right):
        self._left = left
        self._right = right
        coeff_stream = super(LazySpeciesElement, type(left))._add_(left, right)._coeff_stream
        super().__init__(self.parent(), coeff_stream)

    def structures(self, labels):
        yield from self._left.structures(labels)
        yield from self._right.structures(labels)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: combinatorics gsoc: 2024 Tag for GSoC2024 issues/PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants