Skip to content

Commit 61b6d9d

Browse files
authored
Add var_indices for universal polynomials (Nemocas#2220)
1 parent 5f9adba commit 61b6d9d

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/generic/UnivPoly.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ end
280280

281281
var_index(x::UnivPoly) = var_index(data(x))
282282

283+
var_indices(p::UnivPoly) = var_indices(data(p))
284+
283285
function vars(p::UnivPoly{T}) where {T <: RingElement}
284286
V = vars(data(p))
285287
S = parent(p)

test/generic/UnivPoly-test.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,13 @@ end
147147
@test symbols(S) == [:x, :y, :z]
148148

149149
@test length(vars(S())) == 0
150+
@test length(var_indices(S())) == 0
150151
@test vars(x^2 + 2x + 1) == [x]
152+
@test var_indices(x^2 + 2x + 1) == [1]
151153
@test vars(x*y + 1) == [x, y]
154+
@test var_indices(x*y + 1) == [1, 2]
152155
@test vars(x*y + z) == [x, y, z]
156+
@test var_indices(x*y + z) == [1, 2, 3]
153157

154158
@test internal_ordering(S) == ord
155159
end

0 commit comments

Comments
 (0)