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.

## How to use this package with Magma

First, attach the package to your running Magma process.

> 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).

#### LatticeModule(F) : Mtrx -> LatMod

Given a Dedekind module M over ZK 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.

#### MaximalIntegralLattice(F) : Mtrx -> LatMod

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 K2 equipped with the form given by 3*I2.
> M:= MaximalIntegralLattice(Matrix(K, 2, [1,2,2,1]));


## Constructing hermitian lattices

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

#### HermitianLattice(F) : Mtrx -> LatModHerm

Given a Dedekind module M over ZE 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.
In 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.
> 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]));


#### MaximalIntegralHermitianLattice(F) : Mtrx -> LatModHerm

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.

## Constructing forms from local invariants

Let E and K be as before.

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

#### QuadraticFormWithInvariants(Dim, Det, P, N) : RngIntElt, FldAlgElt, {}, [] -> Mtrx

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 Ni negative entries at the i-th real place of K. The field K is taken to be the parent of Det.

#### HermitianFormWithInvariants(E, Dim, Finite, N) : FldAlg, RngIntElt, {}, [] -> Mtrx

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 Ni negative entries at the i-th real place of K which remains real in E.
Here is an example:
> 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]
[1 0]
[0 5]


## Intrinsics for all lattices

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

#### Module(L) : LatMod -> ModDed

Returns the underlying Dedekind module of L.

#### InnerProductMatrix(L) : LatMod -> Mtrx

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

#### BaseRing(L) : LatMod -> RngOrd

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

#### Scale(L) : LatMod -> RngOrdFracIdl

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

#### Norm(L) : LatMod -> RngOrdFracIdl

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

#### Determinant(L) : LatMod -> RngOrdFracIdl

Returns the fractional ideal D such that Dp is generated by det(Lp) at all finite places p.

#### Dual(L) : LatMod -> LatMod

Returns the dual lattice of L.

#### IsLocallyIsotropic(L, p) : LatMod, . -> BoolElt

Given a place of K or a prime ideal of ZK, tests whether Lp is isotropic.

#### IsLocallyIsometric(L, M, p) : LatMod, RngOrdIdl -> BoolElt

Tests whether Lp and Mp are isometric at the prime ideal p of ZK.

#### IsSimilarGenus(L, M) : LatMod, LatMod -> BoolElt

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

#### GenusRepresentatives(L) : LatMod -> []

Computes a list of representatives of the isometry classes in the genus of L.

## Intrinsics for definite lattices

Given definite lattices L and M, the following additional intrinsics are available:

#### IsIsometric(L, M) : LatMod, LatMod -> BoolElt, Mtrx

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).

#### IsSimilar(L, M) : LatMod, LatMod -> BoolElt, Mtrx, FldAlgElt

Tests if the lattices L and M are similar.

#### AutomorphismGroup(L) : LatMod -> GrpMat

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

#### Mass(L) : LatMod -> FldRatElt

Returns the Siegel mass of L.

#### OrthogonalDecomposition(L) : LatMod -> []

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