mirror of
https://github.com/kalmarek/GroupRings.jl.git
synced 2024-10-17 00:15:35 +02:00
fix indentation to 3 spaces (Nemo-like)
This commit is contained in:
parent
bb28b1bc54
commit
ab1e827fb0
@ -151,13 +151,12 @@ end
|
|||||||
|
|
||||||
(-)(X::GroupRingElem) = GroupRingElem(-X.coeffs, parent(X))
|
(-)(X::GroupRingElem) = GroupRingElem(-X.coeffs, parent(X))
|
||||||
|
|
||||||
(*){T<:Number}(a::T, X::GroupRingElem{T}) = GroupRingElem(
|
(*){T<:Number}(a::T, X::GroupRingElem{T}) = GroupRingElem(a*X.coeffs, parent(X))
|
||||||
a*X.coeffs, parent(X))
|
|
||||||
|
|
||||||
function scalar_multiplication{T<:Number, S<:Number}(a::T,
|
function scalar_multiplication{T<:Number, S<:Number}(a::T,
|
||||||
X::GroupRingElem{S})
|
X::GroupRingElem{S})
|
||||||
promote_type(T,S) == S || warn("Scalar and coeffs are in different rings! Promoting result to $(promote_type(T,S))")
|
promote_type(T,S) == S || warn("Scalar and coeffs are in different rings! Promoting result to $(promote_type(T,S))")
|
||||||
return GroupRingElem(a*X.coeffs, parent(X))
|
return GroupRingElem(a*X.coeffs, parent(X))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -166,10 +165,10 @@ end
|
|||||||
(/){T<:Number}(a::T, X::GroupRingElem) = scalar_multiplication(1/a, X)
|
(/){T<:Number}(a::T, X::GroupRingElem) = scalar_multiplication(1/a, X)
|
||||||
|
|
||||||
(//){T<:Rational, S<:Rational}(X::GroupRingElem{T}, a::S) =
|
(//){T<:Rational, S<:Rational}(X::GroupRingElem{T}, a::S) =
|
||||||
GroupRingElem(X.coeffs//a, parent(X))
|
GroupRingElem(X.coeffs//a, parent(X))
|
||||||
|
|
||||||
(//){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)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#
|
#
|
||||||
@ -178,35 +177,36 @@ end
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
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(
|
||||||
"Elements don't seem to belong to the same Group Algebra!"))
|
"Elements don't seem to belong to the same Group Algebra!"))
|
||||||
return GroupRingElem(X.coeffs+Y.coeffs, parent(X))
|
return GroupRingElem(X.coeffs+Y.coeffs, parent(X))
|
||||||
end
|
end
|
||||||
|
|
||||||
function add{T<:Number, S<:Number}(X::GroupRingElem{T},
|
function add{T<:Number, S<:Number}(X::GroupRingElem{T},
|
||||||
Y::GroupRingElem{S})
|
Y::GroupRingElem{S})
|
||||||
parent(X) == parent(Y) || throw(ArgumentError(
|
parent(X) == parent(Y) || throw(ArgumentError(
|
||||||
"Elements don't seem to belong to the same Group Algebra!"))
|
"Elements don't seem to belong to the same Group Algebra!"))
|
||||||
warn("Adding elements with different base rings!")
|
warn("Adding elements with different base rings!")
|
||||||
return GroupRingElem(+(promote(X.coeffs, Y.coeffs)...), parent(X))
|
return GroupRingElem(+(promote(X.coeffs, Y.coeffs)...), parent(X))
|
||||||
end
|
end
|
||||||
|
|
||||||
(+)(X::GroupRingElem, Y::GroupRingElem) = add(X,Y)
|
(+)(X::GroupRingElem, Y::GroupRingElem) = add(X,Y)
|
||||||
(-)(X::GroupRingElem, Y::GroupRingElem) = add(X,-Y)
|
(-)(X::GroupRingElem, Y::GroupRingElem) = add(X,-Y)
|
||||||
|
|
||||||
function algebra_multiplication{T<:Number}(X::AbstractVector{T}, Y::AbstractVector{T}, pm::Array{Int,2})
|
function algebra_multiplication{T<:Number}(X::AbstractVector{T},
|
||||||
result = zeros(X)
|
Y::AbstractVector{T}, pm::Array{Int,2})
|
||||||
for (j,y) in enumerate(Y)
|
result = zeros(X)
|
||||||
if y != zero(T)
|
for (j,y) in enumerate(Y)
|
||||||
for (i, index) in enumerate(pm[:,j])
|
if y != zero(T)
|
||||||
if X[i] != zero(T)
|
for (i, index) in enumerate(pm[:,j])
|
||||||
index == 0 && throw(ArgumentError("The product don't seem to belong to the span of basis!"))
|
if X[i] != zero(T)
|
||||||
result[index] += X[i]*y
|
index == 0 && throw(ArgumentError("The product don't seem to belong to the span of basis!"))
|
||||||
end
|
result[index] += X[i]*y
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return result
|
end
|
||||||
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
function group_star_multiplication{T<:Number}(X::GroupRingElem{T},
|
function group_star_multiplication{T<:Number}(X::GroupRingElem{T},
|
||||||
|
Loading…
Reference in New Issue
Block a user