-
Notifications
You must be signed in to change notification settings - Fork 65
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
Conversation
Yes and no, see #1466 |
I see. Maybe we just make an arbitrary default decision and go for it? Throw a dice? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1632 +/- ##
==========================================
- Coverage 75.85% 75.80% -0.06%
==========================================
Files 361 361
Lines 113702 113695 -7
==========================================
- Hits 86249 86184 -65
- Misses 27453 27511 +58
|
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 If we really want this, we could also allow something like |
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 |
On Wed, Oct 09, 2024 at 05:05:18AM -0700, Erik Paemurru wrote:
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]`.
Is this math - or developing/ testing to get examples.
In the current world you "could" do
n = ngens(parent(x))
x - (x[n] + 1)*parent(x)[n]
to achieve that
… --
Reply to this email directly or view it on GitHub:
#1632 (comment)
You are receiving this because you are subscribed to this thread.
Message ID: ***@***.***>
|
I think it would be rather nice if we could write |
It is just about the interface. We know how to achieve what we want. But do others know it as well?
|
On Wed, Oct 09, 2024 at 07:15:12AM -0700, Erik Paemurru wrote:
> 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?
well... yes no... it means adding getindex(GrpAbFinGenElem, ???)
where ??? needs thought.
- internally, at this point, the elems are using ZZMatrix hence
converting to a vector is bad (memory wise)
This is mostly more efficient that Vector{ZZRingElem}
- Tommy wants to move towards Vector{ZZRingElem} - which has other
problems
- looking at most usage patterns, one would like a nice name and decent
version of
vcat([x.coeff for x in L]...) or similar to get the coeffs into a
matrix.
Possibly paired by a way of converting a matrix into a lost of group
elems
- not completely convinced that, apart from nice, there is a strong use
case for any of that - that justifies the work...
… --
Reply to this email directly or view it on GitHub:
#1632 (comment)
You are receiving this because you commented.
Message ID: ***@***.***>
|
On Wed, Oct 09, 2024 at 07:25:53AM -0700, Simon Brandhorst wrote:
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]
```
I spend time thinking about it... and I think it is really important to
get down to the math. In general, there will be no element in the group
with some specific component set to 1. It might work here due to free
(and in particular torsion free) groups in optimal presentation.
However, in general
G([0,0,1])[3] != 1
is expected:
julia> A = abelian_group([0 0; 0 1])
Finitely generated abelian group
with 2 generators and 2 relations and relation matrix
[0 0]
[0 1]
julia> A([0,1])
Abelian group element [0, 0]
…
--
Reply to this email directly or view it on GitHub:
#1632 (comment)
You are receiving this because you commented.
Message ID: ***@***.***>
|
I can see your point. As a mathematician I would do the following:
Now the goal is to express
And now I would wonder, how I get the coefficients
|
To be able to call `x[begin:end]`.
Added
with a note that it is inefficient. Now the function |
Co-authored-by: Tommy Hofmann <[email protected]>
@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.