Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make compatible to AA 0.43.0 #1849

Merged
merged 4 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Nemo"
uuid = "2edaba10-b0f1-5616-af89-8c11ac63239a"
version = "0.46.2"
version = "0.47.0-DEV"

[deps]
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
Expand All @@ -13,7 +13,7 @@ RandomExtensions = "fb686558-2515-59ef-acaa-46db3789a887"
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"

[compat]
AbstractAlgebra = "0.42.7"
AbstractAlgebra = "0.43.1"
FLINT_jll = "^300.100.100"
Libdl = "1.6"
LinearAlgebra = "1.6"
Expand Down
8 changes: 0 additions & 8 deletions docs/src/acb.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,6 @@ result. This function is provided for performance reasons as it saves
allocating a new object for the result and eliminates associated garbage
collection.

```
addeq!(c::AcbFieldElem, a::AcbFieldElem)
```

In-place addition adds $a$ to $c$ and sets $c$ to the result. This function
is provided for performance reasons as it saves allocating a new object for
the result and eliminates associated garbage collection.

```
deepcopy(a::AcbFieldElem)
```
Expand Down
8 changes: 0 additions & 8 deletions docs/src/complex.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,6 @@ result. This function is provided for performance reasons as it saves
allocating a new object for the result and eliminates associated garbage
collection.

```
addeq!(c::ComplexFieldElem, a::ComplexFieldElem)
```

In-place addition adds $a$ to $c$ and sets $c$ to the result. This function
is provided for performance reasons as it saves allocating a new object for
the result and eliminates associated garbage collection.

```
deepcopy(a::ComplexFieldElem)
```
Expand Down
2 changes: 1 addition & 1 deletion docs/src/developer/conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ follows:
* Functions for mapping between different types, coercion, changing base ring,
etc.

* Unsafe operators, e.g. `mul!`, `add!`, `addeq!` etc.
* Unsafe operators, e.g. `mul!`, `add!`, etc.

* Random generation

Expand Down
2 changes: 1 addition & 1 deletion docs/src/developer/interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ work for all types of the specified kind, instead of just the generic types.
In order for this to work in practice, such implementations can only use
functions in the relevant official interface. These are the functions required
to be implemented by all types of that kind. For example, matrix
implementations make heavy use of `addeq!` and `mul!` to accumulate entries, but
implementations make heavy use of `add!` and `mul!` to accumulate entries, but
they cannot make use of functions such as `subeq!` as it is not part of the
official interface.

Expand Down
17 changes: 9 additions & 8 deletions docs/src/developer/topics.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ number of temporary objects the garbage collector must allocate and clean up.

To speed up such accumulations, Nemo provides numerous unsafe operators, which
mutate the existing elements of the polynomial, matrix, etc. These include
functions such as `add!`, `addeq!`, `mul!`, `zero!` and `addmul!`.
functions such as `add!`, `mul!`, `zero!` and `addmul!`.

These functions take as their first argument the object that should be modified
with the return value.
Expand Down Expand Up @@ -294,17 +294,18 @@ on the part of the developer using unsafe operators.
For example, to set the existing value `a` to `a + b` one must write

```julia
a = addeq!(a, b)
a = add(a, b)
```

i.e. one must have an explicit assignment to the left of the `addeq!` call and
i.e. one must have an explicit assignment to the left of the `add` call and
indeed all the unsafe operator calls.

In the case of a mutable type, `addeq!` will simply modify the original `a`.
In the case of a mutable type (and the existence of a specialized method),
`add` will simply modify the original `a`.
The modified object will be returned and assigned to the exact same variable,
which has no effect.

In the case of an immutable type, `addeq!` does not modify the original object
In the case of an immutable type, `add` does not modify the original object
`a` as this is impossible, but it still returns the new value and assigns it
to `a` which is what one wants.

Expand Down Expand Up @@ -388,7 +389,7 @@ code given the constraints mentioned above.
another. Other objects, e.g. polynomials, series, etc., are constructed from
objects that do not alias one another, *even in part*

* standard unsafe operators, addeq!, mul!, addmul!, zero!, add! which mutate
* standard unsafe operators, mul!, addmul!, zero!, add! which mutate
their outputs are allow to be used iff that output is entirely under the
control of the caller, i.e. it was created for the purpose of accumulation,
but otherwise must not be used
Expand Down Expand Up @@ -500,7 +501,7 @@ reduce!(x::AbsSimpleNumFieldElem)
This function must perform reduction on an unreduced element (mutating it).
Note that it must return the mutated value as per all unsafe operators.

Finally, the `add!` and `addeq!` operators must be able to add nonreduced
Finally, the `add!` and operators must be able to add nonreduced
values.

If one wishes to speed up generic code for rings that provide delayed
Expand All @@ -525,6 +526,6 @@ accumulation loop has finished.
Note that `mul_red!` is never called directly but is called inside the generic
implementation of `addmul_delayed_reduction!` for rings that support delayed
reduction. That generic code falls back to a call to `addmul!` which in turn
falls back to `mul!` and `addeq!` where delayed reduction or `addmul!` are not
falls back to `mul!` and `add!` where delayed reduction or `addmul!` are not
available.

1 change: 0 additions & 1 deletion src/Exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export acosh
export acospi
export add_error!
export add!
export addeq!
export addmul!
export agm
export airy_ai
Expand Down
1 change: 1 addition & 0 deletions src/Nemo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ import AbstractAlgebra: Set
import AbstractAlgebra: set_attribute!
import AbstractAlgebra: Solve
import AbstractAlgebra: terse
import AbstractAlgebra: truncate!

AbstractAlgebra.@include_deprecated_bindings()

Expand Down
13 changes: 3 additions & 10 deletions src/antic/nf_elem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -766,13 +766,6 @@ function mul_red!(z::AbsSimpleNumFieldElem, x::AbsSimpleNumFieldElem, y::AbsSimp
return z
end

function addeq!(z::AbsSimpleNumFieldElem, x::AbsSimpleNumFieldElem)
ccall((:nf_elem_add, libflint), Nothing,
(Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}),
z, z, x, parent(x))
return z
end

function add!(a::AbsSimpleNumFieldElem, b::AbsSimpleNumFieldElem, c::AbsSimpleNumFieldElem)
ccall((:nf_elem_add, libflint), Nothing,
(Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumFieldElem}, Ref{AbsSimpleNumField}),
Expand Down Expand Up @@ -917,8 +910,8 @@ function sqr_classical(a::Generic.Poly{AbsSimpleNumFieldElem})
for i = 1:lena
for j = i + 1:lena
t = mul_red!(t, coeff(a, i - 1), coeff(a, j - 1), false)
d[i + j - 1] = addeq!(d[i + j - 1], t)
d[i + j - 1] = addeq!(d[i + j - 1], t)
d[i + j - 1] = add!(d[i + j - 1], t)
d[i + j - 1] = add!(d[i + j - 1], t)
end
end

Expand Down Expand Up @@ -964,7 +957,7 @@ function mul_classical(a::Generic.Poly{AbsSimpleNumFieldElem}, b::Generic.Poly{A
for i = 1:lena - 1
for j = 2:lenb
t = mul_red!(t, coeff(a, i - 1), b.coeffs[j], false)
d[i + j - 1] = addeq!(d[i + j - 1], t)
d[i + j - 1] = add!(d[i + j - 1], t)
end
end

Expand Down
6 changes: 0 additions & 6 deletions src/arb/Complex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1592,12 +1592,6 @@ function add!(z::ComplexFieldElem, x::ComplexFieldElem, y::ComplexFieldElem, pre
return z
end

function addeq!(z::ComplexFieldElem, y::ComplexFieldElem, prec::Int = precision(Balls))
ccall((:acb_add, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int),
z, z, y, prec)
return z
end

function sub!(z::ComplexFieldElem, x::ComplexFieldElem, y::ComplexFieldElem, prec::Int = precision(Balls))
ccall((:acb_sub, libflint), Nothing, (Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Ref{ComplexFieldElem}, Int),
z, x, y, prec)
Expand Down
7 changes: 0 additions & 7 deletions src/arb/ComplexPoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -732,13 +732,6 @@ function mul!(z::ComplexPolyRingElem, x::ComplexPolyRingElem, y::ComplexPolyRing
return z
end

function addeq!(z::ComplexPolyRingElem, x::ComplexPolyRingElem)
ccall((:acb_poly_add, libflint), Nothing,
(Ref{ComplexPolyRingElem}, Ref{ComplexPolyRingElem}, Ref{ComplexPolyRingElem}, Int),
z, z, x, precision(parent(z)))
return z
end

function add!(z::ComplexPolyRingElem, x::ComplexPolyRingElem, y::ComplexPolyRingElem)
ccall((:acb_poly_add, libflint), Nothing,
(Ref{ComplexPolyRingElem}, Ref{ComplexPolyRingElem}, Ref{ComplexPolyRingElem}, Int),
Expand Down
6 changes: 0 additions & 6 deletions src/arb/Real.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1945,12 +1945,6 @@ for (s,f) in (("add!","arb_add"), ("mul!","arb_mul"), ("div!", "arb_div"),
end
end

function addeq!(z::RealFieldElem, x::RealFieldElem, prec::Int = precision(Balls))
ccall((:arb_add, libflint), Nothing, (Ref{RealFieldElem}, Ref{RealFieldElem}, Ref{RealFieldElem}, Int),
z, z, x, prec)
return z
end

################################################################################
#
# Unsafe setting
Expand Down
7 changes: 0 additions & 7 deletions src/arb/RealPoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -632,13 +632,6 @@ function mul!(z::RealPolyRingElem, x::RealPolyRingElem, y::RealPolyRingElem)
return z
end

function addeq!(z::RealPolyRingElem, x::RealPolyRingElem)
ccall((:arb_poly_add, libflint), Nothing,
(Ref{RealPolyRingElem}, Ref{RealPolyRingElem}, Ref{RealPolyRingElem}, Int),
z, z, x, precision(parent(z)))
return z
end

function add!(z::RealPolyRingElem, x::RealPolyRingElem, y::RealPolyRingElem)
ccall((:arb_poly_add, libflint), Nothing,
(Ref{RealPolyRingElem}, Ref{RealPolyRingElem}, Ref{RealPolyRingElem}, Int),
Expand Down
6 changes: 0 additions & 6 deletions src/arb/acb.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1580,12 +1580,6 @@ function add!(z::AcbFieldElem, x::AcbFieldElem, y::AcbFieldElem)
return z
end

function addeq!(z::AcbFieldElem, y::AcbFieldElem)
ccall((:acb_add, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int),
z, z, y, parent(z).prec)
return z
end

function sub!(z::AcbFieldElem, x::AcbFieldElem, y::AcbFieldElem)
ccall((:acb_sub, libflint), Nothing, (Ref{AcbFieldElem}, Ref{AcbFieldElem}, Ref{AcbFieldElem}, Int),
z, x, y, parent(z).prec)
Expand Down
7 changes: 0 additions & 7 deletions src/arb/acb_poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -727,13 +727,6 @@ function mul!(z::AcbPolyRingElem, x::AcbPolyRingElem, y::AcbPolyRingElem)
return z
end

function addeq!(z::AcbPolyRingElem, x::AcbPolyRingElem)
ccall((:acb_poly_add, libflint), Nothing,
(Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Int),
z, z, x, precision(parent(z)))
return z
end

function add!(z::AcbPolyRingElem, x::AcbPolyRingElem, y::AcbPolyRingElem)
ccall((:acb_poly_add, libflint), Nothing,
(Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Ref{AcbPolyRingElem}, Int),
Expand Down
6 changes: 0 additions & 6 deletions src/arb/arb.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1947,12 +1947,6 @@ for (s,f) in (("add!","arb_add"), ("mul!","arb_mul"), ("div!", "arb_div"),
end
end

function addeq!(z::ArbFieldElem, x::ArbFieldElem)
ccall((:arb_add, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ArbFieldElem}, Int),
z, z, x, parent(x).prec)
return z
end

function addmul!(z::ArbFieldElem, x::ArbFieldElem, y::ZZRingElem)
q = max(bits(z), bits(x))
ccall((:arb_addmul_fmpz, libflint), Nothing, (Ref{ArbFieldElem}, Ref{ArbFieldElem}, Ref{ZZRingElem}, Int), z, x, y, q)
Expand Down
7 changes: 0 additions & 7 deletions src/arb/arb_poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -632,13 +632,6 @@ function mul!(z::ArbPolyRingElem, x::ArbPolyRingElem, y::ArbPolyRingElem)
return z
end

function addeq!(z::ArbPolyRingElem, x::ArbPolyRingElem)
ccall((:arb_poly_add, libflint), Nothing,
(Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Int),
z, z, x, precision(parent(z)))
return z
end

function add!(z::ArbPolyRingElem, x::ArbPolyRingElem, y::ArbPolyRingElem)
ccall((:arb_poly_add, libflint), Nothing,
(Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Ref{ArbPolyRingElem}, Int),
Expand Down
11 changes: 0 additions & 11 deletions src/calcium/ca.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1402,17 +1402,6 @@ function mul!(z::CalciumFieldElem, x::CalciumFieldElem, y::CalciumFieldElem)
return z
end

function addeq!(z::CalciumFieldElem, x::CalciumFieldElem)
if z.parent != x.parent
error("different parents in in-place operation")
end
C = z.parent
ccall((:ca_add, libflint), Nothing,
(Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumFieldElem}, Ref{CalciumField}), z, z, x, C)
check_special(z)
return z
end

function add!(z::CalciumFieldElem, x::CalciumFieldElem, y::CalciumFieldElem)
if z.parent != x.parent || x.parent != y.parent
error("different parents in in-place operation")
Expand Down
6 changes: 0 additions & 6 deletions src/calcium/qqbar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1505,12 +1505,6 @@ function mul!(z::QQBarFieldElem, x::QQBarFieldElem, y::QQBarFieldElem)
return z
end

function addeq!(z::QQBarFieldElem, x::QQBarFieldElem)
ccall((:qqbar_add, libflint), Nothing,
(Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, z, x)
return z
end

function add!(z::QQBarFieldElem, x::QQBarFieldElem, y::QQBarFieldElem)
ccall((:qqbar_add, libflint), Nothing,
(Ref{QQBarFieldElem}, Ref{QQBarFieldElem}, Ref{QQBarFieldElem}), z, x, y)
Expand Down
12 changes: 0 additions & 12 deletions src/flint/flint_puiseux_series.jl
Original file line number Diff line number Diff line change
Expand Up @@ -499,18 +499,6 @@ function add!(c::FlintPuiseuxSeriesElem{T}, a::FlintPuiseuxSeriesElem{T}, b::Fli
return c
end

function addeq!(c::FlintPuiseuxSeriesElem{T}, a::FlintPuiseuxSeriesElem{T}) where T <: RingElem
s = gcd(c.scale, a.scale)
zscale = div(c.scale*a.scale, s)
ainf = div(a.scale, s)
cinf = div(c.scale, s)
cnew = inflate(c.data, ainf)
c.data = addeq!(cnew, inflate(a.data, cinf))
c.scale = zscale
c = rescale!(c)
return c
end

###############################################################################
#
# Promotion rules
Expand Down
3 changes: 0 additions & 3 deletions src/flint/fmpq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1169,9 +1169,6 @@ function addmul!(c::QQFieldElem, a::QQFieldElem, b::QQFieldElem)
return c
end


addeq!(c::QQFieldElem, a::QQFieldElem) = add!(c, c, a)

function add!(c::QQFieldElem, a::QQFieldElem, b::QQFieldElem)
ccall((:fmpq_add, libflint), Nothing,
(Ref{QQFieldElem}, Ref{QQFieldElem}, Ref{QQFieldElem}), c, a, b)
Expand Down
25 changes: 0 additions & 25 deletions src/flint/fmpq_abs_series.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,6 @@ end

characteristic(::QQAbsPowerSeriesRing) = 0

function set_precision!(z::QQAbsPowerSeriesRingElem, k::Int)
k < 0 && throw(DomainError(k, "Precision must be non-negative"))
z = truncate!(z, k)
z.prec = k
return z
end

###############################################################################
#
# Similar
Expand Down Expand Up @@ -766,24 +759,6 @@ function mul!(z::QQAbsPowerSeriesRingElem, a::QQAbsPowerSeriesRingElem, b::QQAbs
return z
end

function addeq!(a::QQAbsPowerSeriesRingElem, b::QQAbsPowerSeriesRingElem)
lena = length(a)
lenb = length(b)

prec = min(a.prec, b.prec)

lena = min(lena, prec)
lenb = min(lenb, prec)

lenz = max(lena, lenb)
a.prec = prec
ccall((:fmpq_poly_add_series, libflint), Nothing,
(Ref{QQAbsPowerSeriesRingElem}, Ref{QQAbsPowerSeriesRingElem},
Ref{QQAbsPowerSeriesRingElem}, Int),
a, a, b, lenz)
return a
end

function add!(c::QQAbsPowerSeriesRingElem, a::QQAbsPowerSeriesRingElem, b::QQAbsPowerSeriesRingElem)
lena = length(a)
lenb = length(b)
Expand Down
4 changes: 0 additions & 4 deletions src/flint/fmpq_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -796,10 +796,6 @@ mul!(x::QQMatrix, y::IntegerUnion) = mul!(x, x, y)

mul!(z::QQMatrix, y::QQMatrix, x::Integer) = mul!(z, y, ZZ(x))

function addeq!(z::QQMatrix, x::QQMatrix)
add!(z, z, x)
end

function zero!(z::QQMatrix)
ccall((:fmpq_mat_zero, libflint), Nothing,
(Ref{QQMatrix},), z)
Expand Down
Loading
Loading