diff --git a/src/MultivariateBases.jl b/src/MultivariateBases.jl index b3104a4..098fc7a 100644 --- a/src/MultivariateBases.jl +++ b/src/MultivariateBases.jl @@ -16,7 +16,7 @@ end Variables{B}(vars) where {B} = Variables{B,typeof(vars)}(vars) function Base.one(v::Variables) - return MP.monomial(v.variables, constant_monomial_exponents(v)) + return Polynomial(v, constant_monomial_exponents(v)) end function variable_index(v::Variables, var) diff --git a/test/monomial.jl b/test/monomial.jl index cd24a10..1781b7e 100644 --- a/test/monomial.jl +++ b/test/monomial.jl @@ -14,6 +14,8 @@ function test_monomial(x, y) @test vars(exponents(x^3)) != vars(exponents(x^2)) o = vars(exponents(constant_monomial(x^2))) @test isone(o) + @test one(vars) isa MB.Polynomial + @test isone(one(vars)) vars2 = MB.Variables{MB.Monomial}(_copy(variables(x))) @test vars == vars2 @test hash(vars) == hash(vars2) @@ -150,6 +152,7 @@ function test_monomial(x, y) @testset "constant_algebra_element ordering" begin ce = MB.constant_algebra_element(full, Float64) + @test isone(ce) keys, vals = test_graded_order(ce) @test keys == [e_00] @test vals == [1.0]