diff --git a/Project.toml b/Project.toml index b5bc817f3..0f38ef2bb 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "Singular" uuid = "bcd08a7b-43d2-5ff7-b6d4-c458787f915c" -version = "0.21.1" +version = "0.21.2" [deps] AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d" diff --git a/src/number/n_transExt.jl b/src/number/n_transExt.jl index 127f9d76e..489b9e2b5 100644 --- a/src/number/n_transExt.jl +++ b/src/number/n_transExt.jl @@ -358,6 +358,13 @@ function (F::Singular.N_FField)(x::fpFieldElem) return n_transExt(F, x.data) end +function (F::Singular.N_FField)(x::FqFieldElem) + if characteristic(F) != characteristic(parent(x)) + throw(ArgumentError("wrong characteristic")) + end + return n_transExt(F, lift(Nemo.ZZ, x)) +end + function (F::Singular.N_FField)(x::Union{n_Q, Nemo.QQFieldElem, Rational}) return F(numerator(x)) // F(denominator(x)) end diff --git a/test/libsingular/nemo-test.jl b/test/libsingular/nemo-test.jl index cb2619b2c..207ecdb3b 100644 --- a/test/libsingular/nemo-test.jl +++ b/test/libsingular/nemo-test.jl @@ -102,11 +102,11 @@ end end @testset "Nemo.fqPolyRepFieldElem" begin - F, _ = Nemo.finite_field(Nemo.next_prime(fld(typemax(Int),2)), 2, "a") + F, _ = Nemo.Native.finite_field(Nemo.next_prime(fld(typemax(Int),2)), 2, "a") R, _ = polynomial_ring(F, ["x", "y"]) @test R isa Singular.PolyRing{Singular.n_FieldElem{Nemo.fqPolyRepFieldElem}} - F, a = Nemo.finite_field(7, 2, "a") + F, a = Nemo.Native.finite_field(7, 2, "a") R, (x, y) = polynomial_ring(F, ["x", "y"]) @@ -162,11 +162,11 @@ end end @testset "Nemo.FqPolyRepFieldElem" begin - F, _ = Nemo.finite_field(Nemo.next_prime(Nemo.ZZ(10)^50), 2, "a") + F, _ = Nemo.Native.finite_field(Nemo.next_prime(Nemo.ZZ(10)^50), 2, "a") R, _ = polynomial_ring(F, ["x", "y"]) @test R isa Singular.PolyRing{Singular.n_FieldElem{Nemo.FqPolyRepFieldElem}} - F, a = Nemo.finite_field(Nemo.ZZ(7), 2, "a") + F, a = Nemo.Native.finite_field(Nemo.ZZ(7), 2, "a") R, (x, y) = polynomial_ring(F, ["x", "y"]) @@ -276,7 +276,7 @@ end @testset "Nemo.gfp_fmpz_mod.polynomial_ring" begin - U = Nemo.GF(Nemo.ZZRingElem(11)) + U = Nemo.Native.GF(Nemo.ZZRingElem(11)) R, (x, y) = polynomial_ring(U, ["x", "y"]) @@ -318,7 +318,7 @@ end @testset "Nemo.gfp_fmpz_mod.WeylAlgebra" begin - U = Nemo.GF(Nemo.ZZRingElem(11)) + U = Nemo.Native.GF(Nemo.ZZRingElem(11)) R, (x, y, dx, dy) = @inferred WeylAlgebra(U, ["x", "y"]) @@ -375,20 +375,20 @@ end @test F(one(R)*i) == one(F)*i end - S = Nemo.GF(5) + S = Nemo.Native.GF(5) @test_throws ErrorException S(one(F)) @test_throws ErrorException F(one(S)) end @testset "Nemo.fpFieldElem" begin - R = Nemo.GF(7) + R = Nemo.Native.GF(7) F = Fp(7) for i in -10:10 @test R(one(F)*i) == one(R)*i @test F(one(R)*i) == one(F)*i end - S = Nemo.GF(5) + S = Nemo.Native.GF(5) @test_throws ErrorException S(one(F)) @test_throws ErrorException F(one(S)) end diff --git a/test/number/n_transExt-test.jl b/test/number/n_transExt-test.jl index e3540d404..f3bc3cecb 100644 --- a/test/number/n_transExt-test.jl +++ b/test/number/n_transExt-test.jl @@ -75,8 +75,8 @@ end @test F(1//2) == big(1//2) @test F(1//2) == QQ(1//2) @test F(1//2) == Nemo.QQ(1//2) - @test F(Nemo.GF(5)(3)) == 1//2 - @test_throws Exception F(Nemo.GF(7)(3)) + @test F(Nemo.Native.GF(5)(3)) == 1//2 + @test_throws Exception F(Nemo.Native.GF(7)(3)) end @testset "n_transExt.unary_ops" begin