Skip to content

Commit

Permalink
seperated las vegas style for finite fields
Browse files Browse the repository at this point in the history
  • Loading branch information
antonydellavecchia committed Dec 17, 2024
1 parent 35b1ec0 commit 484fcd6
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions experimental/AlgebraicShifting/src/PartialShift.jl
Original file line number Diff line number Diff line change
Expand Up @@ -358,17 +358,17 @@ function random_rothe_matrix(F::Field, p::PermGroupElem)
n = degree(parent(p))
u = identity_matrix(F, n)
for (i, j) in inversions(p)
u[i, j] = F(rand(1:char-1))
u[i, j] = F(rand(1:range))
end
return u * permutation_matrix(F, p)

Check warning on line 363 in experimental/AlgebraicShifting/src/PartialShift.jl

View check run for this annotation

Codecov / codecov/patch

experimental/AlgebraicShifting/src/PartialShift.jl#L355-L363

Added lines #L355 - L363 were not covered by tests
end

function random_shift(F::QQField, K::ComplexOrHypergraph, p::PermGroupElem;)
function random_shift(F::QQField, K::ComplexOrHypergraph, p::PermGroupElem)
n = n_vertices(K)
exterior_shift(K, random_rothe_matrix(F, p))

Check warning on line 368 in experimental/AlgebraicShifting/src/PartialShift.jl

View check run for this annotation

Codecov / codecov/patch

experimental/AlgebraicShifting/src/PartialShift.jl#L366-L368

Added lines #L366 - L368 were not covered by tests
end

function random_shift(F::Field, K::ComplexOrHypergraph, p::PermGroupElem;)
function random_shift(F::Field, K::ComplexOrHypergraph, p::PermGroupElem)

Check warning on line 371 in experimental/AlgebraicShifting/src/PartialShift.jl

View check run for this annotation

Codecov / codecov/patch

experimental/AlgebraicShifting/src/PartialShift.jl#L371

Added line #L371 was not covered by tests
n = n_vertices(K)
exterior_shift(K, random_rothe_matrix(F, p))

Check warning on line 373 in experimental/AlgebraicShifting/src/PartialShift.jl

View check run for this annotation

Codecov / codecov/patch

experimental/AlgebraicShifting/src/PartialShift.jl#L373

Added line #L373 was not covered by tests
end
Expand Down Expand Up @@ -414,6 +414,20 @@ function check_shifted(F::Field, src::SimplicialComplex,
end

function exterior_shift_lv(F::Field, K::ComplexOrHypergraph, p::PermGroupElem)

Check warning on line 416 in experimental/AlgebraicShifting/src/PartialShift.jl

View check run for this annotation

Codecov / codecov/patch

experimental/AlgebraicShifting/src/PartialShift.jl#L416

Added line #L416 was not covered by tests
# this might need to be changed based on the characteristic
# we expect that the larger the characteristic the smaller the sample needs to be
# setting to 100 now for good measure
sample_size = 100
shift = partialsort!([random_shift(F, K, p) for _ in 1:sample_size], 1;

Check warning on line 421 in experimental/AlgebraicShifting/src/PartialShift.jl

View check run for this annotation

Codecov / codecov/patch

experimental/AlgebraicShifting/src/PartialShift.jl#L420-L421

Added lines #L420 - L421 were not covered by tests
lt=isless_lex)

check_shifted(F, K, shift, p) && return shift

Check warning on line 424 in experimental/AlgebraicShifting/src/PartialShift.jl

View check run for this annotation

Codecov / codecov/patch

experimental/AlgebraicShifting/src/PartialShift.jl#L424

Added line #L424 was not covered by tests

# this should be updated to not throw an error
error("Could not find the full shift using $sample_size samples")

Check warning on line 427 in experimental/AlgebraicShifting/src/PartialShift.jl

View check run for this annotation

Codecov / codecov/patch

experimental/AlgebraicShifting/src/PartialShift.jl#L427

Added line #L427 was not covered by tests
end

function exterior_shift_lv(F::QQField, K::ComplexOrHypergraph, p::PermGroupElem)
shift = random_shift(F, K, p)
count = 1
while !check_shifted(F, K, shift, p)
Expand Down

0 comments on commit 484fcd6

Please sign in to comment.