Skip to content

Commit

Permalink
FreeModule -> free_module; VectorSpace -> vector_space (#1626)
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin authored Feb 28, 2024
1 parent 3f467d6 commit 4546165
Show file tree
Hide file tree
Showing 20 changed files with 78 additions and 84 deletions.
10 changes: 5 additions & 5 deletions docs/src/direct_sum.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ direct_sum
**Examples**

```jldoctest
julia> F = FreeModule(ZZ, 5)
julia> F = free_module(ZZ, 5)
Free module of rank 5 over integers
julia> m1 = F(BigInt[4, 7, 8, 2, 6])
Expand Down Expand Up @@ -83,7 +83,7 @@ summands(::Generic.DirectSumModule{T}) where T <: RingElement
**Examples**

```jldoctest
julia> F = FreeModule(ZZ, 5)
julia> F = free_module(ZZ, 5)
Free module of rank 5 over integers
julia> m1 = F(BigInt[4, 7, 8, 2, 6])
Expand Down Expand Up @@ -135,9 +135,9 @@ element in $D$.
**Examples**

```jldoctest
julia> N = FreeModule(QQ, 1);
julia> N = free_module(QQ, 1);
julia> M = FreeModule(QQ, 2);
julia> M = free_module(QQ, 2);
julia> D, _ = direct_sum(M, N, M);
Expand Down Expand Up @@ -175,7 +175,7 @@ $S$, construct the corresponding homomorphism.
**Examples**

```jldoctest
julia> N = FreeModule(QQ, 2);
julia> N = free_module(QQ, 2);
julia> D, _ = direct_sum(N, N);
Expand Down
12 changes: 6 additions & 6 deletions docs/src/free_module.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@ following functionality.
### Constructors

```@docs
FreeModule(R::Ring, rank::Int)
VectorSpace(F::Field, dim::Int)
free_module(R::Ring, rank::Int)
vector_space(F::Field, dim::Int)
```

Construct the free module/vector space of given rank/dimension.

**Examples**

```jldoctest
julia> M = FreeModule(ZZ, 3)
julia> M = free_module(ZZ, 3)
Free module of rank 3 over integers
julia> V = VectorSpace(QQ, 2)
julia> V = vector_space(QQ, 2)
Vector space of dimension 2 over rationals
```
Expand All @@ -73,10 +73,10 @@ basis(V::Generic.FreeModule{T}) where T <: FieldElem
**Examples**

```jldoctest
julia> M = FreeModule(ZZ, 3)
julia> M = free_module(ZZ, 3)
Free module of rank 3 over integers
julia> V = VectorSpace(QQ, 2)
julia> V = vector_space(QQ, 2)
Vector space of dimension 2 over rationals
julia> rank(M)
Expand Down
16 changes: 8 additions & 8 deletions docs/src/module.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ relation is given as an AbstractAlgebra row matrix.
**Examples**

```jldoctest
julia> M = FreeModule(QQ, 2)
julia> M = free_module(QQ, 2)
Vector space of dimension 2 over rationals
julia> n = number_of_generators(M)
Expand All @@ -94,7 +94,7 @@ julia> g1 = gen(M, 1)
julia> !iszero(g1)
true
julia> M = FreeModule(QQ, 2)
julia> M = free_module(QQ, 2)
Vector space of dimension 2 over rationals
julia> z = zero(M)
Expand Down Expand Up @@ -129,7 +129,7 @@ map. There must be a path from $N$ to $M$ along such maps.
**Examples**

```julia
F = FreeModule(ZZ, 3)
F = free_module(ZZ, 3)

S1, f = sub(F, [rand(F, -10:10)])

Expand Down Expand Up @@ -157,7 +157,7 @@ zero(M::FPModule)
**Examples**

```jldoctest
julia> M = FreeModule(QQ, 2)
julia> M = free_module(QQ, 2)
Vector space of dimension 2 over rationals
julia> z = zero(M)
Expand All @@ -173,7 +173,7 @@ Base.getindex(m::FPModuleElem{T}) where T <: RingElement
**Examples**

```jldoctest
julia> F = FreeModule(ZZ, 3)
julia> F = free_module(ZZ, 3)
Free module of rank 3 over integers
julia> m = F(BigInt[2, -5, 4])
Expand All @@ -192,7 +192,7 @@ julia> m[1]
**Examples**

```jldoctest
julia> M = FreeModule(QQ, 2)
julia> M = free_module(QQ, 2)
Vector space of dimension 2 over rationals
julia> M == M
Expand All @@ -216,7 +216,7 @@ is_isomorphic(::FPModule{T}, ::FPModule{T}) where T <: RingElement
**Examples**

```jldoctest; setup = :(import Random; Random.seed!(42))
julia> M = FreeModule(ZZ, 3)
julia> M = free_module(ZZ, 3)
Free module of rank 3 over integers
julia> m1 = rand(M, -10:10)
Expand Down Expand Up @@ -251,7 +251,7 @@ invariant_factors(::FPModule{T}) where T <: RingElement
**Examples**

```jldoctest; setup = :(import Random; Random.seed!(42))
julia> M = FreeModule(ZZ, 3)
julia> M = free_module(ZZ, 3)
Free module of rank 3 over integers
julia> m1 = rand(M, -10:10)
Expand Down
10 changes: 5 additions & 5 deletions docs/src/module_homomorphism.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ModuleIsomorphism(M1::FPModule{T}, M2::FPModule{T}, m::MatElem{T}) where T <: Ri
**Examples**

```jldoctest
julia> M = FreeModule(ZZ, 2)
julia> M = free_module(ZZ, 2)
Free module of rank 2 over integers
julia> f = ModuleHomomorphism(M, M, matrix(ZZ, 2, 2, [1, 2, 3, 4]))
Expand Down Expand Up @@ -70,7 +70,7 @@ kernel(f::Map(FPModuleHomomorphism))
**Examples**

```jldoctest
julia> M = FreeModule(ZZ, 3)
julia> M = free_module(ZZ, 3)
Free module of rank 3 over integers
julia> m = M([ZZ(1), ZZ(2), ZZ(3)])
Expand All @@ -94,7 +94,7 @@ image(::Map(FPModuleHomomorphism))
```

```julia
M = FreeModule(ZZ, 3)
M = free_module(ZZ, 3)

m = M([ZZ(1), ZZ(2), ZZ(3)])

Expand All @@ -112,7 +112,7 @@ preimage(::Map(FPModuleHomomorphism), ::FPModuleElem{T}) where T <: RingElement
```

```julia
M = FreeModule(ZZ, 3)
M = free_module(ZZ, 3)

m = M([ZZ(1), ZZ(2), ZZ(3)])

Expand All @@ -134,7 +134,7 @@ Base.inv(::Map(Generic.ModuleIsomorphism))
```

```julia
M = FreeModule(ZZ, 2)
M = free_module(ZZ, 2)
N = matrix(ZZ, 2, 2, BigInt[1, 0, 0, 1])
f = ModuleIsomorphism(M, M, N)

Expand Down
8 changes: 4 additions & 4 deletions docs/src/quotient_module.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ properties.
**Examples**

```jldoctest
julia> M = FreeModule(ZZ, 2)
julia> M = free_module(ZZ, 2)
Free module of rank 2 over integers
julia> m = M([ZZ(1), ZZ(2)])
Expand All @@ -59,7 +59,7 @@ julia> p = M([ZZ(3), ZZ(1)])
julia> v2 = g(p)
(-5)
julia> V = VectorSpace(QQ, 2)
julia> V = vector_space(QQ, 2)
Vector space of dimension 2 over rationals
julia> m = V([QQ(1), QQ(2)])
Expand Down Expand Up @@ -91,7 +91,7 @@ dim(N::Generic.QuotientModule{T}) where T <: FieldElement
**Examples**

```jldoctest
julia> M = FreeModule(ZZ, 2)
julia> M = free_module(ZZ, 2)
Free module of rank 2 over integers
julia> m = M([ZZ(2), ZZ(3)])
Expand All @@ -108,7 +108,7 @@ julia> Q, h = quo(M, N)
julia> supermodule(Q) == M
true
julia> V = VectorSpace(QQ, 2)
julia> V = vector_space(QQ, 2)
Vector space of dimension 2 over rationals
julia> m = V([QQ(1), QQ(2)])
Expand Down
10 changes: 5 additions & 5 deletions docs/src/submodule.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ canonical injection is injective, this is unique.
**Examples**

```jldoctest
julia> M = FreeModule(ZZ, 2)
julia> M = free_module(ZZ, 2)
Free module of rank 2 over integers
julia> m = M([ZZ(1), ZZ(2)])
Expand All @@ -62,7 +62,7 @@ julia> v = N([ZZ(3), ZZ(4)])
julia> v2 = f(v)
(3, 26)
julia> V = VectorSpace(QQ, 2)
julia> V = vector_space(QQ, 2)
Vector space of dimension 2 over rationals
julia> m = V([QQ(1), QQ(2)])
Expand Down Expand Up @@ -102,7 +102,7 @@ dim(N::Generic.Submodule{T}) where T <: FieldElement
**Examples**

```jldoctest
julia> M = FreeModule(ZZ, 2)
julia> M = free_module(ZZ, 2)
Free module of rank 2 over integers
julia> m = M([ZZ(2), ZZ(3)])
Expand All @@ -127,7 +127,7 @@ julia> is_submodule(N1, M)
false
julia> V = VectorSpace(QQ, 2)
julia> V = vector_space(QQ, 2)
Vector space of dimension 2 over rationals
julia> m = V([QQ(2), QQ(3)])
Expand All @@ -154,7 +154,7 @@ T <: RingElement
**Examples**

```jldoctest
julia> M = FreeModule(ZZ, 2)
julia> M = free_module(ZZ, 2)
Free module of rank 2 over integers
julia> m = M([ZZ(2), ZZ(3)])
Expand Down
2 changes: 0 additions & 2 deletions src/AbstractAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,6 @@ export fit!
export fraction_field
export free_associative_algebra
export free_module
export FreeModule
export function_field
export gcd
export gcd_with_cofactors
Expand Down Expand Up @@ -1127,7 +1126,6 @@ export var
export var_index
export vars
export vector_space
export VectorSpace
export with_unicode
export weak_popov
export weak_popov_with_transform
Expand Down
2 changes: 2 additions & 0 deletions src/Aliases.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@alias FreeModule free_module
@alias VectorSpace vector_space
12 changes: 2 additions & 10 deletions src/FreeModule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,10 @@
###############################################################################

@doc raw"""
FreeModule(R::NCRing, rank::Int; cached::Bool = true)
free_module(R::NCRing, rank::Int; cached::Bool = true)
Return the free module over the ring $R$ with the given rank.
"""
function FreeModule(R::NCRing, rank::Int; cached::Bool = true)
return Generic.FreeModule(R, rank, cached=cached)
end

function free_module(R::NCRing, rank::Int; cached::Bool = true)
return Generic.FreeModule(R, rank; cached=cached)
end
Expand All @@ -30,14 +26,10 @@ end
###############################################################################

@doc raw"""
VectorSpace(R::Field, dim::Int; cached::Bool = true)
vector_space(R::Field, dim::Int; cached::Bool = true)
Return the vector space over the field $R$ with the given dimension.
"""
function VectorSpace(R::Field, dim::Int; cached::Bool = true)
Generic.FreeModule(R, dim; cached=cached)
end

function vector_space(R::Field, dim::Int; cached::Bool = true)
Generic.FreeModule(R, dim; cached=cached)
end
2 changes: 2 additions & 0 deletions test/Groups-conformance-tests.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# TODO: add acknowledgements for GroupsCore

function test_Group_interface(G::Group)
@testset "Group interface" begin
# @testset "Iteration protocol" begin
Expand Down
2 changes: 1 addition & 1 deletion test/Modules-test.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function rand_module(R::AbstractAlgebra.Ring, vals...)
rk = rand(0:5)
M = FreeModule(R, rk)
M = free_module(R, rk)
levels = rand(0:3)
for i = 1:levels
if ngens(M) == 0
Expand Down
6 changes: 3 additions & 3 deletions test/generic/DirectSum-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
end
end

F = FreeModule(ZZ, 2)
F = free_module(ZZ, 2)
m = F(BigInt[1, 0])
n = F(BigInt[0, 1])
S, f = sub(F, [m, n])
Expand All @@ -19,7 +19,7 @@

@test isa(m, Generic.DirectSumModuleElem)

F = FreeModule(QQ,2)
F = free_module(QQ,2)
D, inj, pro = direct_sum(F, F)
f = D([gen(F, 1), gen(F,2)])
@test gen(D, 1) == D[1]
Expand Down Expand Up @@ -60,7 +60,7 @@ end
end
end

F = FreeModule(QQ, 2)
F = free_module(QQ, 2)
D, _ = direct_sum(F, F)
p = ModuleHomomorphism(F, F, [1, 2] .* gens(F))
q = ModuleHomomorphism(F, F, [3, 4] .* gens(F))
Expand Down
Loading

0 comments on commit 4546165

Please sign in to comment.