1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-11-19 14:35:28 +01: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 str::String
pow::Int pow::Int
ex::Expr ex::Expr
func::Function func::Function
end end
typealias AutGroupElem GWord{AutSymbol} @compat AutGroupElem = GWord{AutSymbol}
type AutGroup <: AbstractFPGroup @compat mutable struct AutGroup <: AbstractFPGroup
objectGroup::Group objectGroup::Group
gens::Vector{AutSymbol} gens::Vector{AutSymbol}
end end

View File

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

View File

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

View File

@ -1,4 +1,5 @@
module Groups module Groups
using Compat
using Nemo using Nemo
import Nemo: Group, GroupElem, Ring import Nemo: Group, GroupElem, Ring
@ -24,7 +25,7 @@ doc"""
> * `pow` which is the (multiplicative) exponent of a symbol. > * `pow` which is the (multiplicative) exponent of a symbol.
""" """
abstract GSymbol abstract type GSymbol end
doc""" doc"""
W::GWord{T<:GSymbol} <:GroupElem 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} symbols::Vector{T}
savedhash::UInt savedhash::UInt
modified::Bool 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) function hash(W::GWord, h::UInt)
W.modified && reduce!(W) W.modified && reduce!(W)
return xor(W.savedhash, h) @compat res = xor(W.savedhash, h)
return res
end end
function deepcopy_internal{T<:GSymbol}(W::GWord{T}, dict::ObjectIdDict) function deepcopy_internal{T<:GSymbol}(W::GWord{T}, dict::ObjectIdDict)