Skip to content

convert between two implementations of fin-dim algebras #39970

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

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

darijgr
Copy link
Contributor

@darijgr darijgr commented Apr 19, 2025

This provides functionality for converting between two implementations of finite-dimensional algebras:

  • the modern one, implemented as MagmaticAlgebras.WithBasis.FiniteDimensional in sage.categories.magmatic_algebras (in the magmatic case) and as FiniteDimensionalAlgebrasWithBasis in sage.categories.finite_dimensional_algebras_with_basis (in the assocative case), and
  • the old one, implemented as FiniteDimensionalAlgebra in sage.algebras.finite_dimensional_algebras.finite_dimensional_algebra. To be more precise, the latter now automatically inherits from the former if the optional parameters assume_associative and assume_unital are set to True, whereas the former can be converted into the latter via the to_fda method.
    This way, the methods of one (e.g. center_basis on the modern one or is_unitary on the old one) can be used on the other.

I hope they actually work, though -- hard to tell without having a contract for the modern class...

Copy link

github-actions bot commented Apr 19, 2025

Documentation preview for this PR (built with commit 2f11478; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

This provides functionality for converting between two implementations of
finite-dimensional algebras:
- the modern one, implemented as MagmaticAlgebras.WithBasis.FiniteDimensional in
  sage.categories.magmatic_algebras (in the magmatic case) and as
  FiniteDimensionalAlgebrasWithBasis in
  sage.categories.finite_dimensional_algebras_with_basis
  (in the assocative case),
and
- the old one, implemented as FiniteDimensionalAlgebra in
  sage.algebras.finite_dimensional_algebras.finite_dimensional_algebra.
To be more precise, the latter now automatically inherits from the
former if the optional parameters assume_associative and
assume_unital are set to True, whereas the former can be
converted into the latter via the to_finite_dimensional_algebra method.
This way, the methods of one (e.g. ``center_basis`` on the modern
one or ``is_unitary`` on the old one) can be used on the other.

Fixing various other issues in both classes as well.
@tscrim
Copy link
Collaborator

tscrim commented Apr 21, 2025

I made a few changes:

  1. The monomial coefficients put everything in the dict, including things that were unsupported (i,e., coefficient of 0).
  2. The hash was not working with @cached_method since that needs to be able to add to the __dict__, but since this is a Cython class, it does not have that by default. However, the "matrix" that is _vector caches the hash, so I just used that.
  3. Since this is a Cython class, I made monomial_coefficients() a cpdef class.

Since I made these online, I didn't check that they actually worked; will wait for the bots.

@darijgr
Copy link
Contributor Author

darijgr commented Apr 22, 2025

Good edits, Travis!

Copy link
Collaborator

@tscrim tscrim left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants