Skip to content

Commit

Permalink
adjust doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
thofma committed Nov 8, 2024
1 parent be22ddf commit 02dd4ef
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 26 deletions.
2 changes: 1 addition & 1 deletion docs/src/manual/elliptic_curves/finite_fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Return a random point on the elliptic curve $E$ defined over a finite field.
julia> E = elliptic_curve(GF(3), [1, 2]);
julia> rand(E)
(0 : 1 : 0)
(2 : 0 : 1)
```

## Cardinality and orders
Expand Down
25 changes: 10 additions & 15 deletions src/EllCrv/EllCrv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@ disabled by setting `check = false`.
```jldoctest
julia> elliptic_curve(QQ, [1, 2, 3, 4, 5])
Elliptic curve with equation
y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5
y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5
julia> elliptic_curve(GF(3), [1, 1])
Elliptic curve with equation
y^2 = x^3 + x + 1
y^2 = x^3 + x + 1
```
"""
elliptic_curve
Expand Down Expand Up @@ -284,11 +284,11 @@ julia> Qx, x = QQ["x"];
julia> elliptic_curve(x^3 + x + 1)
Elliptic curve with equation
y^2 = x^3 + x + 1
y^2 = x^3 + x + 1
julia> elliptic_curve(x^3 + x + 1, x)
Elliptic curve with equation
y^2 + x*y = x^3 + x + 1
y^2 + x*y = x^3 + x + 1
```
"""
function elliptic_curve(f::PolyRingElem{T}, h::PolyRingElem{T} = zero(parent(f)); check::Bool = true) where T
Expand Down Expand Up @@ -323,7 +323,7 @@ Prime field of characteristic 3
julia> elliptic_curve_from_j_invariant(K(2))
Elliptic curve with equation
y^2 + x*y = x^3 + 1
y^2 + x*y = x^3 + 1
```
"""
function elliptic_curve_from_j_invariant(j::FieldElem)
Expand Down Expand Up @@ -608,12 +608,10 @@ by setting `check = false`.
julia> E = elliptic_curve(QQ, [1, 2]);
julia> E([1, -2])
Point (1 : -2 : 1) of Elliptic curve with equation
y^2 = x^3 + x + 2
(1 : -2 : 1)
julia> E([2, -4, 2])
Point (1 : -2 : 1) of Elliptic curve with equation
y^2 = x^3 + x + 2
(1 : -2 : 1)
```
"""
function (E::EllipticCurve{T})(coords::Vector{S}; check::Bool = true) where {S, T}
Expand Down Expand Up @@ -871,8 +869,7 @@ julia> E = elliptic_curve(QQ, [1, 2]);
julia> P = E([1, -2]);
julia> P + P
Point (-1 : 0 : 1) of Elliptic curve with equation
y^2 = x^3 + x + 2
(-1 : 0 : 1)
```
"""
function +(P::EllipticCurvePoint{T}, Q::EllipticCurvePoint{T}) where T
Expand Down Expand Up @@ -1165,10 +1162,8 @@ julia> E = elliptic_curve(QQ, [1, 2]);
julia> division_points(infinity(E), 2)
2-element Vector{EllipticCurvePoint{QQFieldElem}}:
Point (0 : 1 : 0) of Elliptic curve with equation
y^2 = x^3 + x + 2
Point (-1 : 0 : 1) of Elliptic curve with equation
y^2 = x^3 + x + 2
(0 : 1 : 0)
(-1 : 0 : 1)
```
"""
function division_points(P::EllipticCurvePoint, m::S) where S<:Union{Integer, ZZRingElem}
Expand Down
15 changes: 5 additions & 10 deletions src/EllCrv/Finite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1145,17 +1145,14 @@ julia> E = elliptic_curve(GF(101, 2), [1, 2]);
julia> gens(E)
2-element Vector{EllipticCurvePoint{FqFieldElem}}:
Point (16*o + 42 : 88*o + 97 : 1) of Elliptic curve with equation
y^2 = x^3 + x + 2
Point (88*o + 23 : 94*o + 22 : 1) of Elliptic curve with equation
y^2 = x^3 + x + 2
(13*o + 83 : 90*o + 25 : 1)
(61*o + 62 : 19*o + 24 : 1)
julia> E = elliptic_curve(GF(101), [1, 2]);
julia> gens(E)
1-element Vector{EllipticCurvePoint{FqFieldElem}}:
Point (85 : 58 : 1) of Elliptic curve with equation
y^2 = x^3 + x + 2
(27 : 57 : 1)
```
"""
function gens(E::EllipticCurve{T}) where {T <: FinFieldElem}
Expand Down Expand Up @@ -1235,12 +1232,10 @@ argument.
julia> E = elliptic_curve(GF(101), [1, 2]);
julia> P = E([6, 74])
Point (6 : 74 : 1) of Elliptic curve with equation
y^2 = x^3 + x + 2
(6 : 74 : 1)
julia> Q = E([85, 43])
Point (85 : 43 : 1) of Elliptic curve with equation
y^2 = x^3 + x + 2
(85 : 43 : 1)
julia> disc_log(P, Q)
13
Expand Down

0 comments on commit 02dd4ef

Please sign in to comment.