1
0
mirror of https://github.com/kalmarek/GroupRings.jl.git synced 2024-11-19 06:30:27 +01:00

migrate to AbstractAlgebra

This commit is contained in:
kalmarek 2018-07-27 00:23:19 +02:00
parent c59b350600
commit 9a4038e2da
2 changed files with 10 additions and 10 deletions

View File

@ -1,8 +1,8 @@
__precompile__() __precompile__()
module GroupRings module GroupRings
using Nemo using AbstractAlgebra
import Nemo: Group, GroupElem, Ring, RingElem, parent, elem_type, parent_type, mul!, addeq!, divexact import AbstractAlgebra: Group, GroupElem, Ring, RingElem, parent, elem_type, parent_type, mul!, addeq!, divexact
import Base: convert, show, hash, ==, +, -, *, //, /, length, norm, rationalize, deepcopy_internal, getindex, setindex!, eltype, one, zero import Base: convert, show, hash, ==, +, -, *, //, /, length, norm, rationalize, deepcopy_internal, getindex, setindex!, eltype, one, zero
@ -119,7 +119,7 @@ end
zero(RG::GroupRing, T::Type=Int) = RG(T) 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(RG.group(), T)
one(RG::GroupRing{R}, T::Type=Int) where {R<:Nemo.Ring} = RG(one(RG.group()), T) one(RG::GroupRing{R}, T::Type=Int) where {R<:Ring} = RG(one(RG.group()), T)
function (RG::GroupRing)(i::Int, T::Type=Int) function (RG::GroupRing)(i::Int, T::Type=Int)
elt = RG(T) elt = RG(T)
@ -153,7 +153,7 @@ function (RG::GroupRing){T<:Number}(x::AbstractVector{T})
return result return result
end end
function (RG::GroupRing{Gr,T}){Gr<:Nemo.Group, T<:Nemo.GroupElem}(V::Vector{T}, function (RG::GroupRing{Gr,T}){Gr<:Group, T<:GroupElem}(V::Vector{T},
S::Type=Rational{Int}; alt=false) S::Type=Rational{Int}; alt=false)
res = RG(S) res = RG(S)
for g in V for g in V
@ -295,8 +295,8 @@ end
(*)(a, X::GroupRingElem) = mul(a,X) (*)(a, X::GroupRingElem) = mul(a,X)
(*)(X::GroupRingElem, a) = mul(a,X) (*)(X::GroupRingElem, a) = mul(a,X)
# disallow Nemo.Rings to hijack *(::, ::GroupRingElem) # disallow Rings to hijack *(::, ::GroupRingElem)
*(a::Union{AbstractFloat, Integer, Nemo.RingElem, Rational}, X::GroupRingElem) = mul(a,X) *(a::Union{AbstractFloat, Integer, RingElem, Rational}, X::GroupRingElem) = mul(a,X)
(/)(X::GroupRingElem, a) = 1/a*X (/)(X::GroupRingElem, a) = 1/a*X
@ -526,7 +526,7 @@ function reverse_dict(::Type{I}, iter) where I<:Integer
return Dict{eltype(iter), I}(x => i for (i,x) in enumerate(iter)) return Dict{eltype(iter), I}(x => i for (i,x) in enumerate(iter))
end end
reverse_dict(iter) = reverse_dict(UInt, iter) reverse_dict(iter) = reverse_dict(Int, iter)
function create_pm{T<:GroupElem}(basis::Vector{T}, basis_dict::Dict{T, Int}, function create_pm{T<:GroupElem}(basis::Vector{T}, basis_dict::Dict{T, Int},
limit::Int=length(basis); twisted::Bool=false, check=true) limit::Int=length(basis); twisted::Bool=false, check=true)

View File

@ -1,13 +1,13 @@
using GroupRings
using Base.Test using Base.Test
using Nemo using AbstractAlgebra
using GroupRings
@testset "GroupRings" begin @testset "GroupRings" begin
@testset "Constructors: PermutationGroup" begin @testset "Constructors: PermutationGroup" begin
G = PermutationGroup(3) G = PermutationGroup(3)
@test isa(GroupRing(G), Nemo.Ring) @test isa(GroupRing(G), AbstractAlgebra.Ring)
@test isa(GroupRing(G), GroupRing) @test isa(GroupRing(G), GroupRing)
RG = GroupRing(G) RG = GroupRing(G)