In gap/base/kernel.gi a function GenerateRandomKernelElementsAndOptionallyVerifyThem is implemented. This function includes the following code:
local gens, verificationSuccess, x, s, y, z, i;
gens := gensN(ri);
verificationSuccess := true;
# We generate a random element of the kernel as the quotient of a random
# element and the preimage of its image under the homomorphism.
for i in [1 .. n] do
# Finding kernel generators and immediate verification must use
# different random elements! This is ensured by using the same stamp
# in both situations.
x := RandomElm(ri, "GenerateRandomKernelElementsAndOptionallyVerifyThem", true).el;
Assert(2, ValidateHomomInput(ri, x));
s := SLPforElement(ImageRecogNode(ri),
ImageElm(Homom(ri), x!.el));
if s = fail then
return fail;
fi;
y := ResultOfStraightLineProgram(s, ri!.pregensfacwithmem);
z := x^-1*y;
if isone(ri)(z) or ForAny(gens, x -> isequal(ri)(x, z)) then
continue;
fi;
if not doVerification or SLPforElement(KernelRecogNode(ri), z!.el) = fail then
Add(gens, z);
verificationSuccess := not doVerification;
fi;
od;
return verificationSuccess;
I believe that
s := SLPforElement(ImageRecogNode(ri),
ImageElm(Homom(ri), x!.el));
uses the SLP which has been computed for nice generators of the ImageRecogNode(ri) to compute an SLP for the image of x. Afterwards, this SLP is evaluated in pregensfacwithmem. I believe that by this a very long SLP is evaluated multiple times. For this let slp_1 be the slp evaluating to nice gens in the image. Then we only need to evaluate this slp once in pregensfacwithmem. Afterwards, we compute the slp for the image of x starting from the nice gens and evaluate this slp in the preimages of the nice gens. This should avoid evaluating the same slp multiple times.
In
gap/base/kernel.gi
a functionGenerateRandomKernelElementsAndOptionallyVerifyThem
is implemented. This function includes the following code:I believe that
uses the SLP which has been computed for nice generators of the
ImageRecogNode(ri)
to compute an SLP for the image ofx
. Afterwards, this SLP is evaluated inpregensfacwithmem
. I believe that by this a very long SLP is evaluated multiple times. For this letslp_1
be the slp evaluating to nice gens in the image. Then we only need to evaluate this slp once inpregensfacwithmem
. Afterwards, we compute the slp for the image ofx
starting from the nice gens and evaluate this slp in the preimages of the nice gens. This should avoid evaluating the same slp multiple times.