Design #1493
Automatic ring mapping in assignment?
Description
We have partly implemented automatic conversion of ring elements (e.g. in multiplication).
Should it also work for assignment? Here is a specific example:
M := mat([[1,x],[0,1]]); // matrix over R M[1,1] := LC(x); // RHS is in CoeffRing(R) -- currently gives MixedRings ERROR
Related issues
History
#1 Updated by John Abbott over 3 years ago
- Related to Feature #7: Automatic mapping between (some) rings added
#2 Updated by John Abbott over 3 years ago
- Description updated (diff)
My "gut feeling" is that it should work... I expect it to work (perhaps because the destination ring is well defined?)
Is there a situation where one could get unexpected behaviour?
#3 Updated by Anna Maria Bigatti over 3 years ago
John Abbott wrote:
My "gut feeling" is that it should work... I expect it to work (perhaps because the destination ring is well defined?)
I agree
Is there a situation where one could get unexpected behaviour?
I cannot think of an unexpected behaviour, but just a remark:
In CoCoALib (not in CoCoA5) the assignment to a RINGELEM changes the RING accordingly to the rhs. Here it looks like it goes with the lhs.
HOWEVER, in CoCoALib the function for M[1,1] := .. is SetEntry(M,1,1,..) and not an assignment.
So both CoCoA5 and CoCoALib are self-consistent.
#4 Updated by John Abbott over 3 years ago
- Status changed from New to Resolved
- Assignee set to John Abbott
- % Done changed from 0 to 70
I have changed the impl of mySetEntry
so that it tries to auto map the ring elem. Some ad hoc tests pass.
I have also changed the CoCoA-5 ctor for a matrix so that it tries to map all elems of the list of lists (list of rows) into the ring with largest RingID
. Again an ad hoc test passed.
Not yet checked in.
Do we need to change doc for this?
#5 Updated by John Abbott over 3 years ago
- Status changed from Resolved to Feedback
- % Done changed from 70 to 90
I have revised the manual entry for matrix
. I did note that in the examples mat
is used rather than matrix
-- is this right?
#6 Updated by Anna Maria Bigatti about 3 years ago
- Status changed from Feedback to Closed
- % Done changed from 90 to 100
John Abbott wrote:
I have revised the manual entry for
matrix
. I did note that in the examplesmat
is used rather thanmatrix
-- is this right?
I admit, I always write mat and I like it.
This assignment works fine on my computer and I close this issue.
#7 Updated by Anna Maria Bigatti 2 months ago
- Related to Feature #645: Automatic mapping of RingElem: user selectable at run-time (GlobalManager?) added