1
0
mirror of https://github.com/kalmarek/GroupRings.jl.git synced 2024-12-28 18:50:29 +01:00

no warn on julia-1.0

This commit is contained in:
kalmarek 2018-10-01 10:57:55 +02:00
parent e8d8686831
commit 11e7b46806
2 changed files with 12 additions and 12 deletions

View File

@ -52,7 +52,7 @@ mutable struct GroupRingElem{T, A<:AbstractVector, GR<:GroupRing} <: RingElem
"Can't create GroupRingElem -- lengths differ: length(c) = "Can't create GroupRingElem -- lengths differ: length(c) =
$(length(c)) != $(length(RG.basis)) = length(RG.basis)") $(length(c)) != $(length(RG.basis)) = length(RG.basis)")
else else
warn("Basis of the GroupRing is not defined.") @warn("Basis of the GroupRing is not defined.")
end end
end end
return new{T, A, GR}(c, RG) return new{T, A, GR}(c, RG)
@ -236,7 +236,7 @@ function show(io::IO, X::GroupRingElem)
end end
print(io, str) print(io, str)
else else
warn("Basis of the parent Group is not defined, showing coeffs") @warn("Basis of the parent Group is not defined, showing coeffs")
show(io, MIME("text/plain"), X.coeffs) show(io, MIME("text/plain"), X.coeffs)
end end
end end
@ -249,7 +249,7 @@ end
function (==)(X::GroupRingElem, Y::GroupRingElem) function (==)(X::GroupRingElem, Y::GroupRingElem)
if eltype(X.coeffs) != eltype(Y.coeffs) if eltype(X.coeffs) != eltype(Y.coeffs)
warn("Comparing elements with different coeffs Rings!") @warn("Comparing elements with different coeffs Rings!")
end end
suppX = supp(X) suppX = supp(X)
suppX == supp(Y) || return false suppX == supp(Y) || return false
@ -289,7 +289,7 @@ end
mul(a::T, X::GroupRingElem{T}) where {T<:Number} = GroupRingElem(a*X.coeffs, parent(X)) mul(a::T, X::GroupRingElem{T}) where {T<:Number} = GroupRingElem(a*X.coeffs, parent(X))
function mul(a::T, X::GroupRingElem{S}) where {T<:Number, S<:Number} function mul(a::T, X::GroupRingElem{S}) where {T<:Number, S<:Number}
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
@ -318,14 +318,14 @@ function +(X::GroupRingElem{T}, Y::GroupRingElem{T}) where T
end end
function +(X::GroupRingElem{S}, Y::GroupRingElem{T}) where {S, T} function +(X::GroupRingElem{S}, Y::GroupRingElem{T}) where {S, T}
warn("Adding elements with different coefficient rings, Promoting result to $(promote_type(T,S))") @warn("Adding elements with different coefficient rings, Promoting result to $(promote_type(T,S))")
return GroupRingElem(X.coeffs+Y.coeffs, parent(X)) return GroupRingElem(X.coeffs+Y.coeffs, parent(X))
end end
-(X::GroupRingElem{T}, Y::GroupRingElem{T}) where T = addeq!((-Y), X) -(X::GroupRingElem{T}, Y::GroupRingElem{T}) where T = addeq!((-Y), X)
function -(X::GroupRingElem{S}, Y::GroupRingElem{T}) where {S, T} function -(X::GroupRingElem{S}, Y::GroupRingElem{T}) where {S, T}
warn("Adding elements with different coefficient rings, Promoting result to $(promote_type(T,S))") @warn("Adding elements with different coefficient rings, Promoting result to $(promote_type(T,S))")
addeq!((-Y), X) addeq!((-Y), X)
end end
@ -442,7 +442,7 @@ function *(X::GroupRingElem{T}, Y::GroupRingElem{S}, check::Bool=true) where {T<
end end
TT = typeof(first(X.coeffs)*first(Y.coeffs)) TT = typeof(first(X.coeffs)*first(Y.coeffs))
warn("Multiplying elements with different base rings! Promoting the result to $TT.") @warn("Multiplying elements with different base rings! Promoting the result to $TT.")
if isdefined(parent(X), :basis) if isdefined(parent(X), :basis)
result = parent(X)(similar(X.coeffs)) result = parent(X)(similar(X.coeffs))
@ -519,7 +519,7 @@ create_pm(b::Vector{T}) where {T<:GroupElem} = create_pm(b, reverse_dict(b))
function check_pm(product_matrix, basis, twisted=false) function check_pm(product_matrix, basis, twisted=false)
idx = findfirst(product_matrix' .== 0) idx = findfirst(product_matrix' .== 0)
if idx != nothing if idx != nothing
warn("Product is not supported on basis") @warn("Product is not supported on basis")
i,j = Tuple(idx) i,j = Tuple(idx)
x = basis[i] x = basis[i]
if twisted if twisted
@ -546,7 +546,7 @@ function complete!(RG::GroupRing)
end end
end end
end end
warning && warn("Some products were not supported on basis") warning && @warn("Some products were not supported on basis")
return RG return RG
end end

View File

@ -134,10 +134,10 @@ using SparseArrays
ww = "Scalar and coeffs are in different rings! Promoting result to Float64" ww = "Scalar and coeffs are in different rings! Promoting result to Float64"
@test isa(2.0*a, GroupRingElem) @test isa(2.0*a, GroupRingElem)
@test_warn ww eltype(2.0*a) == typeof(2.0) @test_logs (:warn, ww) eltype(2.0*a) == typeof(2.0)
@test_warn ww (2.0*a).coeffs == 2.0.*(a.coeffs) @test_logs (:warn, ww) (2.0*a).coeffs == 2.0.*(a.coeffs)
@test_warn ww (a/2).coeffs == a.coeffs./2 @test_logs (:warn, ww) (a/2).coeffs == a.coeffs./2
b = a/2 b = a/2
@test isa(b, GroupRingElem) @test isa(b, GroupRingElem)
@test eltype(b) == typeof(1/2) @test eltype(b) == typeof(1/2)