fix the multiplication by unit in the source thing

This commit is contained in:
Nelynx 2025-03-13 14:32:14 +01:00
parent 09ec067dc0
commit 06957fc5fe

View File

@ -338,6 +338,9 @@ proc GenerateOYModule(matrix GOX, matrix GOY, list #)
// Convert GOY to an O_n - module
int flag_unit = 0;
matrix auxcol;
for (i=1; i<= ny; i++)
{
col = submat(GOY,intvec(1..a),intvec(i)); // Pick the next generator in GOY
@ -347,7 +350,17 @@ proc GenerateOYModule(matrix GOX, matrix GOY, list #)
}
else
{
M = M + MatrixToVector(MalgrFormVect(col)); // Convert to GOX
auxcol = MalgrFormVect(col);
M = M + MatrixToVector(auxcol); // Convert to GOX
if (MalgrFormToOX(auxcol) != col and flag_unit == 0)
{
flag_unit = 1;
}
}
if (flag_unit ==1)
{
print("Warning: a unit has been used for the MalgrForm of the target module. Computations might not be accurate.");
flag_unit = -1;
}
}
@ -364,14 +377,7 @@ proc GenerateOYModule(matrix GOX, matrix GOY, list #)
col = submat(GOX,intvec(1..a),intvec(i)); // Pick the next generator in GOX
for (j=1; j<= m; j++)
{
if (s>0)
{
M = M + MatrixToVector(MalgrFormVect(Gens[j]*col, mappingf^k)); // Compute each product of col times an element of Gens
}
else
{
M = M + MatrixToVector(MalgrFormVect(Gens[j]*col));
}
M = M + MatrixToVector(MalgrFormVect(Gens[j]*col));
}
}
@ -609,9 +615,85 @@ proc MalgrFormVect(matrix v, list #)
# is an optional ideal so that computations are made modulo this ideal.
*/
int i;
int j;
int k;
int s = size(#);
int nGens = size(Gens);
int a = nrows(v);
int i;
ideal K = GF; // Save the GF ideal to a new variable since we are going to possibly modify it.
int maxibound = -1; // Power of max ideal contained in #: it will stay as -1 if # is empty
if (s > 0)
{
K = std(#[1] + GF); // Work modulo an ideal, if requested.
ideal determinacyIdeal = std(#[1]);
maxibound = 1;
while(size(reduce(maxOX^(maxibound),determinacyIdeal)) != 0){
// Compute power of maximal ideal contained in #.
// To Do: Can this be done more efficiently?
maxibound++;
}
}
for (i=dimX+1; i <= size(mappingf); i++)
{
K = K + ideal(X(i) - reduce(mappingf[i], K)); // Assign the components of f which do not give the finite mapping to variables in the target, if p > n.
}
/* Caution: We do not compute again a standard basis of K since this would be equivalent to computing
the polynomial of the image when p > n and this is too computationally expensive. */
module rv;
if (s > 0)
{
option(redSB);
option(redTail);
option(redThrough);
rv = system("reduce_bound", v, K, maxibound);
}
else
{
option(redTail);
option(redThrough);
rv = reduce(v,K); // Obtain Malgrange form as a sum. This should be a polynomial only in X's and
// the elements of Gens in "linear" form
}
poly prod = 1;
for(i=1; i<=size(maxOX); i++){
prod = prod * maxOX[i];
}
matrix malgrv[a][nGens];
matrix cofv;
//rv;//
for(i=1; i<= a; i++)
{
cofv = coef(rv[1][i],prod);
//cofv;//
for(j=1; j<=nGens; j++)
{
for(k=1;k<=ncols(cofv);k++)
{
if(Gens[j] == cofv[1,k]){
malgrv[i,j] = cofv[2,k];
}
}
}
}
return(malgrv);
/* -------- OLD ---------
def m = MalgrFormPoly(v[1,1], #); // We need to manually compute the first component outside of the loop
// so that the first row of the matrix already has the correct information
@ -623,8 +705,11 @@ proc MalgrFormVect(matrix v, list #)
}
return(m);
*/
}
//////////////////////////////////////////////////////////////////////////////
proc MatrixToVector(matrix M)