1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-08-08 07:53:53 +02:00

fix problems with importing ×

This commit is contained in:
kalmarek 2018-09-21 18:36:13 +02:00
parent 46e2dc5faf
commit fbc4d8aec7

View File

@ -1,5 +1,3 @@
import Base: ×
export DirectProductGroup, DirectProductGroupElem export DirectProductGroup, DirectProductGroupElem
export MultiplicativeGroup, MltGrp, MltGrpElem export MultiplicativeGroup, MltGrp, MltGrpElem
export AdditiveGroup, AddGrp, AddGrpElem export AdditiveGroup, AddGrp, AddGrpElem
@ -163,27 +161,23 @@ end
# #
############################################################################### ###############################################################################
function ×(G::Group, H::Group) function pow(G::Group, H::Group)
G == H || throw(DomainError( G == H || throw(DomainError(
"Direct Powers are defined only for the same groups")) "Direct Powers are defined only for the same groups"))
return DirectProductGroup(G,2) return DirectProductGroup(G,2)
end end
×(H::Group, G::DirectProductGroup) = G×H pow(H::Group, G::DirectProductGroup) = pow(G,H)
function ×(G::DirectProductGroup, H::Group) function pow(G::DirectProductGroup, H::Group)
G.group == H || throw(DomainError( G.group == H || throw(DomainError(
"Direct products are defined only for the same groups")) "Direct products are defined only for the same groups"))
return DirectProductGroup(G.group,G.n+1) return DirectProductGroup(G.group,G.n+1)
end end
DirectProductGroup(R::T, n::Int) where {T<:AbstractAlgebra.Ring} = function pow(R::T, n::Int) where {T<:AbstractAlgebra.Ring}
DirectProductGroup(AdditiveGroup(R), n) @warn "Creating DirectProduct of the multilplicative group!"
return DirectProductGroup(R, n)
function ×(G::DirectProductGroup{T}, H::Group) where T <: Union{AdditiveGroup, MultiplicativeGroup}
G.group == T(H) || throw(DomainError(
"Direct products are defined only for the same groups"))
return DirectProductGroup(G.group,G.n+1)
end end
############################################################################### ###############################################################################