mirror of
https://github.com/kalmarek/GroupRings.jl.git
synced 2025-01-01 03:40:29 +01:00
Headers
This commit is contained in:
parent
d919826e49
commit
b51eb71d56
@ -7,6 +7,11 @@ import Base: convert, show, isequal, ==
|
|||||||
import Base: +, -, *, //
|
import Base: +, -, *, //
|
||||||
import Base: size, length, norm, rationalize
|
import Base: size, length, norm, rationalize
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# GroupRings / GroupRingsElem
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
type GroupRing <: Ring
|
type GroupRing <: Ring
|
||||||
group::Group
|
group::Group
|
||||||
@ -28,6 +33,11 @@ end
|
|||||||
|
|
||||||
export GroupRing, GroupRingElem
|
export GroupRing, GroupRingElem
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Type and parent object methods
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
elem_type(::GroupRing) = GroupRingElem
|
elem_type(::GroupRing) = GroupRingElem
|
||||||
|
|
||||||
@ -35,6 +45,11 @@ parent_type(::GroupRingElem) = GroupRing
|
|||||||
|
|
||||||
parent(g::GroupRingElem) = g.parent
|
parent(g::GroupRingElem) = g.parent
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# GroupRing / GroupRingElem constructors
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
GroupRingElem{T}(c::AbstractVector{T}, A::GroupRing) = GroupRingElem{T}(c,A)
|
GroupRingElem{T}(c::AbstractVector{T}, A::GroupRing) = GroupRingElem{T}(c,A)
|
||||||
|
|
||||||
@ -63,6 +78,11 @@ function GroupRing(G::Group; complete=false)
|
|||||||
return A
|
return A
|
||||||
end
|
end
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Parent object call overloads
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
function (A::GroupRing)(X::GroupRingElem)
|
function (A::GroupRing)(X::GroupRingElem)
|
||||||
length(X) == length(A.basis) || throw("Can not coerce to $A: lengths differ")
|
length(X) == length(A.basis) || throw("Can not coerce to $A: lengths differ")
|
||||||
@ -75,6 +95,11 @@ function (A::GroupRing)(x::AbstractVector)
|
|||||||
return GroupRingElem(x, A)
|
return GroupRingElem(x, A)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Basic manipulation
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
function deepcopy_internal(X::GroupRingElem, dict::ObjectIdDict)
|
function deepcopy_internal(X::GroupRingElem, dict::ObjectIdDict)
|
||||||
return GroupRingElem(deepcopy(X.coeffs), parent(X))
|
return GroupRingElem(deepcopy(X.coeffs), parent(X))
|
||||||
@ -84,6 +109,12 @@ function hash(X::GroupRingElem, h::UInt)
|
|||||||
return hash(X.coeffs, hash(parent(X), h))
|
return hash(X.coeffs, hash(parent(X), h))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# String I/O
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
function show(io::IO, A::GroupRing)
|
function show(io::IO, A::GroupRing)
|
||||||
print(io, "GroupRing of $(A.group)")
|
print(io, "GroupRing of $(A.group)")
|
||||||
end
|
end
|
||||||
@ -93,6 +124,11 @@ function show(io::IO, X::GroupRingElem)
|
|||||||
print(io, "Element of Group Algebra of $(parent(X)) over $T:\n $(X.coeffs)")
|
print(io, "Element of Group Algebra of $(parent(X)) over $T:\n $(X.coeffs)")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Comparison
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
function (==)(X::GroupRingElem, Y::GroupRingElem)
|
function (==)(X::GroupRingElem, Y::GroupRingElem)
|
||||||
parent(X) == parent(Y) || return false
|
parent(X) == parent(Y) || return false
|
||||||
@ -107,6 +143,11 @@ function (==)(A::GroupRing, B::GroupRing)
|
|||||||
return A.group == B.group
|
return A.group == B.group
|
||||||
end
|
end
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Scalar operators
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
(-)(X::GroupRingElem) = GroupRingElem(-X.coeffs, parent(X))
|
(-)(X::GroupRingElem) = GroupRingElem(-X.coeffs, parent(X))
|
||||||
|
|
||||||
@ -129,6 +170,11 @@ end
|
|||||||
(//){T<:Rational, S<:Integer}(X::GroupRingElem{T}, a::S) =
|
(//){T<:Rational, S<:Integer}(X::GroupRingElem{T}, a::S) =
|
||||||
X//convert(T,a)
|
X//convert(T,a)
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Binary operators
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
function add{T<:Number}(X::GroupRingElem{T}, Y::GroupRingElem{T})
|
function add{T<:Number}(X::GroupRingElem{T}, Y::GroupRingElem{T})
|
||||||
parent(X) == parent(Y) || throw(ArgumentError(
|
parent(X) == parent(Y) || throw(ArgumentError(
|
||||||
@ -178,6 +224,11 @@ end
|
|||||||
|
|
||||||
(*)(X::GroupRingElem, Y::GroupRingElem) = group_star_multiplication(X,Y)
|
(*)(X::GroupRingElem, Y::GroupRingElem) = group_star_multiplication(X,Y)
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
#
|
||||||
|
# Misc
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
length(X::GroupRingElem) = length(X.coeffs)
|
length(X::GroupRingElem) = length(X.coeffs)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user