# Operations on Modules

### Kernel

kernelMethod
kernel(a::ModuleFPHom)

Return the kernel of a as an object of type SubQuo.

Additionally, if K denotes this object, return the inclusion map K $\rightarrow$ domain(a).

Examples

julia> R, (x, y, z) = PolynomialRing(QQ, ["x", "y", "z"]);

julia> F = free_module(R, 3);

julia> G = free_module(R, 2);

julia> W = R[y 0; x y; 0 z]
[y   0]
[x   y]
[0   z]

julia> a = hom(F, G, W);

julia> K, incl = kernel(a);

julia> K
Submodule with 1 generator
1 -> x*z*e - y*z*e + y^2*e
represented as subquotient with no relations.

julia> incl
Map with following data
Domain:
=======
Submodule with 1 generator
1 -> x*z*e - y*z*e + y^2*e
represented as subquotient with no relations.
Codomain:
=========
Free module of rank 3 over Multivariate Polynomial Ring in x, y, z over Rational Field
julia> R, (x, y, z) = PolynomialRing(QQ, ["x", "y", "z"]);

julia> F = free_module(R, 1);

julia> A = R[x; y]
[x]
[y]

julia> B = R[x^2; y^3; z^4]
[x^2]
[y^3]
[z^4]

julia> M = SubQuo(F, A, B)
Subquotient of Submodule with 2 generators
1 -> x*e
2 -> y*e
by Submodule with 3 generators
1 -> x^2*e
2 -> y^3*e
3 -> z^4*e

julia> N = M;

julia> V = [y^2*N, x*N]
2-element Vector{SubQuoElem{fmpq_mpoly}}:
x*y^2*e
x*y*e

julia> a = hom(M, N, V);

julia> K, incl = kernel(a);

julia> K
Subquotient of Submodule with 3 generators
1 -> (-x + y^2)*e
2 -> x*y*e
3 -> -x*y*e
by Submodule with 3 generators
1 -> x^2*e
2 -> y^3*e
3 -> z^4*e

julia> incl
Map with following data
Domain:
=======
Subquotient of Submodule with 3 generators
1 -> (-x + y^2)*e
2 -> x*y*e
3 -> -x*y*e
by Submodule with 3 generators
1 -> x^2*e
2 -> y^3*e
3 -> z^4*e
Codomain:
=========
Subquotient of Submodule with 2 generators
1 -> x*e
2 -> y*e
by Submodule with 3 generators
1 -> x^2*e
2 -> y^3*e
3 -> z^4*e
source

### Image

imageMethod
image(a::ModuleFPHom)

Return the image of a as an object of type SubQuo.

Additionally, if I denotes this object, return the inclusion map I $\rightarrow$ codomain(a).

Examples

julia> R, (x, y, z) = PolynomialRing(QQ, ["x", "y", "z"]);

julia> F = free_module(R, 3);

julia> G = free_module(R, 2);

julia> W = R[y 0; x y; 0 z]
[y   0]
[x   y]
[0   z]

julia> a = hom(F, G, W);

julia> I, incl = image(a);

julia> I
Submodule with 3 generators
1 -> y*e
2 -> x*e + y*e
3 -> z*e
represented as subquotient with no relations.

julia> incl
Map with following data
Domain:
=======
Submodule with 3 generators
1 -> y*e
2 -> x*e + y*e
3 -> z*e
represented as subquotient with no relations.
Codomain:
=========
Free module of rank 2 over Multivariate Polynomial Ring in x, y, z over Rational Field
julia> R, (x, y, z) = PolynomialRing(QQ, ["x", "y", "z"]);

julia> F = free_module(R, 1);

julia> A = R[x; y]
[x]
[y]

julia> B = R[x^2; y^3; z^4]
[x^2]
[y^3]
[z^4]

julia> M = SubQuo(F, A, B)
Subquotient of Submodule with 2 generators
1 -> x*e
2 -> y*e
by Submodule with 3 generators
1 -> x^2*e
2 -> y^3*e
3 -> z^4*e

julia> N = M;

julia> V = [y^2*N, x*N]
2-element Vector{SubQuoElem{fmpq_mpoly}}:
x*y^2*e
x*y*e

julia> a = hom(M, N, V);

julia> I, incl = image(a);

julia> I
Subquotient of Submodule with 2 generators
1 -> x*y^2*e
2 -> x*y*e
by Submodule with 3 generators
1 -> x^2*e
2 -> y^3*e
3 -> z^4*e

julia> incl
Map with following data
Domain:
=======
Subquotient of Submodule with 2 generators
1 -> x*y^2*e
2 -> x*y*e
by Submodule with 3 generators
1 -> x^2*e
2 -> y^3*e
3 -> z^4*e
Codomain:
=========
Subquotient of Submodule with 2 generators
1 -> x*e
2 -> y*e
by Submodule with 3 generators
1 -> x^2*e
2 -> y^3*e
3 -> z^4*e
source

### Cokernel

cokernelMethod
cokernel(a::ModuleFPHom)

Return the cokernel of a as an object of type SubQuo.

Examples

julia> R, (x, y, z) = PolynomialRing(QQ, ["x", "y", "z"]);

julia> F = free_module(R, 3);

julia> G = free_module(R, 2);

julia> W = R[y 0; x y; 0 z]
[y   0]
[x   y]
[0   z]

julia> a = hom(F, G, W);

julia> cokernel(a)
Subquotient of Submodule with 2 generators
1 -> e
2 -> e
by Submodule with 3 generators
1 -> y*e
2 -> x*e + y*e
3 -> z*e
julia> R, (x, y, z) = PolynomialRing(QQ, ["x", "y", "z"]);

julia> F = free_module(R, 1);

julia> A = R[x; y]
[x]
[y]

julia> B = R[x^2; y^3; z^4]
[x^2]
[y^3]
[z^4]

julia> M = SubQuo(F, A, B)
Subquotient of Submodule with 2 generators
1 -> x*e
2 -> y*e
by Submodule with 3 generators
1 -> x^2*e
2 -> y^3*e
3 -> z^4*e

julia> N = M;

julia> V = [y^2*N, x*N]
2-element Vector{SubQuoElem{fmpq_mpoly}}:
x*y^2*e
x*y*e

julia> a = hom(M, N, V);

julia> cokernel(a)
Subquotient of Submodule with 2 generators
1 -> x*e
2 -> y*e
by Submodule with 5 generators
1 -> x^2*e
2 -> y^3*e
3 -> z^4*e
4 -> x*y^2*e
5 -> x*y*e
source

## Direct Sums and Products

direct_sumMethod
direct_sum(M::ModuleFP{T}...; task::Symbol = :sum) where T

Given modules $M_1\dots M_n$, say, return the direct sum $\bigoplus_{i=1}^n M_i$.

• a vector containing the canonical injections $M_i\rightarrow\bigoplus_{i=1}^n M_i$ if task = :sum (default),
• a vector containing the canonical projections $\bigoplus_{i=1}^n M_i\rightarrow M_i$ if task = :prod,
• two vectors containing the canonical injections and projections, respectively, if task = :both,
• none of the above maps if task = :none.
source
direct_productMethod
direct_product(M::ModuleFP{T}...; task::Symbol = :prod) where T

Given modules $M_1\dots M_n$, say, return the direct product $\prod_{i=1}^n M_i$.

• a vector containing the canonical projections $\prod_{i=1}^n M_i\rightarrow M_i$ if task = :prod (default),
• a vector containing the canonical injections $M_i\rightarrow\prod_{i=1}^n M_i$ if task = :sum,
• two vectors containing the canonical projections and injections, respectively, if task = :both,
• none of the above maps if task = :none.