From 76560352f84809e0df2bea46e8bd261adad532ac Mon Sep 17 00:00:00 2001 From: felixlotter Date: Mon, 16 Dec 2024 18:40:33 +0100 Subject: [PATCH] proposed fix for #3601 --- M2/Macaulay2/packages/gfanInterface.m2 | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/M2/Macaulay2/packages/gfanInterface.m2 b/M2/Macaulay2/packages/gfanInterface.m2 index d94d4e1fd2..338a819e90 100644 --- a/M2/Macaulay2/packages/gfanInterface.m2 +++ b/M2/Macaulay2/packages/gfanInterface.m2 @@ -751,14 +751,15 @@ gfanConvertToNewRing (PolynomialRing) := R1 -> ( --This method does all of the actual conversions. --Every other gfanConvertToNewRing uses rings --produced by this method. - R1Gens := gens R1; - numDigits := length (toString (#R1Gens)); - R2 := (coefficientRing R1) new Array from (for i in 1..#R1Gens list ( - value ("x" | demark ("",for i from 1 to numDigits-(length toString i) list "0") | toString i) - ) ); - R2Gens := gens R2; - generatorMapping := for i in 0..#(gens R1) - 1 list (R1Gens#i =>R2Gens#i); - return (map(R2, R1, generatorMapping), R2); + R1Gens := gens R1; + numDigits := length (toString (#R1Gens)); + varstr := (for i in 1..#R1Gens list "x" | demark ("",for j from 1 to numDigits-(length toString i) list "0") | toString i); + var := new Dictionary; + varlist = for i in varstr list getGlobalSymbol(var,i); + R2 := (coefficientRing R1) new Array from varlist; + R2Gens := gens R2; + generatorMapping := for i in 0..#(gens R1) - 1 list (R1Gens#i =>R2Gens#i); + return (map(R2, R1, generatorMapping), R2); ) gfanConvertToNewRing (RingElement) := f -> (