1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-10-15 07:20:35 +02:00

use @compat for types, etc

This commit is contained in:
kalmar 2017-07-06 09:22:56 +02:00
parent 4bb3c9df4f
commit 02c1022846
4 changed files with 14 additions and 13 deletions

View File

@ -4,16 +4,16 @@
#
###############################################################################
immutable AutSymbol <: GSymbol
@compat struct AutSymbol <: GSymbol
str::String
pow::Int
ex::Expr
func::Function
end
typealias AutGroupElem GWord{AutSymbol}
@compat AutGroupElem = GWord{AutSymbol}
type AutGroup <: AbstractFPGroup
@compat mutable struct AutGroup <: AbstractFPGroup
objectGroup::Group
gens::Vector{AutSymbol}
end

View File

@ -4,14 +4,14 @@
#
###############################################################################
immutable FPSymbol <: GSymbol
@compat struct FPSymbol <: GSymbol
str::String
pow::Int
end
typealias FPGroupElem = GWord{FPSymbol}
@compat FPGroupElem = GWord{FPSymbol}
type FPGroup <: AbstractFPGroup
@compat mutable struct FPGroup <: AbstractFPGroup
gens::Vector{FPSymbol}
rels::Dict{FPGroupElem, FPGroupElem}

View File

@ -4,14 +4,14 @@
#
###############################################################################
immutable FreeSymbol <: GSymbol
@compat struct FreeSymbol <: GSymbol
str::String
pow::Int
end
typealias FreeGroupElem GWord{FreeSymbol}
@compat FreeGroupElem = GWord{FreeSymbol}
type FreeGroup <: AbstractFPGroup
@compat mutable struct FreeGroup <: AbstractFPGroup
gens::Vector{FreeSymbol}
# order::Vector{T}
# fastmult_table::Array{Int,2}

View File

@ -1,4 +1,5 @@
module Groups
using Compat
using Nemo
import Nemo: Group, GroupElem, Ring
@ -24,7 +25,7 @@ doc"""
> * `pow` which is the (multiplicative) exponent of a symbol.
"""
abstract GSymbol
abstract type GSymbol end
doc"""
W::GWord{T<:GSymbol} <:GroupElem
@ -42,7 +43,7 @@ doc"""
"""
type GWord{T<:GSymbol} <: GroupElem
@compat mutable struct GWord{T<:GSymbol} <: GroupElem
symbols::Vector{T}
savedhash::UInt
modified::Bool
@ -78,11 +79,11 @@ convert{T<:GSymbol}(::Type{GWord{T}}, s::T) = GWord{T}(T[s])
#
###############################################################################
xor(a,b) = a $ b
function hash(W::GWord, h::UInt)
W.modified && reduce!(W)
return xor(W.savedhash, h)
@compat res = xor(W.savedhash, h)
return res
end
function deepcopy_internal{T<:GSymbol}(W::GWord{T}, dict::ObjectIdDict)