Skip to content
Merged
Show file tree
Hide file tree
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
41 changes: 18 additions & 23 deletions src/sage/quadratic_forms/genera/genus.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
lazy_import('sage.interfaces.magma', 'magma')


def genera(sig_pair, determinant, max_scale=None, even=False):
def genera(sig_pair, determinant, max_scale=None, even=False) -> list:
r"""
Return a list of all global genera with the given conditions.

Expand All @@ -51,7 +51,7 @@
- ``determinant`` -- integer; the sign is ignored

- ``max_scale`` -- (default: ``None``) an integer; the maximum scale of a
jordan block
Jordan block

- ``even`` -- boolean (default: ``False``)

Expand Down Expand Up @@ -139,7 +139,7 @@

- ``det_val`` -- valuation of the determinant at `p`

- ``max_scale`` -- integer the maximal scale of a jordan block
- ``max_scale`` -- integer the maximal scale of a Jordan block

- ``even`` -- boolean; ignored if `p` is not `2`

Expand Down Expand Up @@ -225,7 +225,7 @@

def _blocks(b, even_only=False):
r"""
Return all viable `2`-adic jordan blocks with rank and scale given by ``b``.
Return all viable `2`-adic Jordan blocks with rank and scale given by ``b``.

This is a helper function for :meth:`_local_genera`.
It is based on the existence conditions for a modular `2`-adic genus symbol.
Expand Down Expand Up @@ -589,23 +589,22 @@
return compartments


def canonical_2_adic_trains(genus_symbol_quintuple_list, compartments=None):
def canonical_2_adic_trains(genus_symbol_quintuple_list) -> list:
r"""
Given a `2`-adic local symbol (as the underlying list of quintuples)
this returns a list of lists of indices of the
``genus_symbol_quintuple_list`` which are in the same train. A train
is defined to be a maximal interval of Jordan components so that
at least one of each adjacent pair (allowing zero-dimensional
Jordan components) is (scaled) of type I (i.e. odd).
Note that an interval of length one respects this condition as
there is no pair in this interval.
Given a `2`-adic local symbol, return a list of lists of indices
of the ``genus_symbol_quintuple_list`` which are in the same train.

A train is defined to be a maximal interval of Jordan components
so that at least one of each adjacent pair (allowing
zero-dimensional Jordan components) is (scaled) of type I
(i.e. odd). Note that an interval of length one respects this
condition as there is no pair in this interval.
In particular, every Jordan component is part of a train.

INPUT:

- ``genus_symbol_quintuple_list`` -- a quintuple of integers (with certain
restrictions).
- ``compartments`` -- this argument is deprecated
- ``genus_symbol_quintuple_list`` -- a `2`-adic local symbol as a list of
quintuples of integers (with certain restrictions).

OUTPUT: list of lists of distinct integers

Expand Down Expand Up @@ -654,12 +653,8 @@

See [CS1999]_, pp. 381-382 for definitions and examples.
"""
if compartments is not None:
from sage.misc.superseded import deprecation
deprecation(23955, "the compartments keyword has been deprecated")

# avoid a special case for the end of symbol
# if a jordan component has rank zero it is considered even.
# if a Jordan component has rank zero it is considered even.
symbol = genus_symbol_quintuple_list
symbol.append([symbol[-1][0]+1, 0, 1, 0, 0]) # We have just modified the input globally!
# Hence, we have to remove the last entry of symbol at the end.
Expand All @@ -680,7 +675,7 @@
trains.append(new_train)
new_train = [i]
else:
# there is an odd jordan block adjacent to this jordan block
# there is an odd Jordan block adjacent to this Jordan block
# the train continues
new_train.append(i)
# the last train was never added.
Expand Down Expand Up @@ -3224,7 +3219,7 @@

sage: d = ZZ.random_element(1, 1000)
sage: n = ZZ.random_element(2, 10)
sage: L = genera((n,0), d, d, even=False)

Check warning on line 3222 in src/sage/quadratic_forms/genera/genus.py

View workflow job for this annotation

GitHub Actions / Conda (macos, Python 3.11, all)

Warning: slow doctest:

slow doctest:: Test ran for 7.59s cpu, 11.48s wall Check ran for 0.00s cpu, 0.00s wall
sage: k = ZZ.random_element(0, len(L))
sage: G = L[k]
sage: G.mass()==G.mass(backend='magma') # optional - magma
Expand Down Expand Up @@ -3318,7 +3313,7 @@

def _gram_from_jordan_block(p, block, discr_form=False):
r"""
Return the Gram matrix of this jordan block.
Return the Gram matrix of this Jordan block.

This is a helper for :meth:`discriminant_form` and :meth:`gram_matrix`.
No input checks.
Expand Down
37 changes: 7 additions & 30 deletions src/sage/quadratic_forms/quadratic_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from sage.matrix.matrix_space import MatrixSpace
from sage.misc.functional import denominator, is_even
from sage.misc.lazy_import import lazy_import
from sage.misc.superseded import deprecated_function_alias, deprecation
from sage.misc.superseded import deprecated_function_alias
from sage.modules.free_module_element import vector
from sage.quadratic_forms.quadratic_form__evaluate import (
QFEvaluateMatrix,
Expand All @@ -46,29 +46,6 @@
from sage.structure.sage_object import SageObject


def is_QuadraticForm(Q):
"""
Determine if the object ``Q`` is an element of the :class:`QuadraticForm` class.

This function is deprecated.

EXAMPLES::

sage: Q = QuadraticForm(ZZ, 2, [1,2,3])
sage: from sage.quadratic_forms.quadratic_form import is_QuadraticForm
sage: is_QuadraticForm(Q)
doctest:...: DeprecationWarning: the function is_QuadraticForm is deprecated;
use isinstance(x, sage.quadratic_forms.quadratic_form.QuadraticForm) instead...
True
sage: is_QuadraticForm(2)
False
"""
deprecation(35305,
"the function is_QuadraticForm is deprecated; use "
"isinstance(x, sage.quadratic_forms.quadratic_form.QuadraticForm) instead")
return isinstance(Q, QuadraticForm)


def quadratic_form_from_invariants(F, rk, det, P, sminus):
r"""
Return a rational quadratic form with given invariants.
Expand Down Expand Up @@ -521,7 +498,7 @@ def __init__(
unsafe_initialization=False,
number_of_automorphisms=None,
determinant=None,
):
) -> None:
"""
EXAMPLES::

Expand Down Expand Up @@ -721,7 +698,7 @@ def __pari__(self):
"""
return self.matrix().__pari__()

def _pari_init_(self):
def _pari_init_(self) -> str:
"""
Return a PARI-formatted Hessian matrix for Q, as string.

Expand All @@ -733,7 +710,7 @@ def _pari_init_(self):
"""
return self.matrix()._pari_init_()

def _repr_(self):
def _repr_(self) -> str:
"""
Give a text representation for the quadratic form given as an upper-triangular matrix of coefficients.

Expand All @@ -758,7 +735,7 @@ def _repr_(self):
out_str += "]"
return out_str

def _latex_(self):
def _latex_(self) -> str:
"""
Give a LaTeX representation for the quadratic form given as an upper-triangular matrix of coefficients.

Expand Down Expand Up @@ -847,7 +824,7 @@ def __setitem__(self, ij, coeff):
except Exception:
raise RuntimeError("this coefficient cannot be coerced to an element of the base ring for the quadratic form")

def __hash__(self):
def __hash__(self) -> int:
r"""
TESTS::

Expand All @@ -861,7 +838,7 @@ def __hash__(self):
"""
return hash(self.__base_ring) ^ hash(tuple(self.__coeffs))

def __eq__(self, right):
def __eq__(self, right) -> bool:
"""
Determines if two quadratic forms are equal.

Expand Down
Loading