diff --git a/Project.toml b/Project.toml index f34b6f624421..15c61340e783 100644 --- a/Project.toml +++ b/Project.toml @@ -26,7 +26,7 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" cohomCalg_jll = "5558cf25-a90e-53b0-b813-cadaa3ae7ade" [compat] -AbstractAlgebra = "0.37.5" +AbstractAlgebra = "0.37.6" AlgebraicSolving = "0.4.6" Distributed = "1.6" DocStringExtensions = "0.8, 0.9" @@ -35,7 +35,7 @@ Hecke = "0.27.0" JSON = "^0.20, ^0.21" JSON3 = "1.13.2" LazyArtifacts = "1.6" -Nemo = "0.41.3" +Nemo = "0.41.5" Pkg = "1.6" Polymake = "0.11.12" Preferences = "1" diff --git a/experimental/FTheoryTools/src/FamilyOfSpaces/attributes.jl b/experimental/FTheoryTools/src/FamilyOfSpaces/attributes.jl index 8899600b7db2..a4b66ce1415a 100644 --- a/experimental/FTheoryTools/src/FamilyOfSpaces/attributes.jl +++ b/experimental/FTheoryTools/src/FamilyOfSpaces/attributes.jl @@ -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 = Solve.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 diff --git a/experimental/FTheoryTools/src/auxiliary.jl b/experimental/FTheoryTools/src/auxiliary.jl index 1df22edcefbb..d600298ffc52 100644 --- a/experimental/FTheoryTools/src/auxiliary.jl +++ b/experimental/FTheoryTools/src/auxiliary.jl @@ -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.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)) diff --git a/experimental/GITFans/src/GITFans.jl b/experimental/GITFans/src/GITFans.jl index fb57333b1c46..eac7160afce7 100644 --- a/experimental/GITFans/src/GITFans.jl +++ b/experimental/GITFans/src/GITFans.jl @@ -7,6 +7,8 @@ module GITFans # the necessary Julia packages using Oscar +import Oscar: AbstractAlgebra.Solve + export git_fan ############################################################################# @@ -207,7 +209,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.solve(mat, matimg; side = :right)) end # Create the matrix group. diff --git a/experimental/LieAlgebras/src/LieAlgebra.jl b/experimental/LieAlgebras/src/LieAlgebra.jl index 5270d8e69083..dcabe565cd99 100644 --- a/experimental/LieAlgebras/src/LieAlgebra.jl +++ b/experimental/LieAlgebras/src/LieAlgebra.jl @@ -303,7 +303,8 @@ function center(L::LieAlgebra) end end - c_dim, c_basis = left_kernel(mat) + c_basis = Solve.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 @@ -322,7 +323,8 @@ function centralizer(L::LieAlgebra, xs::AbstractVector{<:LieAlgebraElem}) end end - c_dim, c_basis = left_kernel(mat) + c_basis = Solve.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 diff --git a/experimental/LieAlgebras/src/LieAlgebraHom.jl b/experimental/LieAlgebras/src/LieAlgebraHom.jl index dad0ec23fc74..a7bccab01a06 100644 --- a/experimental/LieAlgebras/src/LieAlgebraHom.jl +++ b/experimental/LieAlgebras/src/LieAlgebraHom.jl @@ -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 = Solve.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 diff --git a/experimental/LieAlgebras/src/LieAlgebraIdeal.jl b/experimental/LieAlgebras/src/LieAlgebraIdeal.jl index 14dd8759d4f1..fcb2c28fb409 100644 --- a/experimental/LieAlgebras/src/LieAlgebraIdeal.jl +++ b/experimental/LieAlgebras/src/LieAlgebraIdeal.jl @@ -23,7 +23,7 @@ left = copy(gens) while !isempty(left) g = pop!(left) - can_solve(basis_matrix, _matrix(g); side=:left) && continue + Solve.can_solve(basis_matrix, _matrix(g); side=:left) && continue for b in basis(L) push!(left, b * g) end diff --git a/experimental/LieAlgebras/src/LieAlgebras.jl b/experimental/LieAlgebras/src/LieAlgebras.jl index d8c53b55cb19..3dec1cacffee 100644 --- a/experimental/LieAlgebras/src/LieAlgebras.jl +++ b/experimental/LieAlgebras/src/LieAlgebras.jl @@ -13,8 +13,10 @@ using AbstractAlgebra: CacheDictType, ProductIterator, get_cached!, ordinal_numb using AbstractAlgebra.PrettyPrinting + # functions with new methods import ..Oscar: + AbstractAlgebra.Solve, _iso_oscar_gap, action, basis_matrix, diff --git a/experimental/LieAlgebras/src/LieSubalgebra.jl b/experimental/LieAlgebras/src/LieSubalgebra.jl index 09a9ebd68637..7853664e2cf0 100644 --- a/experimental/LieAlgebras/src/LieSubalgebra.jl +++ b/experimental/LieAlgebras/src/LieSubalgebra.jl @@ -23,7 +23,7 @@ left = copy(gens) while !isempty(left) g = pop!(left) - can_solve(basis_matrix, _matrix(g); side=:left) && continue + Solve.can_solve(basis_matrix, _matrix(g); side=:left) && continue for i in 1:nrows(basis_matrix) push!(left, g * L(basis_matrix[i, :])) end @@ -160,7 +160,7 @@ end Return `true` if `x` is in the Lie subalgebra `S`, `false` otherwise. """ function Base.in(x::LieAlgebraElem, S::LieSubalgebra) - return can_solve(basis_matrix(S), _matrix(x); side=:left) + return Solve.can_solve(basis_matrix(S), _matrix(x); side=:left) end ############################################################################### @@ -213,7 +213,8 @@ function normalizer(L::LieAlgebra, S::LieSubalgebra) S ) end - sol_dim, sol = left_kernel(mat) + sol = Solve.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) diff --git a/experimental/LieAlgebras/src/Util.jl b/experimental/LieAlgebras/src/Util.jl index b6a7aff337ca..e61e595e762d 100644 --- a/experimental/LieAlgebras/src/Util.jl +++ b/experimental/LieAlgebras/src/Util.jl @@ -24,7 +24,7 @@ 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) + fl, sol = Solve.can_solve_with_solution(lgs, rhs; side = :right) @assert fl return transpose(sol) end diff --git a/experimental/LieAlgebras/test/LieAlgebraModule-test.jl b/experimental/LieAlgebras/test/LieAlgebraModule-test.jl index e581c1968467..a269edcc9507 100644 --- a/experimental/LieAlgebras/test/LieAlgebraModule-test.jl +++ b/experimental/LieAlgebras/test/LieAlgebraModule-test.jl @@ -402,7 +402,7 @@ b = V() while iszero(a) || iszero(b) || - can_solve( + Oscar.Solve.can_solve( Oscar.LieAlgebras._matrix(a), Oscar.LieAlgebras._matrix(b); side=:left, diff --git a/experimental/ModStd/ModStdQt.jl b/experimental/ModStd/ModStdQt.jl index d5e71977c2fe..2afa546004b6 100644 --- a/experimental/ModStd/ModStdQt.jl +++ b/experimental/ModStd/ModStdQt.jl @@ -3,6 +3,7 @@ module ModStdQt using Oscar import Oscar.Nemo import Oscar.Hecke +import Oscar.Solve function __init__() Hecke.add_verbose_scope(:ModStdQt) @@ -892,7 +893,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.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))) diff --git a/experimental/QuadFormAndIsom/src/embeddings.jl b/experimental/QuadFormAndIsom/src/embeddings.jl index 5015532d4bf6..417fdf6dd597 100644 --- a/experimental/QuadFormAndIsom/src/embeddings.jl +++ b/experimental/QuadFormAndIsom/src/embeddings.jl @@ -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.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))] @@ -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.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) @@ -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.solve(basis_matrix(N), basis_matrix(N)*matrix(_fN); side = :left)] else KNhat, _ = discrep\(kernel(_actN)[1]) fNKN = _fN*KNhat @@ -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.solve(basis_matrix(N), basis_matrix(N)*matrix(a[1]); side = :left) for a in orb_and_rep] return reporb end @@ -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 = Solve.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) @@ -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.solve(basis_matrix(L), basis_matrix(M3); side = :left) + bN = Solve.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) diff --git a/experimental/QuadFormAndIsom/src/hermitian_miranda_morrison.jl b/experimental/QuadFormAndIsom/src/hermitian_miranda_morrison.jl index ab9000a3ff13..d7d99d1de34d 100644 --- a/experimental/QuadFormAndIsom/src/hermitian_miranda_morrison.jl +++ b/experimental/QuadFormAndIsom/src/hermitian_miranda_morrison.jl @@ -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.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 diff --git a/experimental/QuadFormAndIsom/src/lattices_with_isometry.jl b/experimental/QuadFormAndIsom/src/lattices_with_isometry.jl index 34b34d41607b..fa21b2084029 100644 --- a/experimental/QuadFormAndIsom/src/lattices_with_isometry.jl +++ b/experimental/QuadFormAndIsom/src/lattices_with_isometry.jl @@ -1821,7 +1821,7 @@ function _real_kernel_signatures(L::ZZLat, M::MatElem) C = base_ring(M) G = gram_matrix(L) GC = change_base_ring(C, G) - _, K = left_kernel(M) + K = Solve.kernel(M; side = :left) diag = K*GC*transpose(K) diag = Hecke._gram_schmidt(diag, C)[1] @@ -1951,7 +1951,7 @@ function kernel_lattice(Lf::ZZLatWithIsom, p::QQPolyRingElem) f = isometry(Lf) M = p(f) d = denominator(M) - k, K = left_kernel(change_base_ring(ZZ, d*M)) + K = Solve.kernel(change_base_ring(ZZ, d*M); side = :left) return lattice(ambient_space(Lf), K*basis_matrix(L)) end @@ -2141,7 +2141,7 @@ function coinvariant_lattice(L::ZZLat, G::MatrixGroup; ambient_representation::B if !ambient_representation g_ambient = block_diagonal_matrix(QQMatrix[matrix(g), identity_matrix(QQ, nrows(B2))]) g_ambient = iB3*g_ambient*B3 - m = solve_left(basis_matrix(C), basis_matrix(C)*g_ambient) + m = Solve.solve(basis_matrix(C), basis_matrix(C)*g_ambient; side = :left) push!(gene, m) else push!(gene, matrix(g)) @@ -2216,7 +2216,7 @@ function invariant_coinvariant_pair(L::ZZLat, G::MatrixGroup; ambient_representa if !ambient_representation g_ambient = block_diagonal_matrix(QQMatrix[matrix(g), identity_matrix(QQ, nrows(B2))]) g_ambient = iB3*g_ambient*B3 - m = solve_left(basis_matrix(C), basis_matrix(C)*g_ambient) + m = Solve.solve(basis_matrix(C), basis_matrix(C)*g_ambient; side = :left) push!(gene, m) else push!(gene, matrix(g)) diff --git a/experimental/Rings/QQAbAndPChars.jl b/experimental/Rings/QQAbAndPChars.jl index 862472b70ca8..19827be0ac2a 100644 --- a/experimental/Rings/QQAbAndPChars.jl +++ b/experimental/Rings/QQAbAndPChars.jl @@ -4,6 +4,8 @@ using ..Oscar import Oscar: IJuliaMime +import Oscar: Solve + ############################################################################### # # Partial character functions @@ -42,7 +44,7 @@ end function (Chi::PartialCharacter)(b::ZZMatrix) @assert nrows(b) == 1 @assert Nemo.ncols(b) == Nemo.ncols(Chi.A) - s = can_solve_with_solution(Chi.A, b, side = :left) + s = Solve.can_solve_with_solution(Chi.A, b, side = :left) @assert s[1] return evaluate(FacElem(Dict([(Chi.b[i], s[2][1, i]) for i = 1:length(Chi.b)]))) end diff --git a/experimental/Schemes/WeilDivisor.jl b/experimental/Schemes/WeilDivisor.jl index 9e4c95115128..cdc5ef2a4b19 100644 --- a/experimental/Schemes/WeilDivisor.jl +++ b/experimental/Schemes/WeilDivisor.jl @@ -675,7 +675,8 @@ function _subsystem(L::LinearSystem, P::IdealSheaf, n) A[i, k] = c end end - r, K = left_kernel(A) + K = Solve.kernel(A; side = :left) + r = nrows(K) new_gens = [sum([K[i,j]*gen(L, j) for j in 1:ncols(K)]) for i in 1:r] W = weil_divisor(L) PW = WeilDivisor(P, check=false) diff --git a/experimental/Schemes/elliptic_surface.jl b/experimental/Schemes/elliptic_surface.jl index fe2c64a2444b..767a3be02984 100644 --- a/experimental/Schemes/elliptic_surface.jl +++ b/experimental/Schemes/elliptic_surface.jl @@ -1028,7 +1028,8 @@ function _prop217(E::EllipticCurve, P::EllipticCurvePoint, k) cc = [[coeff(j, abi) for abi in ab] for j in eqns] M = matrix(B, length(eqns), length(ab), reduce(vcat,cc, init=elem_type(base)[])) # @assert M == matrix(base, cc) # does not work if length(eqns)==0 - kerdim, K = kernel(M) + K = Solve.kernel(M; side = :right) + kerdim = ncols(K) result = Tuple{elem_type(Bt),elem_type(Bt)}[] t = gen(Bt) for j in 1:kerdim @@ -1358,7 +1359,7 @@ function extended_ade(ADE::Symbol, n::Int) G[n,1] = -1 end @assert rank(G) == n - return -G, left_kernel(G)[2] + return -G, Solve.kernel(G; side = :left) end function basis_representation(X::EllipticSurface, D::WeilDivisor) diff --git a/experimental/SymmetricIntersections/src/representations.jl b/experimental/SymmetricIntersections/src/representations.jl index e5ca6e2bedba..ed8109d385c5 100644 --- a/experimental/SymmetricIntersections/src/representations.jl +++ b/experimental/SymmetricIntersections/src/representations.jl @@ -1280,12 +1280,12 @@ function complement_submodule(rep::LinRep{S, T, U}, M::W) where {S, T, U, W <: M B2j = B2[j] B2jM = (B2j*M)[1:1,:] B1u = reduce(vcat, [BB[1:1,:] for BB in B1]) - _Kj = solve_left(B1u, B2jM) + _Kj = Solve.solve(B1u, B2jM; side = :left) for i in 1:d, k in 1:length(B1) _K[(k-1)*d + i, i + (j-1)*d] = _Kj[1, k] end end - a, K2 = left_kernel(_K) + K2 = Solve.kernel(_K; side = :left) Borth = K2*reduce(vcat, B1) @assert is_submodule(rep, Borth) bas = vcat(bas, Borth) diff --git a/experimental/SymmetricIntersections/src/symmetric_grassmannians.jl b/experimental/SymmetricIntersections/src/symmetric_grassmannians.jl index cc751ab60856..6818e4f16396 100644 --- a/experimental/SymmetricIntersections/src/symmetric_grassmannians.jl +++ b/experimental/SymmetricIntersections/src/symmetric_grassmannians.jl @@ -508,7 +508,7 @@ function _intersection_with_grassmannian(V::Vector{T}, n::Int, t::Int; end Grtn = subscheme(X, ideal_Gr) B = reduce(vcat, V) - _, K = right_kernel(B) + K = Solve.kernel(B; side = :right) if ncols(K) == 0 return ideal_Gr diff --git a/src/AlgebraicGeometry/Surfaces/K3Auto.jl b/src/AlgebraicGeometry/Surfaces/K3Auto.jl index 4c470f074255..413ddd377556 100644 --- a/src/AlgebraicGeometry/Surfaces/K3Auto.jl +++ b/src/AlgebraicGeometry/Surfaces/K3Auto.jl @@ -92,7 +92,7 @@ function BorcherdsCtx(L::ZZLat, S::ZZLat, weyl::ZZMatrix; compute_OR::Bool=true) R = lll(Hecke.orthogonal_submodule(L, S)) # the following completes the basis of R to a basis of L - basisRL = solve_left(basis_matrix(L),basis_matrix(R)) + basisRL = Solve.solve(basis_matrix(L),basis_matrix(R); side = :left) basisRL = change_base_ring(ZZ, basisRL) A, j = snf(abelian_group(basisRL)) @@ -101,9 +101,9 @@ function BorcherdsCtx(L::ZZLat, S::ZZLat, weyl::ZZMatrix; compute_OR::Bool=true) # carry the Weyl vector along L1 = lattice(ambient_space(L), basisL1) - weyl = change_base_ring(ZZ, solve_left(basisL1, weyl*basis_matrix(L))) - basisSL1 = solve_left(basis_matrix(L1), basis_matrix(S)) - basisRL1 = solve_left(basis_matrix(L1), basis_matrix(R)) + weyl = change_base_ring(ZZ, Solve.solve(basisL1, weyl*basis_matrix(L); side = :left)) + basisSL1 = Solve.solve(basis_matrix(L1), basis_matrix(S); side = :left) + basisRL1 = Solve.solve(basis_matrix(L1), basis_matrix(R); side = :left) # Assure that L has the standard basis. L = integer_lattice(gram=gram_matrix(L1)) @@ -552,7 +552,7 @@ function short_vectors_affine(S::ZZLat, v::MatrixElem, alpha, d) alpha = QQ(alpha) gram = gram_matrix(S) tmp = v*gram_matrix(ambient_space(S))*transpose(basis_matrix(S)) - v_S = solve_left(gram_matrix(S),tmp) + v_S = Solve.solve(gram_matrix(S),tmp; side = :left) sol = short_vectors_affine(gram, v_S, alpha, d) B = basis_matrix(S) return [s*B for s in sol] @@ -564,11 +564,11 @@ function short_vectors_affine(gram::MatrixElem, v::MatrixElem, alpha::QQFieldEle tmp = FakeFmpqMat(w) wn = numerator(tmp) wd = denominator(tmp) - b, x = can_solve_with_solution(transpose(wn), matrix(ZZ, 1, 1, [alpha*wd])) + b, x = can_solve_with_solution(transpose(wn), matrix(ZZ, 1, 1, [alpha*wd]); side = :right) if !b return QQMatrix[] end - _, K = left_kernel(wn) + K = Solve.kernel(wn; side = :left) # (x + y*K)*gram*(x + y*K) = x gram x + 2xGKy + y K G K y # now I want to formulate this as a cvp @@ -606,8 +606,8 @@ function separating_hyperplanes(S::ZZLat, v::QQMatrix, h::QQMatrix, d) @hassert :K3Auto 1 inner_product(V,h,h)[1,1]>0 gram = gram_matrix(S) B = basis_matrix(S) - vS = solve_left(B,v) - hS = solve_left(B,h) + vS = Solve.solve(B,v; side = :left) + hS = Solve.solve(B,h; side = :left) return [a*B for a in separating_hyperplanes(gram,vS,hS,d)] end @@ -622,7 +622,7 @@ function separating_hyperplanes(gram::QQMatrix, v::QQMatrix, h::QQMatrix, d) bW = basis_matrix(W) # set up the quadratic triple for SW gramW = gram_matrix(W) - s = solve_left(bW, v*prW) * gramW + s = Solve.solve(bW, v*prW; side = :left) * gramW Q = gramW + transpose(s)*s*ch*cv^-2 @vprint :K3Auto 5 Q @@ -1032,7 +1032,7 @@ function _alg58_close_vector(data::BorcherdsCtx, w::ZZMatrix) SSdual = dual(data.SS) delta_w = QQMatrix[] wS = w*data.prS - #wS = solve_left(gram_matrix(S),w*gram_matrix(V)*transpose(basis_matrix(S))) + #wS = Solve.solve(gram_matrix(S),w*gram_matrix(V)*transpose(basis_matrix(S)); side = :left) Vw = data.gramL*transpose(w) # since we do repeated cvp in the same lattice # we do the preprocessing here @@ -1077,7 +1077,7 @@ function _alg58_close_vector(data::BorcherdsCtx, w::ZZMatrix) tmp = FakeFmpqMat(ww) wn = numerator(tmp) wd = denominator(tmp) - _, K = left_kernel(wn) + K = Solve.kernel(wn; side = :left) K = lll!(K) # perhaps doing this has no gain? # (x + y*K)*gram*(x + y*K) = x gram x + 2xGKy + y K G K y @@ -1096,7 +1096,7 @@ function _alg58_close_vector(data::BorcherdsCtx, w::ZZMatrix) B = basis_matrix(SSdual) KB = K*B for (alpha, d) in keys(cvp_inputs) - can_solve_i, x = can_solve_with_solution(transpose(wn), matrix(ZZ, 1, 1, [alpha*wd])) + can_solve_i, x = Solve.can_solve_with_solution(transpose(wn), matrix(ZZ, 1, 1, [alpha*wd]); side = :right) if !can_solve_i continue end @@ -1401,7 +1401,7 @@ function K3_surface_automorphism_group(S::ZZLat) end function K3_surface_automorphism_group(S::ZZLat, ample_class::QQMatrix, n::Int=26) - ample_classS = solve_left(basis_matrix(S), ample_class) + ample_classS = Solve.solve(basis_matrix(S), ample_class; side = :left) L, S, weyl = borcherds_method_preprocessing(S, n, ample=ample_class) return borcherds_method(L, S, weyl, compute_OR=false)[2:end] end @@ -1598,8 +1598,8 @@ function span_in_S(L, S, weyl) else M = linear_equation_matrix(spanC) end - k, K = kernel(M) - gensN = transpose(K)[1:k,:] + K = Solve.kernel(M; side = :right) + gensN = transpose(K) return gensN end @@ -1620,9 +1620,9 @@ function weyl_vector_non_degenerate(L::ZZLat, S::ZZLat, u0::QQMatrix, weyl::QQMa @vprint :K3Auto 2 "calculating separating hyperplanes\n" separating_walls = separating_hyperplanes(L, u, ample, -2) - @vprint :K3Auto 2 "moving Weyl vector $(solve_left(basis_matrix(L),weyl)) towards the ample class\n" + @vprint :K3Auto 2 "moving Weyl vector $(Solve.solve(basis_matrix(L),weyl; side = :left)) towards the ample class\n" u, weyl = chain_reflect(V, ample, u, weyl, separating_walls) - @vprint :K3Auto "new weyl: $(solve_left(basis_matrix(L),weyl)) \n" + @vprint :K3Auto "new weyl: $(Solve.solve(basis_matrix(L),weyl; side = :left)) \n" if is_S_nondegenerate(L,S,weyl) return weyl, u, ample end @@ -1728,7 +1728,7 @@ function weyl_vector(L::ZZLat, U0::ZZLat) A = change_base_ring(ZZ, gram_matrix(R)*transpose(v)) b = change_base_ring(GF(2), b) A = change_base_ring(GF(2), A) - x = lift(solve_left(A, b)) + x = lift(Solve.solve(A, b; side = :left)) v = (v + 2*x)*basis_matrix(R) @hassert :K3Auto 1 mod(inner_product(V,v,v)[1,1], 8)==0 u = basis_matrix(U) @@ -1843,7 +1843,7 @@ function borcherds_method_preprocessing(S::ZZLat, n::Integer; ample=nothing) if ample isa Nothing @vprint :K3Auto 1 "searching a random ample vector in S\n" h = ample_class(S) - hS = solve_left(basis_matrix(S),h) + hS = Solve.solve(basis_matrix(S),h; side = :left) @vprint :K3Auto 1 "ample vector: $hS \n" else h = ample*basis_matrix(S) @@ -1858,7 +1858,7 @@ function borcherds_method_preprocessing(S::ZZLat, n::Integer; ample=nothing) weyl1, u, hh = weyl_vector_non_degenerate(L, S, u0, weyl, h) - weyl2 = change_base_ring(ZZ, solve_left(basis_matrix(L), weyl1)) + weyl2 = change_base_ring(ZZ, Solve.solve(basis_matrix(L), weyl1; side = :left)) return L, S, weyl2 end @@ -1990,7 +1990,7 @@ function fibration_type(NS::ZZLat, f::QQMatrix) V = ambient_space(NS) # compute f^\perp / ZZf K = orthogonal_submodule(NS, lattice(V, f)) - fK = change_base_ring(ZZ, solve_left(basis_matrix(K), f)) + fK = change_base_ring(ZZ, Solve.solve(basis_matrix(K), f; side = :left)) g = gcd(vec(collect(fK))) fK = divexact(fK, g) A, j = snf(abelian_group(fK)) @@ -2001,7 +2001,7 @@ function fibration_type(NS::ZZLat, f::QQMatrix) mwl_rank = rank(NS) - 2 - rank(R) ade_type = root_lattice_recognition(R)[1] barR = primitive_closure(Frame, R) - torsion = abelian_group(change_base_ring(ZZ,solve_left(basis_matrix(barR), basis_matrix(R)))) + torsion = abelian_group(change_base_ring(ZZ,Solve.solve(basis_matrix(barR), basis_matrix(R); side = :left))) return mwl_rank, snf(torsion)[1], ade_type end @@ -2025,9 +2025,10 @@ function find_section(L::ZZLat, f::QQMatrix) else # search a smallish section using a cvp A = change_base_ring(ZZ,basis_matrix(L)*gram_matrix(V)*transpose(f)) - ss = solve_left(A,identity_matrix(ZZ,1)) + ss = Solve.solve(A,identity_matrix(ZZ,1); side = :left) s = ss*basis_matrix(L) - k, K = left_kernel(A) + K = Solve.kernel(A; side = :left) + k = nrows(K) Kl = integer_lattice(gram=K*transpose(K)) # project ss to K sK = solve(change_base_ring(QQ,K*transpose(K)),change_base_ring(QQ,K*transpose(ss))) @@ -2070,7 +2071,8 @@ fibration_type(NS::ZZLat, f::Vector) = fibration_type(NS, matrix(QQ, 1, degree(N ################################################################################ function _common_invariant(Gamma) - return left_kernel(reduce(hcat,[g-1 for g in Gamma])) + K = Solve.kernel(reduce(hcat,[g-1 for g in Gamma]); side = :left) + return nrows(K), K end @doc raw""" diff --git a/src/AlgebraicGeometry/ToricVarieties/ToricMorphisms/attributes.jl b/src/AlgebraicGeometry/ToricVarieties/ToricMorphisms/attributes.jl index 4b85615f2109..0dfa3f159681 100644 --- a/src/AlgebraicGeometry/ToricVarieties/ToricMorphisms/attributes.jl +++ b/src/AlgebraicGeometry/ToricVarieties/ToricMorphisms/attributes.jl @@ -78,7 +78,7 @@ Map v = [images[i,k] for k in 1:ncols(images)] j = findfirst(x -> x == true, [(v in maximal_cones(cod)[j]) for j in 1:nmaxcones(cod)]) m = reduce(vcat, [Int(ray_indices(maximal_cones(cod))[j, k]) * cod_rays[k:k, :] for k in 1:nrays(cod)]) - mapping_matrix = hcat(mapping_matrix, solve(transpose(m), transpose(images[i:i, :]))) + mapping_matrix = hcat(mapping_matrix, Solve.solve(transpose(m), transpose(images[i:i, :]); side = :right)) end return hom(torusinvariant_weil_divisor_group(d), torusinvariant_weil_divisor_group(cod), transpose(mapping_matrix)) end @@ -240,7 +240,7 @@ Covering hb_V_mat = matrix(ZZ, hb_V) hb_V_img = hb_V_mat * At hb_U_mat = matrix(ZZ, hb_U) - sol = solve_left(hb_U_mat, hb_V_img) + sol = Solve.solve(hb_U_mat, hb_V_img; side = :left) @assert sol*hb_U_mat == hb_V_img @assert all(x->x>=0, sol) diff --git a/src/Oscar.jl b/src/Oscar.jl index 2c02dfa3a82d..432adb134afd 100644 --- a/src/Oscar.jl +++ b/src/Oscar.jl @@ -203,6 +203,27 @@ function build() system("Build.jl") end +# temporarily + +import AbstractAlgebra: Solve + +const solve = AbstractAlgebra.Solve.solve +const can_solve = AbstractAlgebra.Solve.can_solve +const can_solve_with_solution = AbstractAlgebra.Solve.can_solve_with_solution + +kernel(args...; kw...) = Hecke.kernel(args...; kw...) + +export solve, can_solve, can_solve_with_solution, kernel + +function kernel(M::MatElem; side::Symbol = :right) + return AbstractAlgebra.Solve.kernel(M, side = side) +end + +function kernel(R::Ring, M::MatElem; side::Symbol = :right) + return AbstractAlgebra.Solve.kernel(R, M, side = side) +end + + include("assertions.jl") include("exports.jl") diff --git a/src/Rings/AbelianClosure.jl b/src/Rings/AbelianClosure.jl index 9496cef12842..aacb5b5ef8ed 100644 --- a/src/Rings/AbelianClosure.jl +++ b/src/Rings/AbelianClosure.jl @@ -38,6 +38,8 @@ import ..Oscar: AbstractAlgebra, addeq!, characteristic, elem_type, divexact, ge has_preimage_with_preimage, is_root_of_unity, is_unit, mul!, parent, parent_type, promote_rule, root, root_of_unity, roots +import ..Oscar: Solve + using Hecke import Hecke: conductor, data @@ -923,7 +925,7 @@ function _embedding(F::AbsSimpleNumField, K::QQAbField{AbsSimpleNumField}, x = Hecke.force_coerce_cyclo(Kn, x) # ... and then w.r.t. `F` a = Hecke.coefficients(x) - fl, sol = can_solve_with_solution(c, matrix(QQ, length(a), 1, a)) + fl, sol = Solve.can_solve_with_solution(c, matrix(QQ, length(a), 1, a); side = :right) if fl b = transpose(sol) b = [b[i] for i in 1:length(b)] diff --git a/src/Rings/groebner.jl b/src/Rings/groebner.jl index 473522b94952..5e5de7ee6af5 100644 --- a/src/Rings/groebner.jl +++ b/src/Rings/groebner.jl @@ -1561,7 +1561,7 @@ function _find_weights(F::Vector{P}) where {P <: MPolyRingElem} exp_diffs = permutedims(reduce(hcat, [e[i] - e[1] for e in (collect).((exponents).(F)) for i in 2:length(e)])) - K = kernel(matrix(QQ, nrows, ncols, exp_diffs))[2] + K = Solve.kernel(matrix(QQ, nrows, ncols, exp_diffs); side = :right) isempty(K) && return zeros(Int, ncols) # Here we try to find a vector with strictly positive entries in K # this method to find such a vector is taken from diff --git a/src/imports.jl b/src/imports.jl index b17da7fc48b9..19915f75c58c 100644 --- a/src/imports.jl +++ b/src/imports.jl @@ -175,6 +175,10 @@ let exclude_hecke = [ :tail, :terms, :YoungTableau, + :kernel, + :solve, + :can_solve, + :can_solve_with_solution, ] for i in names(Hecke) (i in exclude_hecke || !isdefined(Hecke, i)) && continue diff --git a/test/AlgebraicGeometry/Surfaces/K3Auto.jl b/test/AlgebraicGeometry/Surfaces/K3Auto.jl index f61abfe36079..3894ee26f135 100644 --- a/test/AlgebraicGeometry/Surfaces/K3Auto.jl +++ b/test/AlgebraicGeometry/Surfaces/K3Auto.jl @@ -32,7 +32,7 @@ end S = integer_lattice(B, gram = G); weyl = QQ[31 61 52 71 5 -6 5 -2 -7 8] - weylk3 = change_base_ring(ZZ,solve_left(basis_matrix(L), weyl)) + weylk3 = change_base_ring(ZZ,Oscar.Solve.solve(basis_matrix(L), weyl; side = :left)) k3,_ = BorcherdsCtx(L, S, weylk3; compute_OR=false) walls = Oscar._walls_of_chamber(k3, weylk3) @test length(walls)==4 @@ -107,7 +107,7 @@ end # This is the a little expensive bit ... we leave it to the lower dimensional tests # weyl1, u, hh = Oscar.weyl_vector_non_degenerate(L, S, u0, weyl, h) weyl1 = QQ[80 30 -4 -14 -27 11 2 -12 -14 1 9 7 -1 -2 16 -12 4 7 11 6 -1 1 0 3 1 0] - weyl2 = change_base_ring(ZZ, solve_left(basis_matrix(L), weyl1)) + weyl2 = change_base_ring(ZZ, Oscar.Solve.solve(basis_matrix(L), weyl1; side = :left)) _, k3aut, chambers, rational_mod_aut =borcherds_method(L, S, weyl2, compute_OR=true) @test order(matrix_group(k3aut))==6