Skip to content

Commit

Permalink
Bump AbstractAlgebra to 0.44.0 (#1972)
Browse files Browse the repository at this point in the history
* Bump AbstractAlgebra to 0.44.0

* sanitize the solve_triu and sync with AA (#1958)

* Remove duplicate polynomial call code (#1933)

---------

Co-authored-by: Claus Fieker <fieker@mathematik.uni-kl.de>
Co-authored-by: Max Horn <max@quendi.de>
Co-authored-by: Tommy Hofmann <thofma@gmail.com>
  • Loading branch information
4 people authored Dec 13, 2024
1 parent defef89 commit 24ac955
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 135 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"

[compat]
AbstractAlgebra = "0.43.10"
AbstractAlgebra = "0.44.0"
FLINT_jll = "^300.100.100"
Libdl = "1.6"
LinearAlgebra = "1.6"
Expand Down
2 changes: 0 additions & 2 deletions src/Rings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,3 @@ include("arb/ComplexMat.jl")
include("gaussiannumbers/ZZi.jl")

include("Factor.jl")

include("polysubst.jl")
18 changes: 15 additions & 3 deletions src/flint/fmpz_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1554,7 +1554,7 @@ function _solve_dixon(a::ZZMatrix, b::ZZMatrix)
end

#XU = B. only the upper triangular part of U is used
function _solve_triu_left(U::ZZMatrix, b::ZZMatrix)
function AbstractAlgebra._solve_triu_left(U::ZZMatrix, b::ZZMatrix)
n = ncols(U)
m = nrows(b)
R = base_ring(U)
Expand Down Expand Up @@ -1595,8 +1595,14 @@ function _solve_triu_left(U::ZZMatrix, b::ZZMatrix)
return X
end

#UX = B
function _solve_triu(U::ZZMatrix, b::ZZMatrix)
#UX = B, U has to be upper triangular
#I think due to the Strassen calling path, where Strasse.solve(side = :left)
#call directly AA.solve_left, this has to be in AA and cannot be independent.
function AbstractAlgebra._solve_triu(U::ZZMatrix, b::ZZMatrix; side::Symbol=:left)
if side == :left
return AbstractAlgebra._solve_triu_left(U, b)
end
@assert side == :right
n = nrows(U)
m = ncols(b)
X = zero(b)
Expand Down Expand Up @@ -1638,6 +1644,12 @@ function _solve_triu(U::ZZMatrix, b::ZZMatrix)
return X
end

#solves Ax = B for A lower triagular. if f != 0 (f is true), the diagonal
#is assumed to be 1 and not actually used.
#the upper part of A is not used/ touched.
#one cannot assert is_lower_triangular as this is used for the inplace
#lu decomposition where the matrix is full, encoding an upper triangular
#using the diagonal and a lower triangular with trivial diagonal
function AbstractAlgebra._solve_tril!(A::ZZMatrix, B::ZZMatrix, C::ZZMatrix, f::Int = 0)

# a x u ax = u
Expand Down
13 changes: 0 additions & 13 deletions src/flint/fmpz_mod_poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -823,19 +823,6 @@ promote_rule(::Type{T}, ::Type{ZZRingElem}) where {T <: Zmodn_fmpz_poly} = T

promote_rule(::Type{ZZModPolyRingElem}, ::Type{ZZModRingElem}) = ZZModPolyRingElem

###############################################################################
#
# Polynomial substitution
#
###############################################################################

function (f::ZZModPolyRingElem)(a::ZZModRingElem)
if parent(a) != base_ring(f)
return subst(f, a)
end
return evaluate(f, a)
end

################################################################################
#
# Parent object call overloads
Expand Down
13 changes: 0 additions & 13 deletions src/flint/fq_default_poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -676,19 +676,6 @@ promote_rule(::Type{FqPolyRingElem}, ::Type{ZZRingElem}) = FqPolyRingElem

promote_rule(::Type{FqPolyRingElem}, ::Type{FqFieldElem}) = FqPolyRingElem

###############################################################################
#
# Polynomial substitution
#
###############################################################################

function (f::FqPolyRingElem)(a::FqFieldElem)
if parent(a) != base_ring(f)
return subst(f, a)
end
return evaluate(f, a)
end

################################################################################
#
# Parent object call overloads
Expand Down
13 changes: 0 additions & 13 deletions src/flint/fq_nmod_poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -679,19 +679,6 @@ promote_rule(::Type{fqPolyRepPolyRingElem}, ::Type{ZZRingElem}) = fqPolyRepPolyR

promote_rule(::Type{fqPolyRepPolyRingElem}, ::Type{fqPolyRepFieldElem}) = fqPolyRepPolyRingElem

###############################################################################
#
# Polynomial substitution
#
###############################################################################

function (f::fqPolyRepPolyRingElem)(a::fqPolyRepFieldElem)
if parent(a) != base_ring(f)
return subst(f, a)
end
return evaluate(f, a)
end

################################################################################
#
# Parent object call overloads
Expand Down
13 changes: 0 additions & 13 deletions src/flint/fq_poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -674,19 +674,6 @@ promote_rule(::Type{FqPolyRepPolyRingElem}, ::Type{ZZRingElem}) = FqPolyRepPolyR

promote_rule(::Type{FqPolyRepPolyRingElem}, ::Type{FqPolyRepFieldElem}) = FqPolyRepPolyRingElem

###############################################################################
#
# Polynomial substitution
#
###############################################################################

function (f::FqPolyRepPolyRingElem)(a::FqPolyRepFieldElem)
if parent(a) != base_ring(f)
return subst(f, a)
end
return evaluate(f, a)
end

################################################################################
#
# Parent object call overloads
Expand Down
13 changes: 0 additions & 13 deletions src/flint/gfp_fmpz_poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -396,19 +396,6 @@ promote_rule(::Type{FpPolyRingElem}, ::Type{FpFieldElem}) = FpPolyRingElem

promote_rule(::Type{FpPolyRingElem}, ::Type{ZZRingElem}) = FpPolyRingElem

###############################################################################
#
# Polynomial substitution
#
###############################################################################

function (f::FpPolyRingElem)(a::FpFieldElem)
if parent(a) != base_ring(f)
return subst(f, a)
end
return evaluate(f, a)
end

################################################################################
#
# Parent object call overloads
Expand Down
13 changes: 0 additions & 13 deletions src/flint/gfp_poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -479,19 +479,6 @@ promote_rule(::Type{fpPolyRingElem}, ::Type{ZZRingElem}) = fpPolyRingElem

promote_rule(::Type{fpPolyRingElem}, ::Type{fpFieldElem}) = fpPolyRingElem

###############################################################################
#
# Polynomial substitution
#
###############################################################################

function (f::fpPolyRingElem)(a::fpFieldElem)
if parent(a) != base_ring(f)
return subst(f, a)
end
return evaluate(f, a)
end

################################################################################
#
# Parent object call overloads
Expand Down
13 changes: 0 additions & 13 deletions src/flint/nmod_poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -896,19 +896,6 @@ promote_rule(::Type{zzModPolyRingElem}, ::Type{ZZRingElem}) = zzModPolyRingElem

promote_rule(::Type{zzModPolyRingElem}, ::Type{zzModRingElem}) = zzModPolyRingElem

###############################################################################
#
# Polynomial substitution
#
###############################################################################

function (f::zzModPolyRingElem)(a::zzModRingElem)
if parent(a) != base_ring(f)
return subst(f, a)
end
return evaluate(f, a)
end

################################################################################
#
# Parent object call overloads
Expand Down
35 changes: 0 additions & 35 deletions src/polysubst.jl

This file was deleted.

4 changes: 2 additions & 2 deletions test/flint/fmpz_mat-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -710,9 +710,9 @@ end
@test AbstractAlgebra.Solve.matrix_normal_form_type(A) === AbstractAlgebra.Solve.HermiteFormTrait()

b = matrix(ZZ, 1, 2, [1, 6])
@test Nemo._solve_triu_left(A, b) == matrix(ZZ, 1, 2, [1, 1])
@test AbstractAlgebra._solve_triu_left(A, b) == matrix(ZZ, 1, 2, [1, 1])
b = matrix(ZZ, 2, 1, [3, 4])
@test Nemo._solve_triu(A, b) == matrix(ZZ, 2, 1, [1, 1])
@test AbstractAlgebra._solve_triu(A, b; side = :right) == matrix(ZZ, 2, 1, [1, 1])
b = matrix(ZZ, 2, 1, [1, 7])
c = similar(b)
AbstractAlgebra._solve_tril!(c, A, b)
Expand Down
2 changes: 1 addition & 1 deletion test/generic/Matrix-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ end
M = randmat_triu(S, -100:100)
b = rand(U, -100:100)

x = AbstractAlgebra._solve_triu(M, b, false)
x = AbstractAlgebra._solve_triu_right(M, b; unipotent = false)

@test M*x == b
end
Expand Down

0 comments on commit 24ac955

Please sign in to comment.