-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adv/algebraic shifting #4260
base: master
Are you sure you want to change the base?
Adv/algebraic shifting #4260
Changes from all commits
a915b16
1071a38
087ae2e
be2a95a
6e4b8c7
b794172
190d486
324eee8
960fb0d
5c6a3ae
e3f3301
40175f8
ddd84b5
dccec99
295fcff
27c72c0
a4ec502
398d1f9
3762f5a
33d59f3
f7be618
be99cbd
163b843
02c134f
2676d27
79bced6
251ceaa
0555133
60a8433
f614998
0acf283
619bf4f
e05fb2f
3d57d24
f4b6d44
56f50f1
6a70d42
d503bc7
3eaa0a9
07bcbd9
c351250
41de5bc
8fdc000
17aaf37
c642360
8adf1ea
712c461
6f70071
538200e
393962a
e740219
c3257b9
e46d1ef
df8279e
bbb4e65
4f56b91
d17cfab
29d9d02
2ac35f7
9c22f09
c9f806b
592f7c0
9bb2050
5acb531
b5f056a
e74d373
fa7f6f4
a3615ed
dda15a7
ca8ce7d
f49653f
c5b0452
6b9f758
b8a634e
613cce7
c181c48
1addc98
3ad606c
412c5d7
8d47534
a7e9da7
a0c97fe
201f470
a82180c
d61a096
cf34850
14b61a1
d28bfb6
58e6cfe
33e463b
2c9a717
a1a5a8a
caa5530
c8b9570
96fcaf0
f6dbf42
13b1e26
973d9e8
1089ccb
307ad1b
00e1ffb
00cb3fc
db194db
944ac0c
c6fccd5
50be74b
fd089a7
ca861b0
a5a434b
eda808f
f50ecc7
07187d7
9373abe
deb41d7
8b226a6
6a625a2
901dc91
dbf2651
043f979
7675df2
c63d5ea
405a195
1f9a2c5
b8e8a00
dc6cbcb
4968376
4ef8766
bf7f71c
a4f0127
1afd25b
e552dfb
0087948
4edfdee
37d40a2
7553c5a
70fc86a
6207e4b
b3610b7
687c369
0b138c3
6a0dc54
4ebc610
f8a4532
39f66a3
c2f1c3e
79a12f1
7f5444a
d687d4e
2005a79
87bfbd7
61f14d7
a0feef6
4d81445
3dee71b
49e9bbb
052b305
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Algebraic Shifting | ||
|
||
## Aims | ||
|
||
This package grew out of an ongoing project of Antony Della Vecchia, Michael Joswig and Fabian Lenzen on [Partial Algebraic Shifting](https://arxiv.org/abs/2410.24044). | ||
Part of this project is the development of new methods for algebraic shifting; these are implemented here. | ||
|
||
## Status | ||
|
||
Full and partial shifting in the exterior algebra fully functional. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[ | ||
"Algebraic Shifting" => [ | ||
"introduction.md", | ||
"exterior_shifting.md", | ||
"partial_shift_graph.md" | ||
] | ||
] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
```@meta | ||
CurrentModule = Oscar | ||
DocTestSetup = Oscar.doctestsetup() | ||
``` | ||
|
||
# Exterior Shifting | ||
|
||
## Uniform Hypergraphs | ||
```@docs | ||
uniform_hypergraph | ||
``` | ||
|
||
## Matrix Constructions | ||
|
||
```@docs | ||
generic_unipotent_matrix | ||
rothe_matrix | ||
compound_matrix | ||
``` | ||
|
||
## Exterior (Partial) Shifting | ||
```@docs | ||
exterior_shift | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
```@meta | ||
CurrentModule = Oscar | ||
DocTestSetup = Oscar.doctestsetup() | ||
``` | ||
|
||
|
||
# Introduction | ||
|
||
Algebraic shifting is a widely applicable method for converting a uniform hypergraph $S$ into another hypergraph, $\Delta(S)$, which is somehow simpler but still retains key properties of $S$. | ||
Often this is applied to simplicial complexes, where each layer of $(k-1)$-faces forms a $k$-uniform hypergraph. | ||
|
||
Here we focus on full and partial algebraic shifting in the exterior algebra. | ||
For general background on the subject we refer to [Kal02](@cite); for details concerning the implementation see [D-VJL24](@cite). | ||
|
||
|
||
## Status | ||
|
||
This part of OSCAR is in an experimental state; please see [Adding new projects to experimental](@ref) for what this means. | ||
|
||
## Contact | ||
|
||
Please direct questions about this part of OSCAR to the following people: | ||
* [Antony Della Vecchia](https://antonydellavecchia.github.io) | ||
* [Michael Joswig](https://page.math.tu-berlin.de/~joswig/) | ||
|
||
|
||
You can ask questions in the [OSCAR Slack](https://www.oscar-system.org/community/#slack). | ||
|
||
Alternatively, you can [raise an issue on github](https://www.oscar-system.org/community/#how-to-report-issues). |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
```@meta | ||
CurrentModule = Oscar | ||
DocTestSetup = Oscar.doctestsetup() | ||
``` | ||
|
||
# Partial Shift Graph | ||
|
||
```@docs | ||
partial_shift_graph_vertices | ||
partial_shift_graph | ||
contracted_partial_shift_graph | ||
``` |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,119 @@ | ||||||
include("UniformHypergraph.jl") | ||||||
include("PartialShift.jl") | ||||||
include("PartialShiftGraph.jl") | ||||||
|
||||||
export UniformHypergraph | ||||||
|
||||||
export compound_matrix | ||||||
export contracted_partial_shift_graph | ||||||
export exterior_shift | ||||||
export face_size | ||||||
export generic_unipotent_matrix | ||||||
export partial_shift_graph | ||||||
export partial_shift_graph_vertices | ||||||
export rothe_matrix | ||||||
export uniform_hypergraph | ||||||
|
||||||
function independent_columns(A::MatElem) | ||||||
col_indices = Int[] | ||||||
row_index = 1 | ||||||
row_bound = nrows(A) | ||||||
for col_index in 1:ncols(A) | ||||||
if !is_zero(A[row_index, col_index]) | ||||||
push!(col_indices, col_index) | ||||||
row_index += 1 | ||||||
end | ||||||
row_index > row_bound && break | ||||||
end | ||||||
return col_indices | ||||||
end | ||||||
|
||||||
|
||||||
""" | ||||||
symmetric_shift(F::Field, K::SimplicialComplex) | ||||||
|
||||||
Returns the symmetric shift of `K` | ||||||
|
||||||
see survey on algebraic shifting Gil Kalai (properly cite at some point) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolve this TODO? But also OK to defer it to a follow-up PR, but then I'd recommend to at least make it easily grepable, e.g.
Suggested change
|
||||||
""" | ||||||
function symmetric_shift(F::Field, K::SimplicialComplex; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function has zero tests right now. Perhaps add a |
||||||
change_of_basis::T = nothing) where T <: Union{Nothing, MatElem} | ||||||
|
||||||
n = n_vertices(K) | ||||||
is_generic = false | ||||||
if isnothing(change_of_basis) | ||||||
is_generic = true | ||||||
# generic change of basis | ||||||
Fy, y = polynomial_ring(F, :y => (1:n, 1:n)) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rings created internally should have caching disabled. Please also in all the other places (user facing examples e.g. in docstrings don't need it)
Suggested change
|
||||||
change_of_basis = matrix(Fy, hcat(y)) | ||||||
matrix_base = Fy | ||||||
else | ||||||
matrix_base = base_ring(change_of_basis) | ||||||
if matrix_base isa MPolyRing | ||||||
is_generic = true | ||||||
end | ||||||
end | ||||||
|
||||||
Rx, x = polynomial_ring(matrix_base, n) | ||||||
# the generators of the stanley reisner ideal are combinations of [x_1, ..., x_n] | ||||||
R_K, _ = stanley_reisner_ring(Rx, K) | ||||||
|
||||||
# the computation is a over the field of fractions Fyx | ||||||
# we use a different ring to generate monomial_basis, coefficients need to be a field, | ||||||
# but we want to avoid using fraction field of Ry during row reduction | ||||||
mb_ring, z = graded_polynomial_ring(F, n) | ||||||
|
||||||
|
||||||
input_faces = apply_on_faces(K) do (dim_face, faces) | ||||||
r = dim_face + 1 | ||||||
|
||||||
mb = reverse(monomial_basis(mb_ring, r)) | ||||||
A = Vector{elem_type(matrix_base)}[] | ||||||
mb_exponents = first.(collect.(exponents.(mb))) # gets monomial exponents | ||||||
|
||||||
for b in mb | ||||||
# need to compare with some alternatives | ||||||
transformed_monomial = evaluate(b, change_of_basis * gens(R_K)) | ||||||
|
||||||
# we need to iterate through exponents here since the functions terms, coefficients or exponents | ||||||
# do not return 0 terms and we need to make sure the generic col aligns with the others | ||||||
# this is needed for the case when the field has finite characteristic | ||||||
# we use the lift because currently there is no function for get the coeff of | ||||||
# a MPolyQuoRingElem, which means we also need to check if it's zero before adding the coefficient | ||||||
col = [ | ||||||
!is_zero(R_K(monomial(Rx, e))) ? coeff(lift(transformed_monomial), e) : matrix_base(0) | ||||||
for e in mb_exponents] | ||||||
|
||||||
push!(A, col) | ||||||
end | ||||||
|
||||||
C = matrix(matrix_base, reduce(hcat, A)) | ||||||
|
||||||
if is_generic | ||||||
Oscar.ModStdQt.ref_ff_rc!(C) | ||||||
else | ||||||
rref!(C) | ||||||
end | ||||||
|
||||||
smallest_basis_el = z[r]^r | ||||||
smallest_index = findfirst(a -> a == smallest_basis_el, mb) | ||||||
col_indices = filter(x -> x >= smallest_index, independent_columns(C)) | ||||||
monomial_exponents = first.(exponents.(mb[col_indices])) | ||||||
|
||||||
shifted_sets = Vector{Int}[] | ||||||
for me in monomial_exponents | ||||||
shifted_set = Int[] | ||||||
index_count = 1 | ||||||
for (i, e) in enumerate(me) | ||||||
for j in 1:e | ||||||
push!(shifted_set, i - (r - index_count)) | ||||||
index_count += 1 | ||||||
end | ||||||
end | ||||||
push!(shifted_sets, shifted_set) | ||||||
end | ||||||
return shifted_sets | ||||||
end | ||||||
|
||||||
return simplicial_complex(input_faces) | ||||||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this dependency added? I see no code using it?