Skip to content

Commit

Permalink
Implement isreal(elm::QQAbFieldElem) (#4207)
Browse files Browse the repository at this point in the history
Also turn QQAbAutomorphism into immutable struct
  • Loading branch information
fingolfin authored Oct 17, 2024
1 parent bd919eb commit 753fa25
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Rings/AbelianClosure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ end
# Then $l = k a n_0 + b n_1$ is coprime to $n$ and has the properties
# $l \equiv 1 \pmod{n_0}$ and $l \equiv k \pmod{n_1}$.

mutable struct QQAbAutomorphism
struct QQAbAutomorphism
exp::Int
end

Expand Down Expand Up @@ -1084,6 +1084,8 @@ end

Base.conj(elm::QQAbFieldElem) = elm^QQAbAutomorphism(-1)

Base.isreal(elm::QQAbFieldElem) = conj(elm) == elm

###############################################################################
#
# Elements in quadratic subfields of cyclotomic fields
Expand Down
4 changes: 4 additions & 0 deletions test/Rings/AbelianClosure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ end
f = hom(K, K, 3)
@test f(a) == a^3
@test f(z(9)) == z(9)

@test isone(conj(a)*a)
@test !isreal(a)
@test isreal(a+conj(a))
end

@testset "Square roots" begin
Expand Down

0 comments on commit 753fa25

Please sign in to comment.