1
0
mirror of https://github.com/kalmarek/GroupRings.jl.git synced 2024-12-28 02:40:28 +01:00

use Base.one instead of (::Group)()

This commit is contained in:
kalmarek 2019-11-19 11:30:29 +01:00
parent ce6ef70d55
commit 9225d2153f
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
2 changed files with 10 additions and 10 deletions

View File

@ -53,7 +53,7 @@ mutable struct GroupRingElem{T, A<:AbstractVector, GR<:GroupRing} <: NCRingElem
"Can't create GroupRingElem -- lengths differ: length(c) =
$(length(c)) != $(length(RG.basis)) = length(RG.basis)")
else
@warn("Basis of the GroupRing is not defined.")
# @warn("Basis of the GroupRing is not defined.")
end
end
return new{T, A, GR}(c, RG)
@ -114,7 +114,7 @@ end
# sparse storage:
zero(RG::GroupRing, T::Type=Int) = RG(T)
one(RG::GroupRing, T::Type=Int) = RG(RG.group(), T)
one(RG::GroupRing, T::Type=Int) = RG(one(RG.group), T)
one(RG::GroupRing{<:AbstractAlgebra.NCRing}, T::Type=Int) = RG(one(RG.group), T)
function (RG::GroupRing)(T::Type=Int)
@ -124,7 +124,7 @@ end
function (RG::GroupRing)(i::Int, T::Type=Int)
elt = RG(T)
elt[RG.group()] = i
elt[one(RG.group)] = i
return elt
end
@ -229,7 +229,7 @@ function show(io::IO, X::GroupRingElem)
RG = parent(X)
T = eltype(X.coeffs)
if X.coeffs == zero(X.coeffs)
print(io, "$(zero(T))*$((RG.group)())")
print(io, "$(zero(T))*$(one(RG.group))")
elseif isdefined(RG, :basis)
non_zeros = ((X.coeffs[i], RG.basis[i]) for i in findall(!iszero, X.coeffs))
elts = String[]

View File

@ -49,7 +49,7 @@ using SparseArrays
S = gens(F)
append!(S, [inv(s) for s in S])
basis, sizes = Groups.generate_balls(S, F(), radius=4)
basis, sizes = Groups.generate_balls(S, one(F), radius=4)
d = GroupRings.reverse_dict(basis)
@test_throws KeyError create_pm(basis)
pm = create_pm(basis, d, sizes[2])
@ -67,7 +67,7 @@ using SparseArrays
GroupRings.complete!(RF)
@test count(!iszero, RF.pm) == 45469
g = B()
g = zero(B)
s = S[2]
g[s] = 1
@test g == B(s)
@ -217,7 +217,7 @@ using SparseArrays
@test aug(z) == 0
@test supp(z) == parent(z).basis
@test supp(RG(1) + RG(perm"(2,3)")) == [G(), perm"(2,3)"]
@test supp(RG(1) + RG(perm"(2,3)")) == [one(G), perm"(2,3)"]
@test supp(a) == [perm"(3)", perm"(2,3)", perm"(1,2,3)"]
end
@ -228,8 +228,8 @@ using SparseArrays
RG = GroupRing(G, cachedmul=true)
RG2 = GroupRing(G, cachedmul=false)
Z = RG()
W = RG()
Z = zero(RG)
W = zero(RG)
for g in [rand(G) for _ in 1:30]
X = RG(g)
@ -258,7 +258,7 @@ using SparseArrays
S = G.(G.gens)
S = [S; inv.(S)]
ID = G()
ID = one(G)
RADIUS=3
@time E_R, sizes = Groups.generate_balls(S, ID, radius=2*RADIUS);
@test sizes == [9, 65, 457, 3201, 22409, 156865]