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

Add components method to Abelian group #1632

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

paemurru
Copy link
Contributor

@simonbrandhorst suggested that instead of accessing the property using the dot notation, a proper getter would be useful. I named the method components since this is how it is referred to in the docs.

@thofma
Copy link
Owner

thofma commented Sep 27, 2024

Yes and no, see #1466

@simonbrandhorst
Copy link
Collaborator

I see. Maybe we just make an arbitrary default decision and go for it? Throw a dice?
We can also add
coefficients(::Type{ZZMatrix}, x)
coefficients(::Type{Vector{ZZRingElem}, x)

Copy link

codecov bot commented Sep 27, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 75.82%. Comparing base (a024dc6) to head (7d4737f).

Files with missing lines Patch % Lines
src/GrpAb/Elem.jl 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1632      +/-   ##
==========================================
- Coverage   75.85%   75.82%   -0.04%     
==========================================
  Files         361      361              
  Lines      113702   113704       +2     
==========================================
- Hits        86249    86212      -37     
- Misses      27453    27492      +39     
Files with missing lines Coverage Δ
src/GrpAb/Elem.jl 95.58% <0.00%> (-1.07%) ⬇️

... and 26 files with indirect coverage changes

@fingolfin
Copy link
Contributor

What do you want to do? Knowing your usecase would help decide how to best address this. Maybe a more mathematical interface would be possible.

Note that you already can do x[1] to get the first, second, etc. entry.

If we really want this, we could also allow something like Vector{ZZRingElem}(x) ...

@paemurru
Copy link
Contributor Author

paemurru commented Oct 9, 2024

A toric geometry function outputs an algebra graded by a finitely generated abelian group. I want to make a new algebra with a slightly different grading. Namely, the last "column" replaced by ones.

Ideally I would want to be able to write x[1:end] to get the vector of entries. So I can construct the vector [x[1:end-1]; 1].

@fieker
Copy link
Collaborator

fieker commented Oct 9, 2024 via email

@paemurru
Copy link
Contributor Author

paemurru commented Oct 9, 2024

Is this math - or developing/ testing to get examples.
Math.

I think it would be rather nice if we could write g[1:end] to get the vector of entries, considering g[i] already gives an entry. Is there an easy way to add this functionality?

@simonbrandhorst
Copy link
Collaborator

It is just about the interface. We know how to achieve what we want. But do others know it as well?
I find both of the following not optimal. The first because one has to go back to the parent and the second because it is not using the interface .

julia> A = abelian_group([0,1,2,3]);

julia> x = A[1]
Abelian group element [1, 0, 0, 0]

julia> [x[i] for i in 1:ngens(A)]
4-element Vector{ZZRingElem}:
 1
 0
 0
 0

julia> x.coeff
[1   0   0   0]

@fieker
Copy link
Collaborator

fieker commented Oct 9, 2024 via email

@fieker
Copy link
Collaborator

fieker commented Oct 10, 2024 via email

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

Successfully merging this pull request may close these issues.

5 participants