Skip to content

Commit 484fcd6

Browse files
seperated las vegas style for finite fields
1 parent 35b1ec0 commit 484fcd6

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

Diff for: experimental/AlgebraicShifting/src/PartialShift.jl

+17-3
Original file line numberDiff line numberDiff line change
@@ -358,17 +358,17 @@ function random_rothe_matrix(F::Field, p::PermGroupElem)
358358
n = degree(parent(p))
359359
u = identity_matrix(F, n)
360360
for (i, j) in inversions(p)
361-
u[i, j] = F(rand(1:char-1))
361+
u[i, j] = F(rand(1:range))
362362
end
363363
return u * permutation_matrix(F, p)
364364
end
365365

366-
function random_shift(F::QQField, K::ComplexOrHypergraph, p::PermGroupElem;)
366+
function random_shift(F::QQField, K::ComplexOrHypergraph, p::PermGroupElem)
367367
n = n_vertices(K)
368368
exterior_shift(K, random_rothe_matrix(F, p))
369369
end
370370

371-
function random_shift(F::Field, K::ComplexOrHypergraph, p::PermGroupElem;)
371+
function random_shift(F::Field, K::ComplexOrHypergraph, p::PermGroupElem)
372372
n = n_vertices(K)
373373
exterior_shift(K, random_rothe_matrix(F, p))
374374
end
@@ -414,6 +414,20 @@ function check_shifted(F::Field, src::SimplicialComplex,
414414
end
415415

416416
function exterior_shift_lv(F::Field, K::ComplexOrHypergraph, p::PermGroupElem)
417+
# this might need to be changed based on the characteristic
418+
# we expect that the larger the characteristic the smaller the sample needs to be
419+
# setting to 100 now for good measure
420+
sample_size = 100
421+
shift = partialsort!([random_shift(F, K, p) for _ in 1:sample_size], 1;
422+
lt=isless_lex)
423+
424+
check_shifted(F, K, shift, p) && return shift
425+
426+
# this should be updated to not throw an error
427+
error("Could not find the full shift using $sample_size samples")
428+
end
429+
430+
function exterior_shift_lv(F::QQField, K::ComplexOrHypergraph, p::PermGroupElem)
417431
shift = random_shift(F, K, p)
418432
count = 1
419433
while !check_shifted(F, K, shift, p)

0 commit comments

Comments
 (0)