Skip to content

Commit

Permalink
add SLPolyRing(ring, n) ≡ SLPolyRing(ring, ["x1", ..., "x$n"])
Browse files Browse the repository at this point in the history
  • Loading branch information
rfourquet committed Jun 24, 2020
1 parent 5e5289d commit 8222869
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/slpolys.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ SLPolyRing(r::Ring, s::Union{AbstractVector{<:AbstractString},
AbstractVector{<:AbstractChar}}) =
SLPolyRing(r, Symbol.(s))

SLPolyRing(r::Ring, n::Integer) = SLPolyRing(r, [Symbol("x$i") for i=1:n])

base_ring(S::SLPolyRing) = S.base_ring

symbols(S::SLPolyRing) = S.S
Expand Down
14 changes: 14 additions & 0 deletions test/straightline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,20 @@ end
@test parent(y) == S3
end

S4 = SLPolyRing(zz, 3)
@test S4 isa SLPolyRing{Int}
@test ngens(S4) == 3
X = gens(S4)
@test length(X) == 3
@test string.(X) == ["x1", "x2", "x3"]

S4, X = SL.PolynomialRing(zz, 0x2)
@test S4 isa SLPolyRing{Int}
@test ngens(S4) == 2
X = gens(S4)
@test length(X) == 2
@test string.(X) == ["x1", "x2"]

s1 = one(S)
@test s1 == 1
@test s1 isa SLPoly{Int}
Expand Down

0 comments on commit 8222869

Please sign in to comment.