-
Notifications
You must be signed in to change notification settings - Fork 130
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
In *(scalar,Matrix)
, try promoting matrix in case promoting scalar fails
#3186
Comments
Btw., promotion of matrices works great in matrix addition (and multiplication). Oscar has no problems adding two matrices of different types as long as one can be promoted to the type of the other:
|
Usually we do not do automatic promotion, where the parent of the result has to be constructed (like scalar times polynomial), but we should make an (additional) exception for matrices here. |
So on a tangent, I am not sure we can always do automatic conversion in this cases. To boot with, what is the definition of "a scalar" ? An element of a ring? So what if R is a matrix algebra, and I look at a matrix M over R (so a matrix whose entries are matrices) and I multiply M by a scalar |
I am inclined to allow this fancy stuff only for matrices constructed via |
I think I understand @thofma comment about not automatically creating a parent -- in the example here the parent would presumably be |
A quick first suggestion how to deal with
Here,
|
We discussed in triage today, and on that occasion there was no objection to this proposal by @thofma . So maybe this is the way forward with this. |
This is similar to #2536 which was closed without changing anything. |
The rules we propose already exist for matrix-vector operations:
I opened Nemocas/AbstractAlgebra.jl#1949 to add also the matrix-scalar rules we agreed on here. |
Currently, multiplying a matrix by a scalar of different type only works if the scalar can be promoted to the type of the matrix:
It would be nice if - in case the scalar cannot be promoted - OSCAR tries promoting the matrix instead, so that the following multiplication returns a matrix over
R
:Now that broadcasting works for OSCAR matrices, can we achieve this by simply redefining
A*s
asmatrix(...,A.*s)
?The text was updated successfully, but these errors were encountered: