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

Function FpRandomElement

factory/cfModGcd.cc:1170–1202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1168}
1169
1170static inline
1171CanonicalForm
1172FpRandomElement (const CanonicalForm& F, CFList& list, bool& fail)
1173{
1174 fail= false;
1175 Variable x= F.mvar();
1176 FFRandom genFF;
1177 CanonicalForm random;
1178 int p= getCharacteristic();
1179 int bound= p;
1180 do
1181 {
1182 if (list.length() == bound)
1183 {
1184 fail= true;
1185 break;
1186 }
1187 if (list.length() < 1)
1188 random= 0;
1189 else
1190 {
1191 random= genFF.generate();
1192 while (find (list, random))
1193 random= genFF.generate();
1194 }
1195 if (F (random, x) == 0)
1196 {
1197 list.append (random);
1198 continue;
1199 }
1200 } while (find (list, random));
1201 return random;
1202}
1203
1204#if defined(HAVE_NTL) || defined(HAVE_FLINT)
1205CanonicalForm

Callers 2

modGCDFpFunction · 0.85
sparseGCDFpFunction · 0.85

Calls 7

getCharacteristicFunction · 0.85
findFunction · 0.85
mvarMethod · 0.80
FFunction · 0.50
lengthMethod · 0.45
generateMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected