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

New linear solving interface + more upstream changes #3350

Merged
merged 10 commits into from
Feb 16, 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
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
cohomCalg_jll = "5558cf25-a90e-53b0-b813-cadaa3ae7ade"

[compat]
AbstractAlgebra = "0.37.5"
AbstractAlgebra = "0.39.0"
AlgebraicSolving = "0.4.10"
Distributed = "1.6"
DocStringExtensions = "0.8, 0.9"
GAP = "0.10.2"
Hecke = "0.27.0"
Hecke = "0.28.0"
JSON = "^0.20, ^0.21"
JSON3 = "1.13.2"
LazyArtifacts = "1.6"
Nemo = "0.41.3"
Nemo = "0.42.1"
Pkg = "1.6"
Polymake = "0.11.13"
Preferences = "1"
Expand Down
6 changes: 3 additions & 3 deletions docs/src/NumberTheory/galois.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ The main information is included in the number field chapter, see
- [`Hecke.principal_subfields(K::SimpleNumField)`](@ref)
- [`subfields(FF::Generic.FunctionField{QQFieldElem})`](@ref)

By setting `set_verbose_level(:Subfields, n::Int)` to 1 or 2
By setting `set_verbosity_level(:Subfields, n::Int)` to 1 or 2
information about the progress can be obtained.

## Galois Group
Expand All @@ -75,8 +75,8 @@ find explicit subfields of the splitting field as well.

Information about the progress is available via

- `set_verbose_level(:GaloisGroup, n::Int)`
- `set_verbose_level(:GaloisInvariants, n::Int)`
- `set_verbosity_level(:GaloisGroup, n::Int)`
- `set_verbosity_level(:GaloisInvariants, n::Int)`

```@docs
galois_group(K::AbsSimpleNumField, extra::Int = 5; useSubfields::Bool = true, pStart::Int = 2*degree(K), prime::Int = 0)
Expand Down
2 changes: 1 addition & 1 deletion examples/BinomIdeal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ argument, so we make an array prodDeltaC, push to it, then splice it in
uv=matrixFromArray(u-v) #this is the vector of u-v
vst=transpose(vs)
vstMat=matrix(FlintZZ,size(vst,1), size(vst,2),vst)
if(cansolve(transpose(vstMat),uv)[1]==false)
if(can_solve(transpose(vstMat),uv)==false)
images=[images; nemo(-lead_coeff(tCopy))]
#we have to save u-v as generator for the lattice
#now concatenate the vector vs on bottom of the matrix vs
Expand Down
2 changes: 1 addition & 1 deletion examples/BinomIdeal2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ argument, so we make an array prodDeltaC, push to it, then splice it in
uv=matrixFromArray(u-v) #this is the vector of u-v
vst=transpose(vs)
vstMat=matrix(FlintZZ,size(vst,1), size(vst,2),vst)
if(cansolve(transpose(vstMat),uv)[1]==false)
if(can_solve(transpose(vstMat),uv)==false)
images=[images; nemo(-lead_coeff(tCopy))]
#we have to save u-v as generator for the lattice
#now concatenate the vector vs on bottom of the matrix vs
Expand Down
2 changes: 1 addition & 1 deletion experimental/FTheoryTools/src/FamilyOfSpaces/attributes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ Ideal generated by
ring = coordinate_ring(f)
variables = gens(ring)
w = weights(f)
ideal_gens = right_kernel(ZZMatrix(w))[2]
ideal_gens = kernel(ZZMatrix(w); side = :right)
ideal_gens = [sum([ideal_gens[l,k] * variables[l] for l in 1:nrows(ideal_gens)]) for k in 1:ncols(ideal_gens)]
return ideal(ideal_gens)
end
2 changes: 1 addition & 1 deletion experimental/FTheoryTools/src/auxiliary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function _ambient_space(base::NormalToricVariety, fiber_amb_space::NormalToricVa
D2_coeffs = divisor_class(D2).coeff
m1 = reduce(vcat, [D1_coeffs, D2_coeffs])
m2 = transpose(f_rays[1:2,:])
u_matrix = solve_left(b_grades, (-1)*m2*m1)
u_matrix = solve(b_grades, (-1)*m2*m1; side = :left)

# Form toric ambient space
a_rays = zero_matrix(ZZ, nrows(b_rays) + nrows(f_rays), ncols(b_rays) + ncols(f_rays))
Expand Down
2 changes: 1 addition & 1 deletion experimental/GITFans/src/GITFans.jl
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function action_on_target(Q::Matrix{Int}, G::PermGroup)
matgens = typeof(mat)[]
for ppi in permgens
matimg = mat[Vector{Int}(ppi), 1:n] # permute the rows with `ppi`
push!(matgens, solve(mat, matimg))
push!(matgens, solve(mat, matimg; side = :right))
end

# Create the matrix group.
Expand Down
2 changes: 1 addition & 1 deletion experimental/GModule/Brueckner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ function lift(C::GModule, mp::Map)
@hassert :BruecknerSQ 2 preimage(z, z(chn)) == chn
GG, GGinj, GGpro, GMtoGG = Oscar.GrpCoh.extension(PcGroup, z(chn))
@assert is_surjective(GGpro)
if get_assert_level(:BruecknerSQ) > 1
if get_assertion_level(:BruecknerSQ) > 1
_GG, _ = Oscar.GrpCoh.extension(z(chn))
@assert is_isomorphic(GG, _GG)
end
Expand Down
8 changes: 4 additions & 4 deletions experimental/GModule/Cohomology.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import Base: parent
import Oscar: pretty, Lowercase, @show_name, @show_special

function __init__()
Hecke.add_verbose_scope(:GroupCohomology)
Hecke.add_assert_scope(:GroupCohomology)
Hecke.add_verbosity_scope(:GroupCohomology)
Hecke.add_assertion_scope(:GroupCohomology)

Hecke.add_verbose_scope(:GaloisCohomology)
Hecke.add_assert_scope(:GaloisCohomology)
Hecke.add_verbosity_scope(:GaloisCohomology)
Hecke.add_assertion_scope(:GaloisCohomology)
end

######################################################################
Expand Down
20 changes: 10 additions & 10 deletions experimental/GModule/GModule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -213,17 +213,17 @@ end


function __init__()
add_verbose_scope(:BruecknerSQ)
set_verbose_level(:BruecknerSQ, 0)
add_verbosity_scope(:BruecknerSQ)
set_verbosity_level(:BruecknerSQ, 0)

add_assert_scope(:BruecknerSQ)
set_assert_level(:BruecknerSQ, 0)
add_assertion_scope(:BruecknerSQ)
set_assertion_level(:BruecknerSQ, 0)

add_assert_scope(:MinField)
set_assert_level(:MinField, 0)
add_assertion_scope(:MinField)
set_assertion_level(:MinField, 0)

add_verbose_scope(:MinField)
set_verbose_level(:MinField, 0)
add_verbosity_scope(:MinField)
set_verbosity_level(:MinField, 0)
end

function irreducible_modules(k::FinField, G::Oscar.GAPGroup)
Expand Down Expand Up @@ -914,7 +914,7 @@ function hilbert90_cyclic(A::MatElem{<:FinFieldElem}, s, os::Int)
@hassert :MinField 2 A == B*inv(map_entries(s, B))
return B
else
if cnt > 10 && get_assert_level(:MinField) > 1
if cnt > 10 && get_assertion_level(:MinField) > 1
error("")
end
cnt += 1
Expand Down Expand Up @@ -1259,7 +1259,7 @@ function hom_base(C::_T, D::_T) where _T <: GModule{<:Any, <:AbstractAlgebra.FPM
push!(S, s)
end
end
if nbits(pp) > 1000 && get_assert_level(:MinField) > 1
if nbits(pp) > 1000 && get_assertion_level(:MinField) > 1
error("ndw")
end
if length(S) == length(T)
Expand Down
6 changes: 3 additions & 3 deletions experimental/GModule/GaloisCohomology.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ julia> k, a = number_field(x^4 - 12*x^3 + 36*x^2 - 36*x + 9);

julia> a = ray_class_field(8*3*maximal_order(k), n_quo = 2);

julia> a = filter(isnormal, subfields(a, degree = 2));
julia> a = filter(is_normal, subfields(a, degree = 2));

julia> I = idel_class_gmodule(k);

Expand Down Expand Up @@ -1518,7 +1518,7 @@ and explicit 2-cochains.
function relative_brauer_group(K::AbsSimpleNumField, k::Union{QQField, AbsSimpleNumField} = QQ)
G, mG = automorphism_group(PermGroup, K)
if k != QQ
fl, mp = issubfield(k, K)
fl, mp = is_subfield(k, K)
p = mp(gen(k))
@assert fl
s, ms = sub(G, [x for x = G if mG(x)(p) == p])
Expand Down Expand Up @@ -1631,7 +1631,7 @@ function (a::RelativeBrauerGroupElem)(p::Union{NumFieldOrderIdeal, Hecke.NumFiel
end

#write (or try to write) `b` as a ZZ-linear combination of the elements in `A`
function Oscar.cansolve(A::Vector{RelativeBrauerGroupElem}, b::RelativeBrauerGroupElem)
function cansolve(A::Vector{RelativeBrauerGroupElem}, b::RelativeBrauerGroupElem)
@assert all(x->parent(x) == parent(b), A)
lp = Set(collect(keys(b.data)))
for a = A
Expand Down
10 changes: 5 additions & 5 deletions experimental/GaloisGrp/src/Solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ using Oscar
import Oscar: AbstractAlgebra, Hecke, GaloisGrp.GaloisCtx

function __init__()
Hecke.add_verbose_scope(:SolveRadical)
Hecke.add_assert_scope(:SolveRadical)
Hecke.add_verbosity_scope(:SolveRadical)
Hecke.add_assertion_scope(:SolveRadical)
end


Expand Down Expand Up @@ -420,7 +420,7 @@ a corresponding primitive n-th root of 1, find an isomorphic radical extension
using Lagrange resolvents.
"""
function as_radical_extension(K::NumField, aut::Map, zeta::NumFieldElem; simplify::Bool = !false)
CHECK = get_assert_level(:SolveRadical) > 0
CHECK = get_assertion_level(:SolveRadical) > 0

g = gen(K)
d = degree(K)
Expand Down Expand Up @@ -468,7 +468,7 @@ The necessary roots of unity are not themselves computed as radicals.
See also [`galois_group`](@ref).

# VERBOSE
Supports `set_verbose_level(:SolveRadical, i)` to obtain information.
Supports `set_verbosity_level(:SolveRadical, i)` to obtain information.


# Examples
Expand Down Expand Up @@ -503,7 +503,7 @@ function Oscar.solve(f::ZZPolyRingElem; max_prec::Int=typemax(Int), show_radical
@req is_squarefree(f) "Polynomial must be square-free"

#switches check = true in hom and number_field on
CHECK = get_assert_level(:SolveRadical) > 0
CHECK = get_assertion_level(:SolveRadical) > 0
@vprint :SolveRadical 1 "computing initial galois group...\n"
@vtime :SolveRadical 1 G, C = galois_group(f)
lp = [p for p = keys(factor(order(G)).fac) if p > 2]
Expand Down
6 changes: 4 additions & 2 deletions experimental/LieAlgebras/src/LieAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,8 @@ function center(L::LieAlgebra)
end
end

c_dim, c_basis = left_kernel(mat)
c_basis = kernel(mat; side = :left)
c_dim = nrows(c_basis)
return ideal(L, [L(c_basis[i, :]) for i in 1:c_dim]; is_basis=true)
end

Expand All @@ -322,7 +323,8 @@ function centralizer(L::LieAlgebra, xs::AbstractVector{<:LieAlgebraElem})
end
end

c_dim, c_basis = left_kernel(mat)
c_basis = kernel(mat; side = :left)
c_dim = nrows(c_basis)
return sub(L, [L(c_basis[i, :]) for i in 1:c_dim]; is_basis=true)
end

Expand Down
4 changes: 3 additions & 1 deletion experimental/LieAlgebras/src/LieAlgebraHom.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ end
Return the kernel of `h` as an ideal of the domain.
"""
function kernel(h::LieAlgebraHom)
ker_dim, ker_b = left_kernel(matrix(h))
ker_b = kernel(matrix(h); side = :left)
ker_dim = nrows(ker_b)

return ideal(domain(h), [domain(h)(ker_b[i, :]) for i in 1:ker_dim])
end

Expand Down
3 changes: 2 additions & 1 deletion experimental/LieAlgebras/src/LieSubalgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ function normalizer(L::LieAlgebra, S::LieSubalgebra)
S
)
end
sol_dim, sol = left_kernel(mat)
sol = kernel(mat; side = :left)
sol_dim = nrows(sol)
sol = sol[:, 1:dim(L)]
c_dim, c_basis = rref(sol)
return sub(L, [L(c_basis[i, :]) for i in 1:c_dim]; is_basis=true)
Expand Down
3 changes: 1 addition & 2 deletions experimental/LieAlgebras/src/Util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ function coefficient_vector(M::MatElem{T}, basis::Vector{<:MatElem{T}}) where {T
for i in 1:nr, j in 1:nc
rhs[(i - 1) * nc + j, 1] = M[i, j]
end
fl, sol = can_solve_with_solution(lgs, rhs)
@assert fl
sol = solve(lgs, rhs; side = :right)
return transpose(sol)
end
2 changes: 1 addition & 1 deletion experimental/LieAlgebras/test/LieAlgebraModule-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@
b = V()
while iszero(a) ||
iszero(b) ||
can_solve(
Oscar.can_solve(
Oscar.LieAlgebras._matrix(a),
Oscar.LieAlgebras._matrix(b);
side=:left,
Expand Down
6 changes: 2 additions & 4 deletions experimental/LinearQuotients/src/cox_rings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ function action_on_basis(G::FinGenAbGroup, G_action::Function, polys::Vector{<:
# Little bit of a waste to recompute the rref of M all the time.
# But I don't see how to do it better and mats should not contain many
# elements anyways.
fl, sol = can_solve_with_solution(M, N, side = :left)
@assert fl
sol = solve(M, N, side = :left)

push!(res, sol)
end
Expand Down Expand Up @@ -140,8 +139,7 @@ function fill_degree!(HBB::HomBasisBuilder, d::Int)
M = vcat(M, N)
end

fl, sol = can_solve_with_solution(V, M, side = :left)
@assert fl
sol = solve(V, M, side = :left)

# The i-th row of sol gives the coefficient of inhom_gens[row_to_gen[i]] in
# the basis hom_basisd.
Expand Down
2 changes: 1 addition & 1 deletion experimental/ModStd/ModStdNF.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Hecke: modular_lift, modular_proj, modular_env, RecoCtx,
induce_rational_reconstruction

function __init__()
Hecke.add_verbose_scope(:ModStdNF)
Hecke.add_verbosity_scope(:ModStdNF)
end


Expand Down
2 changes: 1 addition & 1 deletion experimental/ModStd/ModStdQ.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Oscar: MPolyIdeal, BiPolyArray, IdealGens, Hecke, AbstractAlgebra
import Hecke: induce_rational_reconstruction, induce_crt

function __init__()
Hecke.add_verbose_scope(:ModStdQ)
Hecke.add_verbosity_scope(:ModStdQ)
end

function (R::fpMPolyRing)(f::QQMPolyRingElem)
Expand Down
4 changes: 2 additions & 2 deletions experimental/ModStd/ModStdQt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Oscar.Nemo
import Oscar.Hecke

function __init__()
Hecke.add_verbose_scope(:ModStdQt)
Hecke.add_verbosity_scope(:ModStdQt)
end

function Oscar.evaluate(f::FracElem{<:MPolyRingElem}, v::Vector{<:RingElem}; ErrorTolerant::Bool = false)
Expand Down Expand Up @@ -892,7 +892,7 @@ function Oscar.lift(f::PolyRingElem, g::PolyRingElem, a::AbsSimpleNumFieldElem,
for i=1:n
mm[i, 1] = coeff(d*b, i-1)
end
s = solve(m, mm)
s = solve(m, mm; side = :right)
B = q(parent(f)(vec(collect(s))))
@assert all(x->iszero(evaluate(numerator(x), V)), coefficients(lift(gg(B))))
o = lift(inv(derivative(gg)(B)))
Expand Down
15 changes: 8 additions & 7 deletions experimental/QuadFormAndIsom/src/embeddings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ function _overlattice(gamma::TorQuadModuleMap,
_B = QQ(1, denominator(Fakeglue))*change_base_ring(QQ, numerator(_FakeB))
C = lattice(ambient_space(A), _B[end-rank(A)-rank(B)+1:end, :])
fC = block_diagonal_matrix(QQMatrix[fA, fB])
_B = solve_left(reduce(vcat, basis_matrix.([A,B])), basis_matrix(C))
_B = solve(reduce(vcat, basis_matrix.([A,B])), basis_matrix(C); side = :left)
fC = _B*fC*inv(_B)
else
_glue = Vector{QQFieldElem}[lift(HAinD(a)) + lift(HBinD(gamma(a))) for a in gens(domain(gamma))]
Expand All @@ -187,7 +187,7 @@ function _overlattice(gamma::TorQuadModuleMap,
_B = QQ(1, denominator(Fakeglue))*change_base_ring(QQ, numerator(_FakeB))
C = lattice(ambient_space(cover(D)), _B[end-rank(A)-rank(B)+1:end, :])
fC = block_diagonal_matrix(QQMatrix[fA, fB])
_B = solve_left(block_diagonal_matrix(basis_matrix.(ZZLat[A, B])), basis_matrix(C))
_B = solve(block_diagonal_matrix(basis_matrix.(ZZLat[A, B])), basis_matrix(C); side = :left)
fC = _B*fC*inv(_B)
end
@hassert :ZZLatWithIsom 1 fC*gram_matrix(C)*transpose(fC) == gram_matrix(C)
Expand Down Expand Up @@ -377,7 +377,7 @@ function _fitting_isometries(OqfN::AutomorphismGroup{TorQuadModule},
# To summarize, in the general case, we obtain representatives of fitting
# isometries by identifying CN-conjugate isometries in the coset fNKN.
if first
reporb = QQMatrix[solve_left(basis_matrix(N), basis_matrix(N)*matrix(_fN))]
reporb = QQMatrix[solve(basis_matrix(N), basis_matrix(N)*matrix(_fN); side = :left)]
else
KNhat, _ = discrep\(kernel(_actN)[1])
fNKN = _fN*KNhat
Expand All @@ -391,7 +391,7 @@ function _fitting_isometries(OqfN::AutomorphismGroup{TorQuadModule},
end
end
end
reporb = QQMatrix[solve_left(basis_matrix(N), basis_matrix(N)*matrix(a[1])) for a in orb_and_rep]
reporb = QQMatrix[solve(basis_matrix(N), basis_matrix(N)*matrix(a[1]); side = :left) for a in orb_and_rep]
return reporb
end

Expand Down Expand Up @@ -925,7 +925,8 @@ function _subgroups_orbit_representatives_and_stabilizers_elementary(Vinq::TorQu

F = base_ring(Qp)
# K is H0 but seen a subvector space of Vp (which is V)
k, K = kernel(VptoQp.matrix; side = :left)
K = kernel(VptoQp.matrix; side = :left)
k = nrows(K)
gene_H0p = elem_type(Vp)[Vp(vec(collect(K[i,:]))) for i in 1:k]
orb_and_stab = orbit_representatives_and_stabilizers(MGp, g-k)

Expand Down Expand Up @@ -1405,8 +1406,8 @@ function primitive_embeddings(G::ZZGenus, M::ZZLat; classification::Symbol = :su
# L, M3 and N live in a very big ambient space: we redescribed them in the
# rational span of L so that L has full rank and we keep only the
# necessary information.
bM = solve_left(basis_matrix(L), basis_matrix(M3))
bN = solve_left(basis_matrix(L), basis_matrix(N))
bM = solve(basis_matrix(L), basis_matrix(M3); side = :left)
bN = solve(basis_matrix(L), basis_matrix(N); side = :left)
L = integer_lattice(; gram = gram_matrix(L))
M3 = lattice_in_same_ambient_space(L, bM)
N = lattice_in_same_ambient_space(L, bN)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ function _transfer_discriminant_isometry(res::AbstractSpaceRes,
B2abs = map_entries(p, B2abs)

# Our local modular solution we have to lift
K = solve_left(Bpabs, B2abs)
K = solve(Bpabs, B2abs; side = :left)
K = map_entries(a -> EabstoE(Eabs(p\a)), K)

# If what we have done is correct then K*newBp == newB2 modulo O_p, so all
Expand Down
Loading
Loading