-
Notifications
You must be signed in to change notification settings - Fork 72
WIP: rewrite MatRing to wrap a native matrix #2207
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
base: master
Are you sure you want to change the base?
Conversation
|
Comment/Question about matrix multiplication (and probably other binary operators): the current proposal is for a function |
|
I think the mixed-type cases must be removed. So if we still need this, it should be |
Sorry, it was my misreading/misremembering of the code. Anyway, the only cases of interest are the two "homogeneous" cases. Thanks for the feedback! I'll deal with it tomorrow. Then the "real" function takes two |
|
Yes, sounds good. I think |
| # | ||
| ############################################################################### | ||
|
|
||
| function *(x::MatRingElem{T}, y::MatRingElem{T}) where {T <: NCRingElement} |
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.
@JohnAAbbott to partially answer your question: this function is removed in this PR
| end | ||
|
|
||
| function *(x::MatElem{T}, y::MatElem{T}) where {T <: NCRingElement} | ||
| function *(x::T, y::T) where {T <: MatrixElem} |
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.
@JohnAAbbott ... while this was restricted to the "both arguments have the same type.
But yeah it really should be
| function *(x::T, y::T) where {T <: MatrixElem} | |
| function *(x::T, y::T) where {T <: MatElem} |
and then there should be MatRingElem methods for *, +, - etc. which delegate to the the underlying "plain" matrix.
I.e., also the existing changes in this PR in lines 826 and 837 of this file need to be furhter modified.
| struct MatRingElem{T <: NCRingElement} <: AbstractAlgebra.MatRingElem{T} | ||
| base_ring::NCRing | ||
| entries::Matrix{T} | ||
| data::MatElem{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.
An access for this could be matrix(m::MatRingElem) = m.data
That would be consisting for the existing matrix(x::MatrixGroupElem) method in OSCAR which also works like that.
|
I'm making progress, and thanks to @fieker have fixed one "type instability" problem -- the code is/was type-stable but Julia was not able to recognise this, so needed an explicit helping hand. |
|
What matrix operations do we want to perform on which fails because So the types almost match... |
|
Here are some functions for Do we want an "Array interface" for These function would allow a mixture of There are very many more in The following will give an error if the matrix has 0 rows or 0 columns; intentional? |
|
It is a significant hindrance that the tests call several of the above "questionable" functions. I prefer not to "push" while I know that several tests do not pass... The current blocking case is |
|
Another oddity: we have the names |
|
What is the utility of the file The first comment states: Surely the OSCAR specific matrix types will handle matrices of OSCAR values better than Julia's native matrices, no? In In |
It does not for me.
No, not in all cases. It depends on what "handle" means. A few algorithms are much faster with plain julia matrices if one uses them as plain two-dimensional arrays without any "matrix functionality". (IMHO they should not have been called "Matrix" in the first place.)
Have you checked the git history? Someone must have added it and the reason might be given in the commit message. But also I am not sure how relevant this is for this PR here? P.S.: When you used |
|
Which of the questions you asked (concerning the PR here) are still open? It seems there were some offline discussions, which might have answered some (all?) of those questions? |
Sorry wrong file path: it should have been |
|
This has conflicts with master. To repeat what I said earlier but in writing: I strongly recommend to suppress the urge to complicate this with removal of functionality (which is a breaking change). At least minimize such changes |
This is code trying to address issue #1955 which I wrote last December but never finished.
@JohnAAbbott I am putting it here because it might be useful for you, e.g. you could use it as a basis and complete it (feel free to work on this PR, or copy it to a new one). Or perhaps you prefer to start from scratch, but then it might still be helpful to check what I've done here.
This is incomplete in that I am sure tests will fail and things are missing. A lot of code which is currently defined for
MatrixElemmay have to be changed (but it may also be possible to delay that for the time being -- e.g. changingdetto delegate todetof the wrapped matrix is strictly speaking an optimization?)