Skip to content

Commit

Permalink
Prepare for not exporting QQBar and CalciumQQBar
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed May 15, 2024
1 parent 9d8fc90 commit 087fe14
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 102 deletions.
20 changes: 10 additions & 10 deletions docs/src/algebraic.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Methods to construct algebraic numbers include:

Arithmetic:

```jldoctest
```jldoctest; setup = :(QQBar = algebraic_closure(QQ))
julia> ZZRingElem(QQBar(3))
3
Expand All @@ -59,7 +59,7 @@ Root 0.500000 + 0.866025*im of x^2 - x + 1

Solving the quintic equation:

```jldoctest
```jldoctest; setup = :(QQBar = algebraic_closure(QQ))
julia> R, x = polynomial_ring(QQ, "x")
(Univariate polynomial ring in x over QQ, x)
Expand All @@ -77,7 +77,7 @@ true

Computing exact eigenvalues of a matrix:

```jldoctest
```jldoctest; setup = :(QQBar = algebraic_closure(QQ))
julia> eigenvalues(QQBar, ZZ[1 1 0; 0 1 1; 1 0 1])
3-element Vector{QQBarFieldElem}:
Root 2.00000 of x - 2
Expand Down Expand Up @@ -105,7 +105,7 @@ Algebraic numbers can be evaluated
numerically to arbitrary precision by converting
to real or complex Arb fields:

```jldoctest
```jldoctest; setup = :(QQBar = algebraic_closure(QQ))
julia> RR = ArbField(64); RR(sqrt(QQBar(2)))
[1.414213562373095049 +/- 3.45e-19]
Expand All @@ -120,7 +120,7 @@ julia> CC = AcbField(32); CC(QQBar(-1) ^ (QQBar(1) // 4))
Retrieving the minimal polynomial and algebraic conjugates
of a given algebraic number:

```jldoctest
```jldoctest; setup = :(QQBar = algebraic_closure(QQ))
julia> minpoly(polynomial_ring(ZZ, "x")[1], QQBar(1+2im))
x^2 - 2*x + 5
Expand Down Expand Up @@ -153,7 +153,7 @@ height_bits(x::QQBarFieldElem)

**Examples**

```jldoctest
```jldoctest; setup = :(QQBar = algebraic_closure(QQ))
julia> real(sqrt(QQBar(1im)))
Root 0.707107 of 2x^2 - 1
Expand Down Expand Up @@ -211,7 +211,7 @@ first.

**Examples**

```jldoctest
```jldoctest; setup = :(QQBar = algebraic_closure(QQ))
julia> 1 < sqrt(QQBar(2)) < QQBar(3)//2
true
Expand Down Expand Up @@ -248,7 +248,7 @@ is_less_root_order(a::QQBarFieldElem, b::QQBarFieldElem)

**Examples**

```jldoctest
```jldoctest; setup = :(QQBar = algebraic_closure(QQ))
julia> root(QQBar(2), 5)
Root 1.14870 of x^5 - 2
Expand Down Expand Up @@ -303,7 +303,7 @@ atanpi(a::QQBarFieldElem)

An algebraic number can be recovered from a numerical value:

```jldoctest
```jldoctest; setup = :(QQBar = algebraic_closure(QQ))
julia> RR = RealField(); guess(QQBar, RR("1.41421356 +/- 1e-6"), 2)
Root 1.41421 of x^2 - 2
```
Expand All @@ -313,7 +313,7 @@ approximation, you should add an error estimate; otherwise, at best the only
algebraic number that can be guessed is the binary floating-point number
itself, at worst no guess is possible.

```jldoctest
```jldoctest; setup = :(QQBar = algebraic_closure(QQ))
julia> RR = RealField();
julia> x = RR(0.1) # note: 53-bit binary approximation of 1//10 without radius
Expand Down
2 changes: 1 addition & 1 deletion docs/src/exact.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ value because of evaluation limits.
julia> QQ(C(1))
1
julia> QQBar(sqrt(C(2)) // 2)
julia> algebraic_closure(QQ)(sqrt(C(2)) // 2)
Root 0.707107 of 2x^2 - 1
julia> QQ(C(pi))
Expand Down
4 changes: 2 additions & 2 deletions src/Exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export bits
export bound_inf_norm
export CalciumField
export CalciumFieldElem
export CalciumQQBar
export CalciumQQBar # TODO: remove in next breaking release
export canonical_unit
export cdiv
export cdivpow2
Expand Down Expand Up @@ -499,7 +499,7 @@ export QadicFieldElem
export QQ
export QQAbsPowerSeriesRing
export QQAbsPowerSeriesRingElem
export QQBar
export QQBar # TODO: remove in next breaking release
export QQBarField
export QQBarFieldElem
export QQField
Expand Down
2 changes: 1 addition & 1 deletion src/Nemo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ GaussianRationals() = FlintQQi
###############################################################################

@doc qqbar_field_doc
const QQBar = CalciumQQBar
const CalciumQQBar = QQBar # TODO: remove in next breaking release


###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion src/calcium/CalciumTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Root 0.866025 of 4x^2 - 3
struct QQBarField <: Field
end

const CalciumQQBar = QQBarField()
const QQBar = QQBarField()

@doc qq_field_doc
mutable struct QQBarFieldElem <: FieldElem
Expand Down
18 changes: 12 additions & 6 deletions src/calcium/qqbar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
###############################################################################

parent(a::QQBarFieldElem) = CalciumQQBar
parent(a::QQBarFieldElem) = QQBar

parent_type(::Type{QQBarFieldElem}) = QQBarField

Expand Down Expand Up @@ -178,9 +178,9 @@ zero(a::QQBarField) = a(0)

one(a::QQBarField) = a(1)

zero(::Type{QQBarFieldElem}) = CalciumQQBar(0)
zero(::Type{QQBarFieldElem}) = QQBar(0)

one(::Type{QQBarFieldElem}) = CalciumQQBar(1)
one(::Type{QQBarFieldElem}) = QQBar(1)

@doc raw"""
degree(x::QQBarFieldElem)
Expand Down Expand Up @@ -1176,7 +1176,9 @@ Throws if this value is transcendental.
# Examples
```jldoctest
julia> x = sinpi(QQBar(1)//3)
julia> QQBar = algebraic_closure(QQ);
julia> x = sinpi(QQBar(1//3))
Root 0.866025 of 4x^2 - 3
julia> sinpi(x)
Expand All @@ -1202,7 +1204,9 @@ Throws if this value is transcendental.
# Examples
```jldoctest
julia> x = cospi(QQBar(1)//6)
julia> QQBar = algebraic_closure(QQ);
julia> x = cospi(QQBar(1//6))
Root 0.866025 of 4x^2 - 3
julia> cospi(x)
Expand All @@ -1228,7 +1232,9 @@ Throws if either value is transcendental.
# Examples
```jldoctest
julia> s, c = sincospi(QQBar(1)//3)
julia> QQBar = algebraic_closure(QQ);
julia> s, c = sincospi(QQBar(1//3))
(Root 0.866025 of 4x^2 - 3, Root 0.500000 of 2x - 1)
julia> sincospi(s)
Expand Down
1 change: 1 addition & 0 deletions test/calcium/ca-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ end

@testset "CalciumFieldElem.conversions" begin
C = CalciumField()
QQBar = algebraic_closure(QQ)

n = C(3)
h = C(1) // 2
Expand Down
Loading

0 comments on commit 087fe14

Please sign in to comment.