Skip to content

Commit

Permalink
Merge branch 'master' into lg/QQBar-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens authored Apr 19, 2024
2 parents 3d360df + 52e8e07 commit 4840974
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
16 changes: 12 additions & 4 deletions src/calcium/qqbar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function QQBarFieldElem(a::Int)
return z
end

function QQBarFieldElem(a::Complex)
function QQBarFieldElem(a::Complex{Int})
r = QQBarFieldElem(real(a))
s = QQBarFieldElem(imag(a))
z = QQBarFieldElem()
Expand All @@ -75,8 +75,6 @@ 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)
Expand Down Expand Up @@ -1526,7 +1524,17 @@ end

(a::QQBarField)() = QQBarFieldElem()

(a::QQBarField)(b::Any) = QQBarFieldElem(b)
(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::QQBarFieldElem) = b

Expand Down
2 changes: 1 addition & 1 deletion src/flint/fq_nmod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ function (a::fqPolyRepField)(b::Vector{<:IntegerUnion})
da = degree(a)
db = length(b)
da == db || error("Coercion impossible")
F = GF(Int(characteristic(a)), cached = false)
F = Native.GF(Int(characteristic(a)), cached = false)
z = fqPolyRepFieldElem(a, polynomial(F, b))
z.parent = a
return z
Expand Down
5 changes: 5 additions & 0 deletions test/Native-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,9 @@

@test Native.GF(2, 2) isa fqPolyRepField
@test Native.GF(ZZ(2), 2) isa FqPolyRepField

F2 = Native.GF(2, cached = false)
@test F2([1]) == one(F2)
F4 = Native.GF(2, 2)
@test F4([1, 0]) == one(F4)
end
6 changes: 0 additions & 6 deletions test/calcium/qqbar-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,19 @@

@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)
Expand Down

0 comments on commit 4840974

Please sign in to comment.