From 6c8972609f2103905c44b9a620132ea9aaa745a0 Mon Sep 17 00:00:00 2001 From: Anna Hofer Date: Wed, 1 Oct 2025 14:59:01 +0200 Subject: [PATCH 1/5] compute shorter irreducible resolution --- .../src/InjectiveResolutions.jl | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/experimental/InjectiveResolutions/src/InjectiveResolutions.jl b/experimental/InjectiveResolutions/src/InjectiveResolutions.jl index 8701b3d7f608..2faa51de65be 100644 --- a/experimental/InjectiveResolutions/src/InjectiveResolutions.jl +++ b/experimental/InjectiveResolutions/src/InjectiveResolutions.jl @@ -713,9 +713,9 @@ function _get_irreducible_ideal(kQ::MonoidAlgebra, J::IndecInj) end @doc raw""" - irreducible_resolution(M::SubquoModule{<:MonoidAlgebraElem}, i::Int = 0) + irreducible_resolution(M::SubquoModule{<:MonoidAlgebraElem}, i::Int = -1) -Return an irreducible resolution of $M$. +Return an irreducible resolution of $M$ (up to cohomological degree i). !!! note The monoid algebra $k[Q]$ must be normal. @@ -759,7 +759,7 @@ by graded submodule of kQ^1 with 3 generators over monoid algebra over rational field with cone of dimension 2 ``` """ -function irreducible_resolution(M::SubquoModule{<:MonoidAlgebraElem}, i::Int=0) +function irreducible_resolution(M::SubquoModule{<:MonoidAlgebraElem}, i::Int=-1) kQ = base_ring(M) @req is_normal(kQ) "monoid algebra must be normal" @@ -812,7 +812,7 @@ function irreducible_resolution(M::SubquoModule{<:MonoidAlgebraElem}, i::Int=0) push!(cochain_maps, hi) # end at cohomological degree i - if i > 0 && j == i + if j == i + 1 break end j = j + 1 @@ -955,7 +955,7 @@ function injective_resolution(M::SubquoModule{<:MonoidAlgebraElem}, i::Int) #compute irreducible resolution of shifted module a_shift = compute_shift(M, i+1) M_a = twist(M, -G(a_shift)) - irr_res = irreducible_resolution(M_a) + irr_res = irreducible_resolution(M_a,i) #get injective modules up to cohomological degree i, i.e. J^0, J^1, ...,J^i inj_modules = Vector{InjMod}() @@ -968,7 +968,7 @@ function injective_resolution(M::SubquoModule{<:MonoidAlgebraElem}, i::Int) #get all needed maps (as k-matrix or k[Q]-matrix?) cochain_maps = [ - matrix(irr_res.cochain_maps[k]) for k in eachindex(irr_res.cochain_maps) if 1 < k <= i+1 + matrix(irr_res.cochain_maps[k]) for k in eachindex(irr_res.cochain_maps) if 1 <= k <= i+1 ] return InjRes(M, inj_modules, cochain_maps, length(inj_modules)-1, irr_res, a_shift) end @@ -1064,5 +1064,4 @@ export zeroth_local_cohomology export MonoidAlgebra export MonoidAlgebraIdeal -export MonoidAlgebraElem - +export MonoidAlgebraElem \ No newline at end of file From 1deb6f527d4ccc445adf59baa606155904150a99 Mon Sep 17 00:00:00 2001 From: Anna Hofer Date: Fri, 24 Oct 2025 14:04:09 +0200 Subject: [PATCH 2/5] make injective_resolution faster --- experimental/InjectiveResolutions/src/InjectiveResolutions.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/experimental/InjectiveResolutions/src/InjectiveResolutions.jl b/experimental/InjectiveResolutions/src/InjectiveResolutions.jl index 2faa51de65be..21586257b716 100644 --- a/experimental/InjectiveResolutions/src/InjectiveResolutions.jl +++ b/experimental/InjectiveResolutions/src/InjectiveResolutions.jl @@ -955,7 +955,7 @@ function injective_resolution(M::SubquoModule{<:MonoidAlgebraElem}, i::Int) #compute irreducible resolution of shifted module a_shift = compute_shift(M, i+1) M_a = twist(M, -G(a_shift)) - irr_res = irreducible_resolution(M_a,i) + irr_res = irreducible_resolution(M_a) #get injective modules up to cohomological degree i, i.e. J^0, J^1, ...,J^i inj_modules = Vector{InjMod}() From 6878fa5d2cf89fe05036f06af7b6f171f13762f1 Mon Sep 17 00:00:00 2001 From: Anna Hofer Date: Fri, 24 Oct 2025 14:57:01 +0200 Subject: [PATCH 3/5] undo last commit --- experimental/InjectiveResolutions/src/InjectiveResolutions.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/experimental/InjectiveResolutions/src/InjectiveResolutions.jl b/experimental/InjectiveResolutions/src/InjectiveResolutions.jl index 21586257b716..2faa51de65be 100644 --- a/experimental/InjectiveResolutions/src/InjectiveResolutions.jl +++ b/experimental/InjectiveResolutions/src/InjectiveResolutions.jl @@ -955,7 +955,7 @@ function injective_resolution(M::SubquoModule{<:MonoidAlgebraElem}, i::Int) #compute irreducible resolution of shifted module a_shift = compute_shift(M, i+1) M_a = twist(M, -G(a_shift)) - irr_res = irreducible_resolution(M_a) + irr_res = irreducible_resolution(M_a,i) #get injective modules up to cohomological degree i, i.e. J^0, J^1, ...,J^i inj_modules = Vector{InjMod}() From 510e33ef3f3212688a6d6abcb6cef25097598d00 Mon Sep 17 00:00:00 2001 From: Anna Hofer <72522043+annahofer00@users.noreply.github.com> Date: Fri, 24 Oct 2025 15:31:08 +0200 Subject: [PATCH 4/5] Update experimental/InjectiveResolutions/src/InjectiveResolutions.jl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Lars Göttgens --- experimental/InjectiveResolutions/src/InjectiveResolutions.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/experimental/InjectiveResolutions/src/InjectiveResolutions.jl b/experimental/InjectiveResolutions/src/InjectiveResolutions.jl index 2faa51de65be..ab2c0e43f16c 100644 --- a/experimental/InjectiveResolutions/src/InjectiveResolutions.jl +++ b/experimental/InjectiveResolutions/src/InjectiveResolutions.jl @@ -1064,4 +1064,4 @@ export zeroth_local_cohomology export MonoidAlgebra export MonoidAlgebraIdeal -export MonoidAlgebraElem \ No newline at end of file +export MonoidAlgebraElem From f5e4ffd9d233674d1a9084b75ad1392d68607e15 Mon Sep 17 00:00:00 2001 From: Anna Hofer Date: Mon, 10 Nov 2025 16:56:13 +0100 Subject: [PATCH 5/5] resolve failing tests --- .../InjectiveResolutions/src/LocalCohomology.jl | 14 +++++++------- .../test/local_cohomology_hartshorne_example.jl | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/experimental/InjectiveResolutions/src/LocalCohomology.jl b/experimental/InjectiveResolutions/src/LocalCohomology.jl index 630d9377f3f7..5a9c5f9519ad 100644 --- a/experimental/InjectiveResolutions/src/LocalCohomology.jl +++ b/experimental/InjectiveResolutions/src/LocalCohomology.jl @@ -146,7 +146,7 @@ function local_cohomology(M::SubquoModule{T}, I::MonoidAlgebraIdeal, i::Integer) #get the injective modules J^{i-1} -> J^i -> J^{i+1} Ji_ = inj_res.inj_mods[i] - Ji = inj_res.inj_mods[i + 1] + Ji = inj_res.inj_mods[i+1] if inj_res.upto > i # J^{i+1} ≠ 0 Ji_1 = inj_res.inj_mods[i + 2] @@ -155,10 +155,10 @@ function local_cohomology(M::SubquoModule{T}, I::MonoidAlgebraIdeal, i::Integer) end #get maps _phi: J^{i-1} -> J^i and _psi: J^i -> J^{i+1} - _phi = get_scalar_matrix(kQ, inj_res.cochain_maps[i]) + _phi = get_scalar_matrix(kQ, inj_res.cochain_maps[i+1]) if inj_res.upto > i - _psi = get_scalar_matrix(kQ, inj_res.cochain_maps[i + 1]) + _psi = get_scalar_matrix(kQ, inj_res.cochain_maps[i + 2]) else # map is zero _psi = zero_matrix(k,length(Ji.indec_injectives), 1) end @@ -419,7 +419,7 @@ function sector_partition( poly_tuple = intersect(_delta...) if dim(poly_tuple) < 0 continue - elseif dim(poly_tuple) == 0 && length(lattice_points(poly_tuple)) == 0 + elseif dim(poly_tuple) == 0 && is_bounded(poly_tuple) && length(lattice_points(poly_tuple)) == 0 continue end @@ -460,9 +460,9 @@ function _local_cohomology_sector( _A = [A_0, A_1, A_2] # define vector spaces J_{S_A0}, J_{S_A1} and J_{S_A2} - F_0 = free_module(field, length(A_0)) - F_1 = free_module(field, length(A_1)) - F_2 = free_module(field, length(A_2)) + F_0 = vector_space(field, length(A_0)) + F_1 = vector_space(field, length(A_1)) + F_2 = vector_space(field, length(A_2)) #compute the maps by deleting rows and columns in phi and psi #phi diff --git a/experimental/InjectiveResolutions/test/local_cohomology_hartshorne_example.jl b/experimental/InjectiveResolutions/test/local_cohomology_hartshorne_example.jl index 03ed8d8a13ce..0119e39d5ea0 100644 --- a/experimental/InjectiveResolutions/test/local_cohomology_hartshorne_example.jl +++ b/experimental/InjectiveResolutions/test/local_cohomology_hartshorne_example.jl @@ -16,13 +16,13 @@ # cohomological degree 1 H1 = Oscar.local_cohomology(I_M, I, 1) - H1_sectors = [h for h in H1.sectors if dim(h.H)>0] #sectors with non-zero local cohomomology + H1_sectors = [h for h in H1.sectors if !is_zero(h)] #sectors with non-zero local cohomomology @test !Oscar.is_zero(H1) @test length(H1_sectors) == 1 # cohomological degree 2 H2 = Oscar.local_cohomology(I_M, I, 2) - H2_sectors = [h for h in H2.sectors if dim(h.H)>0] #sectors with non-zero local cohomology + H2_sectors = [h for h in H2.sectors if !is_zero(h)] #sectors with non-zero local cohomology @test !Oscar.is_zero(H2) @test length(H2_sectors) == 1