Skip to content

Commit

Permalink
Adjust to expected AbstractAlgebra changes (#1730)
Browse files Browse the repository at this point in the history
  • Loading branch information
joschmitt authored Apr 26, 2024
1 parent 09c3bef commit 253a1c6
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 28 deletions.
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.43.3"
version = "0.44.0-DEV"

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

[compat]
AbstractAlgebra = "0.40.8"
AbstractAlgebra = "0.41.0"
Antic_jll = "~0.201.500"
Arb_jll = "~200.2300.000"
Calcium_jll = "~0.401.100"
Expand Down
1 change: 0 additions & 1 deletion src/Exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,6 @@ export snf
export snf_diagonal
export solve
export sort_terms!
export SparsePolynomialRing
export sqr_classical
export sqrt
export sqrt1pm1
Expand Down
2 changes: 1 addition & 1 deletion src/arb/ComplexMat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ end
################################################################################

function solve_init(A::ComplexMat)
return Solve.SolveCtx{ComplexFieldElem, ComplexMat, ComplexMat}(A)
return Solve.SolveCtx{ComplexFieldElem, ComplexMat, ComplexMat, ComplexMat}(A)
end

function Solve._init_reduce(C::Solve.SolveCtx{ComplexFieldElem})
Expand Down
2 changes: 1 addition & 1 deletion src/arb/RealMat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ end
################################################################################

function solve_init(A::RealMat)
return Solve.SolveCtx{RealFieldElem, RealMat, RealMat}(A)
return Solve.SolveCtx{RealFieldElem, RealMat, RealMat, RealMat}(A)
end

function Solve._init_reduce(C::Solve.SolveCtx{RealFieldElem})
Expand Down
2 changes: 1 addition & 1 deletion src/arb/acb_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ end
################################################################################

function solve_init(A::AcbMatrix)
return Solve.SolveCtx{AcbFieldElem, AcbMatrix, AcbMatrix}(A)
return Solve.SolveCtx{AcbFieldElem, AcbMatrix, AcbMatrix, AcbMatrix}(A)
end

function Solve._init_reduce(C::Solve.SolveCtx{AcbFieldElem})
Expand Down
2 changes: 1 addition & 1 deletion src/arb/arb_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ end
################################################################################

function solve_init(A::ArbMatrix)
return Solve.SolveCtx{ArbFieldElem, ArbMatrix, ArbMatrix}(A)
return Solve.SolveCtx{ArbFieldElem, ArbMatrix, ArbMatrix, ArbMatrix}(A)
end

function Solve._init_reduce(C::Solve.SolveCtx{ArbFieldElem})
Expand Down
2 changes: 1 addition & 1 deletion src/flint/fmpz_mat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1331,7 +1331,7 @@ function Solve._can_solve_internal_no_check(A::ZZMatrix, b::ZZMatrix, task::Symb
# `lazy_transpose`

function solve_init(A::ZZMatrix)
return Solve.SolveCtx{ZZRingElem, ZZMatrix, ZZMatrix}(A)
return Solve.SolveCtx{ZZRingElem, ZZMatrix, ZZMatrix, ZZMatrix}(A)
end

function Solve._init_reduce_transpose(C::Solve.SolveCtx{ZZRingElem})
Expand Down
30 changes: 10 additions & 20 deletions src/matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ end
################################################################################

function solve_init(A::_FieldMatTypes)
return Solve.SolveCtx{elem_type(base_ring(A)), typeof(A), typeof(A)}(A)
return Solve.SolveCtx{elem_type(base_ring(A)), typeof(A), typeof(A), typeof(A)}(A)
end

################################################################################
Expand All @@ -80,18 +80,13 @@ function Solve._init_reduce(C::Solve.SolveCtx{T}) where {T <: Union{fpFieldElem,
C.lu_perm = p
if r < nrows(C)
pA = p*matrix(C)
set_attribute!(C, :permuted_matrix_lu => view(pA, r + 1:nrows(C), :))
C.permuted_matrix = view(pA, r + 1:nrows(C), :)
else
set_attribute!(C, :permuted_matrix_lu => zero(matrix(C), 0, ncols(C)))
C.permuted_matrix = zero(matrix(C), 0, ncols(C))
end
return nothing
end

function permuted_matrix_lu(C::Solve.SolveCtx{T, MatT}) where {T <: Union{fpFieldElem, FpFieldElem, FqFieldElem, fqPolyRepFieldElem, FqPolyRepFieldElem}, MatT}
Solve._init_reduce(C)
return get_attribute(C, :permuted_matrix_lu)::MatT
end

function Solve._init_reduce_transpose(C::Solve.SolveCtx{T}) where {T <: Union{fpFieldElem, FpFieldElem, FqFieldElem, fqPolyRepFieldElem, FqPolyRepFieldElem}}
if isdefined(C, :red_transp) && isdefined(C, :lu_perm_transp)
return nothing
Expand All @@ -106,19 +101,14 @@ function Solve._init_reduce_transpose(C::Solve.SolveCtx{T}) where {T <: Union{fp
C.lu_perm_transp = p
if r < ncols(C)
Ap = matrix(C)*p
set_attribute!(C, :permuted_matrix_of_transpose_lu => view(Ap, :, r + 1:ncols(C)))
C.permuted_matrix_transp = view(Ap, :, r + 1:ncols(C))
else
set_attribute!(C, :permuted_matrix_of_transpose_lu => zero(matrix(C), nrows(C), 0))
C.permuted_matrix_transp = zero(matrix(C), nrows(C), 0)
end
return nothing
end

function permuted_matrix_of_transpose_lu(C::Solve.SolveCtx{T, MatT}) where {T <: Union{fpFieldElem, FpFieldElem, FqFieldElem, fqPolyRepFieldElem, FqPolyRepFieldElem}, MatT}
Solve._init_reduce_transpose(C)
return get_attribute(C, :permuted_matrix_of_transpose_lu)::MatT
end

function Solve._can_solve_internal_no_check(C::Solve.SolveCtx{T, MatT}, b::MatT, task::Symbol; side::Symbol = :left) where {T <: Union{fpFieldElem, FpFieldElem, FqFieldElem, fqPolyRepFieldElem, FqPolyRepFieldElem}, MatT}
function Solve._can_solve_internal_no_check(C::Solve.SolveCtx{T}, b::MatElem{T}, task::Symbol; side::Symbol = :left) where {T <: Union{fpFieldElem, FpFieldElem, FqFieldElem, fqPolyRepFieldElem, FqPolyRepFieldElem}}
# Split up in separate functions to make the compiler happy
if side === :right
return Solve._can_solve_internal_no_check_right(C, b, task)
Expand All @@ -127,7 +117,7 @@ function Solve._can_solve_internal_no_check(C::Solve.SolveCtx{T, MatT}, b::MatT,
end
end

function Solve._can_solve_internal_no_check_right(C::Solve.SolveCtx{T, MatT}, b::MatT, task::Symbol) where {T <: Union{fpFieldElem, FpFieldElem, FqFieldElem, fqPolyRepFieldElem, FqPolyRepFieldElem}, MatT}
function Solve._can_solve_internal_no_check_right(C::Solve.SolveCtx{T}, b::MatElem{T}, task::Symbol) where {T <: Union{fpFieldElem, FpFieldElem, FqFieldElem, fqPolyRepFieldElem, FqPolyRepFieldElem}}
LU = Solve.reduced_matrix(C)
p = Solve.lu_permutation(C)
pb = p*b
Expand Down Expand Up @@ -173,7 +163,7 @@ function Solve._can_solve_internal_no_check_right(C::Solve.SolveCtx{T, MatT}, b:

fl = true
if r < nrows(C)
fl = permuted_matrix_lu(C)*y == view(pb, r + 1:nrows(C), :)
fl = Solve.permuted_matrix(C)*y == view(pb, r + 1:nrows(C), :)
end

if task !== :with_kernel
Expand All @@ -183,7 +173,7 @@ function Solve._can_solve_internal_no_check_right(C::Solve.SolveCtx{T, MatT}, b:
end
end

function Solve._can_solve_internal_no_check_left(C::Solve.SolveCtx{T, MatT}, b::MatT, task::Symbol) where {T <: Union{fpFieldElem, FpFieldElem, FqFieldElem, fqPolyRepFieldElem, FqPolyRepFieldElem}, MatT}
function Solve._can_solve_internal_no_check_left(C::Solve.SolveCtx{T}, b::MatElem{T}, task::Symbol) where {T <: Union{fpFieldElem, FpFieldElem, FqFieldElem, fqPolyRepFieldElem, FqPolyRepFieldElem}}
LU = Solve.reduced_matrix_of_transpose(C)
p = Solve.lu_permutation_of_transpose(C)
pbt = p*transpose(b)
Expand All @@ -204,7 +194,7 @@ function Solve._can_solve_internal_no_check_left(C::Solve.SolveCtx{T, MatT}, b::
fl = true
if r < ncols(C)
bp = b*p
fl = y*permuted_matrix_of_transpose_lu(C) == view(bp, :, r + 1:ncols(C))
fl = y*Solve.permuted_matrix_of_transpose(C) == view(bp, :, r + 1:ncols(C))
end

if task !== :with_kernel
Expand Down

0 comments on commit 253a1c6

Please sign in to comment.