M2 icon indicating copy to clipboard operation
M2 copied to clipboard

RingMap MutableMatrix is broken

Open mahrud opened this issue 3 years ago • 4 comments

Here's an experiment on 1.21:

i1 : C = toField(QQ[i]/(i^2+1))

o1 = C

o1 : PolynomialRing

i2 : R = C[x]

o2 = R

o2 : PolynomialRing

So far so good. The first curious thing is the presentation of this map. What is {-1, i} doing here?

i3 : f = map(R, R, {i^2})

o3 = map (R, R, {-1, i})

o3 : RingMap R <--- R

i4 : f x

o4 = -1

o4 : R

i5 : f matrix{{x}}

o5 = | -1 |

             1       1
o5 : Matrix R  <--- R

And now we get to the bug:

i6 : f mutableMatrix{{x}}

o6 = 0

o6 : MutableMatrix

flattenRing R returns itself, so there's not much to do there.

mahrud avatar Jan 09 '23 05:01 mahrud

Wait, it gets worse, it's even broken over CC:

i1 : R = CC[x]

o1 = R

o1 : PolynomialRing

i2 : f = map(R, R, {ii^2})

o2 = map (R, R, {-1})

o2 : RingMap R <--- R

i3 : f x

o3 = -1

o3 : R

i4 : f matrix{{x}}

o4 = | -1 |

             1       1
o4 : Matrix R  <--- R

i5 : f mutableMatrix{{x}}

o5 = 0

o5 : MutableMatrix

At least the presentation of the ring map seems normal.

mahrud avatar Jan 09 '23 05:01 mahrud

Okay seems like just ring maps are broken for mutable matrices altogether:

i1 : R = ZZ/11[x]

o1 = R

o1 : PolynomialRing

i2 : f = map(R, R)

o2 = map (R, R, {x})

o2 : RingMap R <--- R

i3 : f mutableMatrix{{x}}

o3 = 0

o3 : MutableMatrix

mahrud avatar Jan 09 '23 05:01 mahrud

a lot of code is broken with mutable matrices, cf #2192

pzinn avatar Jan 09 '23 05:01 pzinn

... or this:

i1 : m=mutableMatrix(RR,1,1)

o1 = | 0 |

o1 : MutableMatrix

i2 : m^-1

o2 = | 0 |

o2 : MutableMatrix

i3 : m=mutableMatrix(RR,0,0)

o3 = 0

o3 : MutableMatrix

i4 : m^-1
 ** On entry to DGETRF parameter number  4 had an illegal value
stdio:4:1:(3): error: argument passed to dgetrf had an illegal value

pzinn avatar Aug 21 '23 10:08 pzinn