Skip to content

Commit

Permalink
feat: extend methods for complex_conjugation (#1426)
Browse files Browse the repository at this point in the history
- Allow arbitrary NumField
- Allow totally real fields
- Allow QQ
  • Loading branch information
thofma authored Mar 2, 2024
1 parent c2792d8 commit cc0a2d8
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Hecke"
uuid = "3e1990a7-5d81-5526-99ce-9ba3ff248f21"
version = "0.30.1"
version = "0.30.2"

[deps]
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
Expand Down
13 changes: 13 additions & 0 deletions src/NumField/ComplexEmbeddings/Generic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -488,3 +488,16 @@ function _log_evaluate_fac_elem(e, x, prec)
end
return z
end

################################################################################
#
# Complex conjugation
#
################################################################################

function complex_conjugation(K::NumField)
L, f = absolute_simple_field(K)
g = inv(f)
conj = complex_conjugation(L)
return compose(compose(g, conj), f)
end
2 changes: 2 additions & 0 deletions src/NumField/ComplexEmbeddings/QQ.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,5 @@ sign(x::Union{ZZRingElem, FacElem{QQFieldElem}}, ::QQEmb) = sign(Int, x)
signs(x::Union{ZZRingElem, QQFieldElem, FacElem{QQFieldElem}}, ::Vector{QQEmb}) = Dict(QQEmb() => sign(x, QQEmb()))

signs(x::Union{ZZRingElem, QQFieldElem, FacElem{QQFieldElem}}) = Dict(QQEmb() => sign(x, QQEmb()))

complex_conjugation(K::QQField) = identity_map(K)
3 changes: 3 additions & 0 deletions src/NumField/NfAbs/Conjugates.jl
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,9 @@ Given a totally complex normal number field, this function returns an
automorphism which is the restriction of complex conjugation at one embedding.
"""
function complex_conjugation(K::AbsSimpleNumField; auts::Vector{<:NumFieldHom{AbsSimpleNumField, AbsSimpleNumField}} = morphism_type(AbsSimpleNumField, AbsSimpleNumField)[])
if is_totally_real(K)
return id_hom(K)
end
if !isempty(auts)
A = auts
else
Expand Down
3 changes: 3 additions & 0 deletions test/NfAbs/Conjugates.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ end
K, a = cyclotomic_field(13)
aut = @inferred complex_conjugation(K)
@test aut(a) == a^-1
K, a = quadratic_field(5)
aut = @inferred complex_conjugation(K)
@test aut(a) == a
end

@testset "Bad example" begin
Expand Down
24 changes: 24 additions & 0 deletions test/NumField/ComplexEmbeddings/Generic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@

c = FacElem(K(2))^1000 * FacElem(K(3))^-1000 * FacElem(K(5))^1000
@test (@inferred e(c)) isa AcbFieldElem

c = complex_conjugation(K)
if !(K isa QQField)
@test c == id_hom(K)
end
end

K, a = quadratic_field(-1)
Expand All @@ -73,4 +78,23 @@
e = complex_embeddings(k)[1]
eext = extend(e, ktoK)
@test all(overlaps(c(ktoK(b)), e(b)) for c in eext)

Qx, x = QQ["x"]
K, _ = rationals_as_number_field()
Kt, t = K["t"]
K1, = number_field(t^2 - 2)
K2, = number_field([t^2 - 2, t^2 - 3])
K3, = number_field([x^2 - 2, x^2 - 3])
for K in Any[K1, K2, K3]
c = complex_conjugation(K)
@test c == id_hom(K)
end

K1, = number_field(t^2 + 2)
K2, = number_field([t^2 + 2])
K3, = number_field([x^2 + 2])
for K in Any[K1, K2, K3]
c = complex_conjugation(K)
@test c != id_hom(K)
end
end
2 changes: 2 additions & 0 deletions test/NumField/ComplexEmbeddings/QQ.jl
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
@testset "QQ" begin
c = complex_conjugation(QQ)
@test c(QQ(1)) == QQ(1)
end

2 comments on commit cc0a2d8

@thofma
Copy link
Owner Author

@thofma thofma commented on cc0a2d8 Mar 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/102142

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.30.2 -m "<description of version>" cc0a2d883b463e599914ab0218a4cfed67ff5058
git push origin v0.30.2

Please sign in to comment.