-
Notifications
You must be signed in to change notification settings - Fork 67
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
sparse_row and SRow accept NCRing instead of Ring #1322
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is some of functionality for SRow
s that expects the coefficient ring to be commutative. These need to be adapted or restricted to elements of subtypes of Ring
.
Some that I found in a quick look:
https://github.com/Lax202/Hecke.jl/blob/41678ac4bc55f85a04da7074cdf93f7849ef6406/src/Sparse/Row.jl#L397-L399
Is scale_row!
, div
, divexact
based on left- or right-multiplication? This should be decided and added to the docstrings. Furthermore, there should be functions for the other case as well.
In particular things like A crucial aspect of modules over non-commutative rings is that one has to be careful about which actions are left and which are right otherwise things don't work out in the end... (@mohamed-barakat is an expert on this, perhaps we can consult with him, too ;-) but in principle I think I know the rules, too) |
I have added left and right actions in scale_row, add_scaled_row and divexact (not div). There are tests for everything except divexact since I am unable to find a non-commutative ring for which divexact_left is implemented. |
|
Someone needs to allow the tests to run :-) |
As said, the tests will fail, so no need to approve anything. I have to reapprove for the next commit anyway. |
I am happy to help, of course :) If you have specific questions please let me know. |
Co-authored-by: Max Horn <[email protected]>
Co-authored-by: Johannes Schmitt <[email protected]>
@Lax202 I just pushed a commit to resolve the conflicts. |
@Lax202 it would be good if you implemented the suggestions from the feedback here or figure out why it can't be done. Feel free to talk to me about details. |
src/Sparse/Row.jl
Outdated
|
||
Returns the (left) product of $b \times a$. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main point of this is that it in fact modifies a
in-place (otherwise you'd just write b*a
or a*b
). The docstring should make this clear.
@@ -572,13 +607,20 @@ function div(A::SRow{T}, b::Integer) where T | |||
return div(A, base_ring(A)(b)) | |||
end | |||
|
|||
function divexact(A::SRow{T}, b::T; check::Bool=true) where T | |||
@doc raw""" | |||
divexact(A::SRow, b::RingElem; check::Bool = true) -> SRow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
divexact(A::SRow, b::RingElem; check::Bool = true) -> SRow | |
divexact(A::SRow, b::RingElem; check::Bool = true) -> SRow |
Could someone (@thofma @joschmitt) please allow the CI tests to run? |
Return the right scaled row $c A$ to $B$ by changing $B$ in place. | ||
""" | ||
|
||
function add_right_scaled_row!(a::SRow{T}, b::SRow{T}, c::T) where T |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of duplicating all this code, you could also use Val
to do something like this:
function add_right_scaled_row!(a::SRow{T}, b::SRow{T}, c::T) where T | |
function add_scaled_row!(a::SRow{T}, b::SRow{T}, c::T, ::Val{left} = Val(true)) where {T, left} |
and then in the critical part you can do
if left
t = mul!(t, c, a.values[i])
else
t = mul!(t, a.values[i], c)
end
But this can also wait for a future cleanup.
Then finally you can do
add_left_scaled_row!(a::SRow{T}, b::SRow{T}, c::T) where T = add_scaled_row!(a,b,c,Val(true))
add_right_scaled_row!(a::SRow{T}, b::SRow{T}, c::T) where T = add_scaled_row!(a,b,c,Val(false))
Again someone needs to allow the CI tests to run, please |
@Lax202 the documentation tests still have some failures you need to address (we discussed these already):
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1322 +/- ##
==========================================
+ Coverage 75.55% 75.62% +0.06%
==========================================
Files 355 357 +2
Lines 113364 113521 +157
==========================================
+ Hits 85655 85852 +197
+ Misses 27709 27669 -40
|
@thofma @joschmitt @fieker can someone please approve the CI runs? @Lax202 just pushed an update which hopefully will address the documenter issue |
This is to be able to create Modules in Oscar over non-commutative rings, as discussed with @HechtiDerLachs and @fieker