Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup katsura docstrings #1405

Merged
merged 1 commit into from
Jun 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/Rings/special_ideals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ end
@doc Markdown.doc"""
katsura(n::Int)

Given a natural number `n` returns the Katsura ideal generated by\
$u_m - \sum_{l=n}^n u_{l-m} u_l $, $ 1 - \sum_{l = -n}^n u_l $
where $u_{-i} = u_i$, and $u_i = 0$ for $i > n$ and $m \in \{-n, \ldots, n\}$. \
Given a natural number `n` returns the Katsura ideal generated by
$u_m - \sum_{l=n}^n u_{l-m} u_l$, $1 - \sum_{l = -n}^n u_l$
where $u_{-i} = u_i$, and $u_i = 0$ for $i > n$ and $m \in \{-n, \ldots, n\}$.
Also note that indices have been shifted to start from 1.

# Example
```jldoctest
julia> katsura(3)
ideal(x1 + 2*x2 + 2*x3 + 2*x4 - 1, x1^2 - x1 + 2*x2^2 + 2*x3^2 + 2*x4^2, 2*x1*x2 + 2*x2*x3 - x2 + 2*x3*x4, 2*x1*x3 + x2^2 + 2*x2*x4 - x3)
julia> katsura(2)
ideal(x1 + 2*x2 + 2*x3 - 1, x1^2 - x1 + 2*x2^2 + 2*x3^2, 2*x1*x2 + 2*x2*x3 - x2)
```
"""
function katsura(n::Int)
Expand All @@ -34,17 +34,20 @@ end
@doc Markdown.doc"""
katsura(R::MPolyRing)

Returns the Katsura ideal in the given Polynomial Ring R.
Returns the Katsura ideal in the given polynomial ring `R`.

# Example
```jldoctest
julia> R, _ = QQ["x", "y", "z"]
(Multivariate Polynomial Ring in x, y, z over Rational Field, fmpq_mpoly[x, y, z])

julia> katsura(R)
ideal(x + 2*y + 2*z - 1, x^2 - x + 2*y^2 + 2*z^2, 2*x*y + 2*y*z - y)
```
"""
function katsura(R::MPolyRing)
CR = coefficient_ring(R)
polys = Vector{elem_type(R)}()
polys = elem_type(R)[]
n = nvars(R) - 1
coeffs_vec = 2 * ones(elem_type(CR), n + 1)
coeffs_vec[1] = CR(1)
Expand Down