The algorithms explained in my habilitation for computing with quadratic and hermitian lattices over number fields have been implemented in Magma and can be downloaded here.

Note that the text below does not explain all intrinsics in this package but only the most important ones. For a complete list of intrinsics and all their options, please refer to the source code.

```
> AttachSpec("lat.spec");
```

Let K be an absolute abgebraic number field (note that the rationals are not a number field in Magma, but you can use K:= QNF(); to construct a degree one extension of Q which is a number field).

Given a Dedekind module M over Z_{K}and a non-degenerate symmetric matrix F over K, construct the lattice with module M in the quadratic space with Gram matrix F. If M is a matrix, the module is taken to be generated be the rows of M. If M is omitted, it is taken to be the free standard module.

Given a non-degenerate symmetric matrix F over K, constructs a maximal integral lattice L in the quadratic space with Gram matrix F. Note that the lattice L is not unique, but its genus is.Here are two examples:

> K:= QuadraticField(5); > L:= LatticeModule( Matrix(K, 2, [1,2, 2,3]), MatrixRing(K, 2) ! 3);This constructs the lattice with module generated by (1,2) and (2,3) inside the bilinear space K

> M:= MaximalIntegralLattice(Matrix(K, 2, [1,2,2,1]));

Suppose now E is a degree 2 extension of an algebraic number field K. (K might be the field of rationals Q.)

Given a Dedekind module M over ZIn the following example, we consider E = Q(\zeta_5) as a quadratic extension over K = Q(\sqrt(5)) and construct a binary hermitian lattice over E._{E}and a non-degenerate hermitian matrix F over E, construct the lattice with module M in the hermitian space with Gram matrix F. If M is a matrix, the module is taken to be generated be the rows of M. If M is omitted, it is taken to be the free standard module.

> C:= CyclotomicField(5); > K:= sub< C | C.1+C.1^-1>; > E:= RelativeField(K, C); > HermitianLattice( Matrix(E, 2, [1,2, 2,3]), Matrix(E, 2, [1, E.1, E.1^-1, 0]));

Given a non-degenerate hermitian matrix F over K, constructs a maximal integral lattice L in the hermitian space with Gram matrix F. Note that the lattice L is not unique, but its genus is.

Let E and K be as before.

Every quadratic space V over K of rank n admits an orthogonal Gram matrix Diag(a_{1},...,a_{n}) say.
Given a place p of K, let (a,b)_{p} be the Hilbert symbol of a and b over K_{p}.
Then ∏_{i<j} (a_{i}, a_{i})_{p} denotes the Hasse symbol of V at the place p.

Returns a Gram matrix of a quadratic space over K with rank Dim, determinant Det, whose local Hasse invariants are -1 at the finite places in P and whose signature has N_{i}negative entries at the i-th real place of K. The field K is taken to be the parent of Det.

Returns a Gram matrix of a hermitian space over E with rank Dim, whose determinant is a non-norm at the finite places in P and whose signature has NHere is an example:_{i}negative entries at the i-th real place of K which remains real in E.

> K:= QuadraticField(5); > QuadraticFormWithInvariants(3, K ! 1, {2 * Integers(K)}, [2, 0]); [ 2 0 0] [ 0 1/2*(-K.1 - 1) 0] [ 0 0 -K.1 - 1] > HermitianFormWithInvariants(QuadraticField(3), 2, {3,5}, []); [1 0] [0 5]

Checks if the quadratic or hermitian form F is isotropic. If IsotropicVector is set to true, an isotropic vector is also returned.

Checks if the quadratic or hermitian forms F and G are isometric. If Isometry is set to true, it also returns a matrix T such that T F T^* = G.Here is an example:

> K<a>:= QuadraticField(-3); > F:= DiagonalMatrix( [ K | 2,2,2] ); > G:= DiagonalMatrix( [ K | 1,2,3] ); > AreEquivalentHermitianForms(F, G : Isometry); true [ 0 1/2 -1/2] [ 1 0 0] [ 0 -1/2*a -1/2*a]

Let L,M be quadratic or hermitian lattices over the same field.

Returns the underlying Dedekind module of L.

Returns the Gram matrix of the ambient quadratic or hermitian space.

Returns the ring of integers of K of E depending on L is a quadratic of hermitian lattice.

Returns the fractional ideal { (x,y) | x,y in L }.

Returns the fractional ideal generated by { (x,x) | x in L }.

Returns the fractional ideal D such that D_{p}is generated by det(L_{p}) at all finite places p.

Returns the dual lattice of L.

Given a place of K or a prime ideal of Z_{K}, tests whether L_{p}is isotropic.

Tests whether L_{p}and M_{p}are isometric at the prime ideal p of Z_{K}.

Test whether L and M lie in the same (a similar) genus.

Computes a list of representatives of the isometry classes in the genus of L.TODO: Add some more?

Tests if the lattices L and M are isometric. If so, the second return value is an isometry between L and M (with respect to the standard basis of the ambient spaces of L and M).

Tests if the lattices L and M are similar.

Returns the automorphism group of L with respect to the standard basis of the ambient space of L.

Returns the Siegel mass of L.

Returns the (unique) indecomposable sublattices of L. They are pairwise orthogonal and their sum is L.