MCPcopy Create free account
hub / github.com/Singular/Singular / FindUnivariatePolys

Function FindUnivariatePolys

kernel/fglm/fglmzero.cc:1117–1189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1115//<-
1116
1117static ideal
1118FindUnivariatePolys( const idealFunctionals & l )
1119{
1120 fglmVector v;
1121 fglmVector p;
1122 ideal destIdeal = idInit( (currRing->N), 1 );
1123
1124 int i;
1125 BOOLEAN isZero;
1126 int *varpermutation = (int*)omAlloc( ((currRing->N)+1)*sizeof(int) );
1127 ideal perm = idMaxIdeal(1);
1128 intvec *iv = idSort(perm,TRUE);
1129 idDelete(&perm);
1130 for(i = (currRing->N); i > 0; i--) varpermutation[(currRing->N)+1-i] = (*iv)[i-1];
1131 delete iv;
1132
1133 for (i= 1; i <= (currRing->N); i++ )
1134 {
1135 // main loop
1136 STICKYPROT2( "(%i)", i /*varpermutation[i]*/);
1137 gaussReducer gauss( l.dimen() );
1138 isZero= FALSE;
1139 v= fglmVector( l.dimen(), 1 );
1140 while ( !isZero )
1141 {
1142 if ( (isZero= gauss.reduce( v )))
1143 {
1144 STICKYPROT( "+" );
1145 p= gauss.getDependence();
1146 number gcd= p.gcd();
1147 if ( ! nIsOne( gcd ) )
1148 {
1149 p /= gcd;
1150 }
1151 nDelete( & gcd );
1152 int k;
1153 poly temp = NULL;
1154 poly result=NULL;
1155 for ( k= p.size(); k > 0; k-- )
1156 {
1157 number n = p.getconstelem( k );
1158 if ( ! nIsZero( n ) )
1159 {
1160 if ( temp == NULL )
1161 {
1162 result= p_Init(currRing);
1163 temp= result;
1164 }
1165 else
1166 {
1167 temp->next= p_Init(currRing);
1168 pIter( temp );
1169 }
1170 pSetCoeff0( temp, nCopy(n) );
1171 pSetExp( temp, i /*varpermutation[i]*/, k-1 );
1172 pSetm( temp );
1173 }
1174 }

Callers 1

FindUnivariateWrapperFunction · 0.85

Calls 12

idInitFunction · 0.85
idSortFunction · 0.85
fglmVectorClass · 0.85
p_InitFunction · 0.85
dimenMethod · 0.80
getDependenceMethod · 0.80
storeMethod · 0.80
multiplyMethod · 0.80
reduceMethod · 0.45
gcdMethod · 0.45
sizeMethod · 0.45
getconstelemMethod · 0.45

Tested by

no test coverage detected