Skip to content
3 changes: 1 addition & 2 deletions src/Modules/ModuleTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,6 @@ When computed, the corresponding matrix (via `matrix()`) and inverse isomorphism
@assert length(a) == ngens(F)
r = new{typeof(F), typeof(G), Nothing}()
a=Vector{elem_type(G)}(a)
image_module = sub_object(G, a)
function im_func(x::AbstractFreeModElem)
# The lines below were an attempt to speed up mapping.
# However, it turns out that checking the equality is more
Expand All @@ -610,7 +609,7 @@ When computed, the corresponding matrix (via `matrix()`) and inverse isomorphism
@assert parent(x) === G
r.generators_map_to_generators === true && return FreeModElem(coordinates(simplify!(x)), F)
#c = coordinates(repres(simplify!(x)), image_module)
c = coordinates(repres(x), image_module)
c = coordinates(repres(x), image_module(r))
return FreeModElem(c, F)
end
r.header = MapHeader{typeof(F), typeof(G)}(F, G, im_func, pr_func)
Expand Down
5 changes: 4 additions & 1 deletion src/Modules/UngradedModules/FreeMod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ not provide names for the generators, the standard names e_i are used for
the standard unit vectors.
"""
function FreeMod(R::AdmissibleOFPModuleRing, n::Int, name::VarName = :e; cached::Bool = false) # TODO cached?
return FreeMod{elem_type(R)}(n, R, [Symbol("$name[$i]") for i=1:n])
function symb_fun()
return [Symbol("$name[$i]") for i=1:n]
end
return FreeMod{elem_type(R)}(n, R, symb_fun)
end

function FreeMod(R::AdmissibleOFPModuleRing, names::Vector{String}; cached::Bool=false)
Expand Down
5 changes: 5 additions & 0 deletions src/Modules/UngradedModules/FreeModuleHom.jl
Original file line number Diff line number Diff line change
Expand Up @@ -651,3 +651,8 @@ function lift(f::FreeModuleHom, g::FreeModuleHom)
h = hom(domain(f), domain(g), lifted_imgs)
return h
end

@attr SubquoModule{T} function image_module(phi::FreeModuleHom{FreeMod{T}, <:OFPModule{T}, Nothing}) where {T}
return sub_object(codomain(phi), images_of_generators(phi))
end

2 changes: 1 addition & 1 deletion src/Modules/UngradedModules/Hom_and_ext.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Return true iff `f` is the zero map.
"""
function iszero(f::OFPModuleHom)
return all(iszero, map(f, gens(domain(f))))
return all(iszero, images_of_generators(f))
end

@doc raw"""
Expand Down
12 changes: 11 additions & 1 deletion src/Modules/UngradedModules/SubQuoHom.jl
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,7 @@ Return the kernel of `a` as an object of type `SubquoModule`.
Additionally, if `K` denotes this object, return the inclusion map `K` $\to$ `domain(a)`.
"""
function kernel(h::SubQuoHom)
is_zero(codomain(h)) && return domain(h), identity_map(domain(h))
D = domain(h)
R = base_ring(D)
is_graded(h) ? F = graded_free_module(R, degrees_of_generators(D)) : F = FreeMod(R, ngens(D))
Expand Down Expand Up @@ -917,7 +918,16 @@ Return the composition `b` $\circ$ `a`.
"""
function *(h::OFPModuleHom{T1, T2, Nothing}, g::OFPModuleHom{T2, T3, Nothing}) where {T1, T2, T3}
@assert codomain(h) === domain(g)
return hom(domain(h), codomain(g), Vector{elem_type(codomain(g))}([g(h(x)) for x = gens(domain(h))]), check=false)
R = base_ring(domain(h))
img_gens_coords = sparse_row_type(R)[sparse_row(R) for _ in 1:ngens(domain(h))]
img_gens_g = images_of_generators(g)
for (k, v) in enumerate(images_of_generators(h))
for (i, c) in coordinates(v)
Hecke.add_scaled_row!(coordinates(img_gens_g[i]), img_gens_coords[k], c)
end
end
cod = codomain(g)
return hom(domain(h), cod, elem_type(cod)[cod(v) for v in img_gens_coords]; check=false)
end

function *(h::OFPModuleHom{T1, T2, <:Map}, g::OFPModuleHom{T2, T3, <:Map}) where {T1, T2, T3}
Expand Down
Loading