912{
913
914
915
916
918 rG = rGR;
919
923
924#if ((defined(PDEBUG) && OUTPUT) || MYTEST)
925 PrintS(
"sca_SetupQuotient(rGR, rG, bCopy)");
926
927 {
931 }
932#endif
933
934
935 if(bCopy)
936 {
937 if(
rIsSCA(rG) && (rG != rGR))
939 else
940 return false;
941 }
942
944
946
947
948
949
950#if OUTPUT
951 PrintS(
"sca_SetupQuotient: qring?\n");
952#endif
953
954 if(rGR->qideal ==
NULL)
955 return false;
956
957#if OUTPUT
958 PrintS(
"sca_SetupQuotient: qideal!!!\n");
959#endif
960
961
962
963
964
965 int iAltVarEnd = -1;
966 int iAltVarStart =
N+1;
967
969 const ring rBase = rG;
972
973#if OUTPUT
974 PrintS(
"sca_SetupQuotient: AltVars?!\n");
975#endif
976
977 for(
int i = 1;
i <
N;
i++)
978 {
979 for(
int j =
i + 1;
j <=
N;
j++)
980 {
982 {
983#if ((defined(PDEBUG) && OUTPUT) || MYTEST)
984 Print(
"Nonzero D[%d, %d]\n",
i,
j);
985#endif
986 return false;
987 }
988
989
992
994 {
995 if(
i < iAltVarStart)
997
1000 } else
1001 {
1003 {
1004#if ((defined(PDEBUG) && OUTPUT) || MYTEST)
1005 Print(
"Wrong Coeff at: [%d, %d]\n",
i,
j);
1006#endif
1007 return false;
1008 }
1009 }
1010 }
1011 }
1012
1013#if ((defined(PDEBUG) && OUTPUT) || MYTEST)
1014 Print(
"AltVars?1: [%d, %d]\n", iAltVarStart, iAltVarEnd);
1015#endif
1016
1017
1018 if((iAltVarEnd == -1) || (iAltVarStart == (
N+1)))
1019 {
1020 if (
N>1)
return false;
1021 iAltVarEnd=iAltVarStart=1;
1022 }
1023
1024 for(
int i = 1;
i <
N;
i++)
1025 {
1026 for(
int j =
i + 1;
j <=
N;
j++)
1027 {
1030
1031 if( (iAltVarStart <=
i) && (
j <= iAltVarEnd) )
1032 {
1034 {
1035#if ((defined(PDEBUG) && OUTPUT) || MYTEST)
1036 Print(
"Wrong Coeff at: [%d, %d]\n",
i,
j);
1037#endif
1038 return false;
1039 }
1040 }
1041 else
1042 {
1044 {
1045#if ((defined(PDEBUG) && OUTPUT) || MYTEST)
1046 Print(
"Wrong Coeff at: [%d, %d]\n",
i,
j);
1047#endif
1048 return false;
1049 }
1050 }
1051 }
1052 }
1053
1054#if ((defined(PDEBUG) && OUTPUT) || MYTEST)
1055 Print(
"AltVars!?: [%d, %d]\n", iAltVarStart, iAltVarEnd);
1056#endif
1057
1058 assume( 1 <= iAltVarStart );
1059 assume( iAltVarStart <= iAltVarEnd );
1061
1062
1063
1064
1065
1068
1069
1070 const ideal idQuotient = rGR->qideal;
1071
1072
1073#if ((defined(PDEBUG) && OUTPUT) || MYTEST)
1074 PrintS(
"Analyzing quotient ideal:\n");
1076#endif
1077
1078
1079
1080
1081
1082
1084 int e = -1;
1085
1087 {
1090
1091#if ((defined(PDEBUG) && OUTPUT) || MYTEST)
1092 Print(
"AltVars!?: [%d, %d]\n",
b, e);
1093#endif
1094 }
1095
1096 for (
int i = iAltVarStart; (
i <= iAltVarEnd);
i++ )
1097 if( (
i <
b) || (
i > e) )
1098 {
1099 poly square =
p_One( rG);
1102
1103
1104
1105 square =
nc_NF(idQuotient,
NULL, square, 0, 1, rG);
1106
1107 if( square !=
NULL )
1108 {
1110 return false;
1111 }
1112 }
1113
1114#if ((defined(PDEBUG) && OUTPUT) || MYTEST)
1115 Print(
"ScaVars!: [%d, %d]\n", iAltVarStart, iAltVarEnd);
1116#endif
1117
1118
1119
1120
1121
1122 ideal tempQ =
id_KillSquares(idQuotient, iAltVarStart, iAltVarEnd, rG);
1123
1124
1125#if ((defined(PDEBUG) && OUTPUT) || MYTEST)
1128 PrintS(
"tempSCAQuotient: \n");
1130#endif
1131
1133
1135
1138
1140 rGR->GetNC()->SCAQuotient() =
NULL;
1141 else
1142 rGR->GetNC()->SCAQuotient() =
idrMoveR(tempQ, rG, rGR);
1143
1145
1146
1147#if ((defined(PDEBUG) && OUTPUT) || MYTEST)
1148 PrintS(
"SCAQuotient: \n");
1151 else
1153#endif
1154
1155 return true;
1156}
static int si_max(const int a, const int b)
static int si_min(const int a, const int b)
static FORCE_INLINE BOOLEAN n_IsMOne(number n, const coeffs r)
TRUE iff 'n' represents the additive inverse of the one element, i.e. -1.
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
bool sca_Force(ring rGR, int b, int e)
void iiWriteMatrix(matrix im, const char *n, int dim, const ring r, int spaces)
set spaces to zero by default
#define MATELEM(mat, i, j)
1-based access to matrix
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
void rWrite(ring r, BOOLEAN details)