Skip to content

Commit

Permalink
Require non-zero coefficient ring in laurent/puiseux constructions (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens authored Oct 11, 2024
1 parent abbe2ac commit e55a64c
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/src/constructors.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ AbstractAlgebra.jl and explain what mathematical domains they represent.
| $S = K((x))$ (to precision $n$) | `S, x = laurent_series_field(K, n, :x)` |
| $S = R((x, y))$ (to precision $n$) | `S, (x, y) = laurent_polynomial_ring(R, n, [:x, :y])` |
| Puiseux series ring to precision $n$ | `S, x = puiseux_series_ring(R, n, :x)` |
| Puiseux series field to precision $n$| `S, x = puiseux_series_field(R, n, :x)` |
| Puiseux series field to precision $n$| `S, x = puiseux_series_field(K, n, :x)` |
| $S = K(x)(y)/(f)$ | `S, y = function_field(f, :y)` with $f\in K(x)[t]$ |
| $S = \mathrm{Frac}_R$ | `S = fraction_field(R)` |
| $S = R/(f)$ | `S, = residue_ring(R, f)` |
Expand Down
6 changes: 4 additions & 2 deletions src/LaurentPoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,7 @@ julia> rand(R, -3:3, -9:9)
-3*x^2 - 8*x + 4 + 3*x^-1 - 6*x^-2 + 9*x^-3
```
"""
laurent_polynomial_ring(R::Ring, s::VarName; cached::Bool = true) =
Generic.laurent_polynomial_ring(R, Symbol(s); cached)
function laurent_polynomial_ring(R::Ring, s::VarName; cached::Bool = true)
@req !is_trivial(R) "Zero rings are currently not supported as coefficient ring."
return Generic.laurent_polynomial_ring(R, Symbol(s); cached)
end
6 changes: 4 additions & 2 deletions src/LaurentSeries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ object `S` will be cached so that supplying the same base ring, string and
precision in future will return the same parent object and generator. If
caching of the parent object is not required, `cached` can be set to `false`.
"""
laurent_series_ring(R::Ring, prec::Int, s::VarName; cached::Bool=true) =
Generic.laurent_series_ring(R, prec, Symbol(s); cached)
function laurent_series_ring(R::Ring, prec::Int, s::VarName; cached::Bool=true)
@req !is_trivial(R) "Zero rings are currently not supported as coefficient ring."
return Generic.laurent_series_ring(R, prec, Symbol(s); cached)
end

@doc raw"""
laurent_series_field(R::Field, prec::Int, s::VarName; cached::Bool=true)
Expand Down
11 changes: 7 additions & 4 deletions src/PuiseuxSeries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ object `S` will be cached so that supplying the same base ring, string and
precision in future will return the same parent object and generator. If
caching of the parent object is not required, `cached` can be set to `false`.
"""
puiseux_series_ring(R::Ring, prec::Int, s::VarName; cached::Bool=true) =
Generic.PuiseuxSeriesRing(R, prec, Symbol(s); cached)
function puiseux_series_ring(R::Ring, prec::Int, s::VarName; cached::Bool=true)
@req !is_trivial(R) "Zero rings are currently not supported as coefficient ring."
return Generic.PuiseuxSeriesRing(R, prec, Symbol(s); cached)
end

puiseux_series_field(R::Field, prec::Int, s::VarName; cached::Bool=true) =
Generic.PuiseuxSeriesField(R, prec, Symbol(s); cached)
function puiseux_series_field(R::Field, prec::Int, s::VarName; cached::Bool=true)
return Generic.PuiseuxSeriesField(R, prec, Symbol(s); cached)
end
1 change: 1 addition & 0 deletions src/generic/LaurentMPoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ end
###############################################################################

function laurent_polynomial_ring(R::AbstractAlgebra.Ring, s::Vector{Symbol}; cached::Bool = true)
@req !is_trivial(R) "Zero rings are currently not supported as coefficient ring."
P, x = AbstractAlgebra.polynomial_ring(R, s, cached = cached)
R = LaurentMPolyWrapRing(P, cached)
R, map(p -> LaurentMPolyWrap(R, p), x)
Expand Down
1 change: 1 addition & 0 deletions src/generic/LaurentPoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ end
###############################################################################

function laurent_polynomial_ring(R::AbstractAlgebra.Ring, s::Symbol; cached::Bool = true)
@req !is_trivial(R) "Zero rings are currently not supported as coefficient ring."
P, x = AbstractAlgebra.polynomial_ring(R, s, cached = cached)
R = LaurentPolyWrapRing(P, cached)
R, LaurentPolyWrap(R, x)
Expand Down

0 comments on commit e55a64c

Please sign in to comment.