Skip to content
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

Free resolutions updates #2836

Merged
merged 7 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions src/Modules/UngradedModules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6355,7 +6355,7 @@
return last(Hecke.map_range(cc))
end

function _extend_free_resolution(cc::Hecke.ComplexOfMorphisms, idx::Int; algorithm::Symbol=:fres)
function _extend_free_resolution(cc::Hecke.ComplexOfMorphisms, idx::Int)
# assuming a free res is a chain_complex, then it will be
# M_1 -> M_0 -> S -> 0
#the range is 1:-1:-2 or so
Expand All @@ -6364,14 +6364,19 @@
# - extending lift is repeated pushfirst
# - the idx is only used to see how many maps are missing

algorithm = get_attribute(cc, :algorithm)
if algorithm == nothing
algorithm = :fres

Check warning on line 6369 in src/Modules/UngradedModules.jl

View check run for this annotation

Codecov / codecov/patch

src/Modules/UngradedModules.jl#L6369

Added line #L6369 was not covered by tests
set_attribute!(cc, :algorithm, :fres)
end
r = Hecke.map_range(cc)
if idx < last(r)
error("extending past the final zero not supported")
end
len_missing = idx - first(r)
@assert len_missing > 0
if cc.complete == true
error("complex is complete, cannot extend")
return map(cc, first(r))
end

kernel_entry = image(cc.maps[1])[1]
Expand All @@ -6386,6 +6391,10 @@
res = Singular.fres(singular_kernel_entry, len, "complete")
elseif algorithm == :lres
error("LaScala's method is not yet available in Oscar.")
elseif algorithm == :mres
res = Singular.mres(singular_kernel_entry, len)
elseif algorithm == :nres
res = Singular.nres(singular_kernel_entry, len)

Check warning on line 6397 in src/Modules/UngradedModules.jl

View check run for this annotation

Codecov / codecov/patch

src/Modules/UngradedModules.jl#L6394-L6397

Added lines #L6394 - L6397 were not covered by tests
else
error("Unsupported algorithm $algorithm")
end
Expand All @@ -6394,16 +6403,19 @@
j = 2

while j <= Singular.length(res)
rk = Singular.ngens(res[j])
if is_graded(dom)
codom = dom
SM = SubModuleOfFreeModule(codom, res[j])
generator_matrix(SM)
map = graded_map(codom, SM.matrix)
dom = domain(map)
set_attribute!(dom, :name => "R^$rk")
else
codom = dom
dom = free_module(br, Singular.ngens(res[j]))
SM = SubModuleOfFreeModule(codom, res[j])
set_attribute!(dom, :name => "R^$rk")
generator_matrix(SM)
map = hom(dom, codom, SM.matrix)
end
Expand All @@ -6417,7 +6429,9 @@
pushfirst!(cc, hom(Z, domain(cc.maps[1]), Vector{elem_type(domain(cc.maps[1]))}()))
cc.complete = true
end
return map(cc, idx)
set_attribute!(cc, :show => free_show)
maxidx = min(idx, first(Hecke.map_range(cc)))
return map(cc, maxidx)
end

@doc raw"""
Expand Down Expand Up @@ -6469,7 +6483,9 @@
Free module of rank 0 over Multivariate polynomial ring in 3 variables over QQ

julia> fr
C_-2 <---- C_-1 <---- C_0 <---- C_1 <---- C_2 <---- C_3 <---- C_4
Free resolution of M
R^2 <---- R^6 <---- R^6 <---- R^2 <---- 0
0 1 2 3 4

julia> is_complete(fr)
true
Expand Down Expand Up @@ -6576,6 +6592,7 @@
cc.fill = _extend_free_resolution
cc.complete = cc_complete
set_attribute!(cc, :show => free_show, :free_res => M)
set_attribute!(cc, :algorithm, algorithm)

return FreeResolution(cc)
end
Expand Down
3 changes: 3 additions & 0 deletions test/Modules/UngradedModules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,15 @@ end
@test length(free_res.C.maps) == 4
@test free_res[3] == free_module(R, 2)
@test free_res[4] == free_module(R, 0)
@test free_res[100] == free_module(R, 0)
@test is_complete(free_res) == true
free_res = free_resolution(M)
@test get_attribute(free_res.C, :algorithm) == :fres
@test all(iszero, homology(free_res.C))
free_res = free_resolution_via_kernels(M)
@test all(iszero, homology(free_res))
free_res = free_resolution(M, algorithm = :mres)
@test get_attribute(free_res.C, :algorithm) == :mres
@test all(iszero, homology(free_res.C))
free_res = free_resolution(M, algorithm = :nres)
@test all(iszero, homology(free_res.C))
Expand Down
Loading