From ab145815f37ac080dfc152dc95abf4fe56356593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Fri, 19 Apr 2024 21:00:47 +0200 Subject: [PATCH] =?UTF-8?q?Revert=20"Revert=20"QQBar:=20construct=20from?= =?UTF-8?q?=20any=20Integer=20or=20Complex=20value=20(#1702)"=20(=E2=80=A6?= =?UTF-8?q?"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 52e8e07f0f6ec7fe858877fbf48be01d8b4b86d5. --- src/calcium/qqbar.jl | 16 ++++------------ test/calcium/qqbar-test.jl | 6 ++++++ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/calcium/qqbar.jl b/src/calcium/qqbar.jl index 0f23a7b0b..4fd921fcf 100644 --- a/src/calcium/qqbar.jl +++ b/src/calcium/qqbar.jl @@ -50,7 +50,7 @@ function QQBarFieldElem(a::Int) return z end -function QQBarFieldElem(a::Complex{Int}) +function QQBarFieldElem(a::Complex) r = QQBarFieldElem(real(a)) s = QQBarFieldElem(imag(a)) z = QQBarFieldElem() @@ -75,6 +75,8 @@ end QQBarFieldElem(a::Rational) = QQBarFieldElem(QQFieldElem(a)) +QQBarFieldElem(a::Integer) = QQBarFieldElem(ZZRingElem(a)) + function deepcopy_internal(a::QQBarFieldElem, dict::IdDict) z = QQBarFieldElem() ccall((:qqbar_set, libcalcium), Nothing, (Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, a) @@ -1518,17 +1520,7 @@ end (a::QQBarField)() = QQBarFieldElem() -(a::QQBarField)(b::Int) = QQBarFieldElem(b) - -(a::QQBarField)(b::Complex{Int}) = QQBarFieldElem(b) - -(a::QQBarField)(b::ZZRingElem) = QQBarFieldElem(b) - -(a::QQBarField)(b::Integer) = QQBarFieldElem(ZZRingElem(b)) - -(a::QQBarField)(b::Rational) = QQBarFieldElem(b) - -(a::QQBarField)(b::QQFieldElem) = QQBarFieldElem(b) +(a::QQBarField)(b::Any) = QQBarFieldElem(b) (a::QQBarField)(b::QQBarFieldElem) = b diff --git a/test/calcium/qqbar-test.jl b/test/calcium/qqbar-test.jl index 0db92cff3..3e61cf111 100644 --- a/test/calcium/qqbar-test.jl +++ b/test/calcium/qqbar-test.jl @@ -14,19 +14,25 @@ @test isa(R(), QQBarFieldElem) @test isa(R(2), QQBarFieldElem) + @test isa(R(big(2)), QQBarFieldElem) @test isa(R(2+3im), QQBarFieldElem) + @test isa(R(big(2)+3im), QQBarFieldElem) @test isa(R(ZZRingElem(2)), QQBarFieldElem) @test isa(R(QQFieldElem(2)), QQBarFieldElem) @test isa(R(QQBarFieldElem(2)), QQBarFieldElem) @test isa(R(1//2), QQBarFieldElem) + @test isa(R(big(1)//2), QQBarFieldElem) @test R(1//2) == R(QQ(1//2)) @test isa(QQBarFieldElem(), QQBarFieldElem) @test isa(QQBarFieldElem(2), QQBarFieldElem) + @test isa(QQBarFieldElem(big(2)), QQBarFieldElem) @test isa(QQBarFieldElem(2+3im), QQBarFieldElem) + @test isa(QQBarFieldElem(big(2)+3im), QQBarFieldElem) @test isa(QQBarFieldElem(ZZRingElem(2)), QQBarFieldElem) @test isa(QQBarFieldElem(QQFieldElem(2)), QQBarFieldElem) @test isa(QQBarFieldElem(1//2), QQBarFieldElem) + @test isa(QQBarFieldElem(big(1)//2), QQBarFieldElem) @test QQBarFieldElem(1//2) == QQBarFieldElem(QQ(1//2)) x = R(1)