Skip to content

Commit

Permalink
Use solve instead of can_solve_with... and assert
Browse files Browse the repository at this point in the history
  • Loading branch information
joschmitt committed Feb 16, 2024
1 parent 45b52d0 commit ab42a44
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 15 deletions.
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; side = :right)
@assert fl
sol = solve(lgs, rhs; side = :right)
return transpose(sol)
end
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
5 changes: 2 additions & 3 deletions experimental/Rings/QQAbAndPChars.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ 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)
@assert s[1]
return evaluate(FacElem(Dict([(Chi.b[i], s[2][1, i]) for i = 1:length(Chi.b)])))
s = solve(Chi.A, b, side = :left)
return evaluate(FacElem(Dict([(Chi.b[i], s[1, i]) for i = 1:length(Chi.b)])))
end

function (Chi::PartialCharacter)(b::Vector{ZZRingElem})
Expand Down
3 changes: 1 addition & 2 deletions experimental/SymmetricIntersections/src/representations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1316,8 +1316,7 @@ function quotient_representation(rep::LinRep{S, T, U}, M::W) where {S, T, U, W <
mr = matrix_representation(rep)
coll = eltype(mr)[]
for m in mr
ok, mm = can_solve_with_solution(proj, m*proj; side=:right)
@assert ok
mm = solve(proj, m*proj; side=:right)
push!(coll, mm)
end
repQ = _linear_representation(representation_ring(rep), coll)
Expand Down
6 changes: 2 additions & 4 deletions src/InvariantTheory/affine_algebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,7 @@ function relations_primary_and_irreducible_secondary(RG::InvRing)

# Write the products (in N) in the basis of K[V]^G_d given by the secondary
# invariants (in M)
fl, x = can_solve_with_solution(M, N, side = :left)
@assert fl
x = solve(M, N, side = :left)

# Translate the relations to the free algebra S
for i = 1:nrows(x)
Expand Down Expand Up @@ -308,8 +307,7 @@ function module_syzygies(RG::InvRing)
monomial_to_column = enumerate_monomials(gens_d)
M = polys_to_smat(gens_d, monomial_to_column)
N = polys_to_smat(s_invars_d, monomial_to_column)
fl, sol = can_solve_with_solution(M, N, side = :left)
@assert fl
sol = solve(M, N, side = :left)

for i in 1:length(s_invars_d)
a = F()
Expand Down

0 comments on commit ab42a44

Please sign in to comment.