---
title: "Number Field Lattice Elements"
canonical: "https://docs.magma-maths.org/v2.30-1/LatticesQuadraticForms/LatticesOverNumberFields/numberfieldlatticeelements.html"
source: "https://docs.magma-maths.org/v2.30-1/LatticesQuadraticForms/LatticesOverNumberFields/numberfieldlatticeelements.md"
part: "Lattices and Quadratic Forms"
chapter: "Lattices over Number Fields"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Lattices and Quadratic Forms", "source": "https://docs.magma-maths.org/v2.30-1/LatticesQuadraticForms/index-lattices-quadratic-forms.md"}
  - {"title": "Lattices over Number Fields", "source": "https://docs.magma-maths.org/v2.30-1/LatticesQuadraticForms/LatticesOverNumberFields/index-lattices-over-number-fields.md"}
prev: {"title": "Number Field Lattices", "source": "https://docs.magma-maths.org/v2.30-1/LatticesQuadraticForms/LatticesOverNumberFields/numberfieldlattices.md"}
next: {"title": "Examples", "source": "https://docs.magma-maths.org/v2.30-1/LatticesQuadraticForms/LatticesOverNumberFields/examples.md"}
intrinsics:
  - {"name": "Zero", "signature": "Zero(L): LatNF -> LatNFElt"}
  - {"name": "!", "signature": "L ! e: LatNF, Any -> LatNFElt"}
  - {"name": ".", "signature": "L . i: LatNF, RngIntElt -> LatNFElt"}
  - {"name": "CoordinatesToLattice", "signature": "CoordinatesToLattice(L, S): LatNF, SeqEnum -> LatNFElt"}
  - {"name": "CoordinatesToLattice", "signature": "CoordinatesToLattice(L, v): LatNF, ModTupFldElt -> LatNFElt"}
  - {"name": "in", "signature": "v in L: ModTupRngElt, LatNF -> BoolElt, ModTupFldElt"}
  - {"name": "in", "signature": "v in L: LatNFElt, LatNF -> BoolElt, ModTupFldElt"}
  - {"name": "Parent", "signature": "Parent(v): LatNFElt -> LatNF"}
  - {"name": "+", "signature": "v + w: LatNFElt, LatNFElt -> LatNFElt"}
  - {"name": "-", "signature": "v - w: LatNFElt, LatNFElt -> LatNFElt"}
  - {"name": "-", "signature": "- v: LatNFElt -> LatNFElt"}
  - {"name": "eq", "signature": "v eq w: LatNFElt, LatNFElt -> BoolElt"}
  - {"name": "ne", "signature": "v ne w: LatNFElt, LatNFElt -> BoolElt"}
  - {"name": "IsZero", "signature": "IsZero(v): LatNFElt -> BoolElt"}
  - {"name": "*", "signature": "s * v: RngElt, LatNFElt -> LatNFElt"}
  - {"name": "*", "signature": "v * s: LatNFElt, RngElt -> LatNFElt"}
  - {"name": "/", "signature": "v / s: LatNFElt, RngElt -> LatNFElt"}
  - {"name": "*", "signature": "T * v: Mtrx, LatNFElt -> LatNFElt"}
  - {"name": "*", "signature": "v * T: LatNFElt, Mtrx -> LatNFElt"}
  - {"name": "^", "signature": "v ^ M: LatNFElt, Mtrx -> LatNFElt"}
  - {"name": "^", "signature": "v ^ G: LatNFElt, GrpMat -> Setq[LatNFElt]"}
  - {"name": "Orbit", "signature": "Orbit(G, v): GrpMat, LatNFElt -> Setq[LatNFElt]"}
  - {"name": "Stabilizer", "signature": "Stabilizer(G, v): GrpMat, LatNFElt -> GrpMat"}
  - {"name": "Norm", "signature": "Norm(v): LatNFElt -> FldNumElt"}
  - {"name": "InnerProduct", "signature": "InnerProduct(v, w): LatNFElt, LatNFElt -> FldNumElt"}
  - {"name": "Vector", "signature": "Vector(v): LatNFElt -> ModTupFldElt"}
  - {"name": "Eltseq", "signature": "Eltseq(v): LatNFElt -> SeqEnum"}
  - {"name": "Coordinates", "signature": "Coordinates(v): LatNFElt -> ModTupFldElt"}
examples:
  - "ex-9da2f4"
---

<a id="numberfieldlatticeelements"></a>
<a id="sectlatnfelts"></a>
# Number Field Lattice Elements

<a id="nf-elt-create"></a>
## Creation

<a id="function-zero-latnf"></a>
### `Zero(L): LatNF -> LatNFElt`

The zero vector of the number field lattice $L$.

<a id="operation-op-latnf-any"></a>
### `L ! e: LatNF, Any -> LatNFElt`

Object $e$ is coerced into the number field lattice $L$. The possibilities for the coerced object $e$ are vectors of number field lattices, vectors in the proper degree ambient, and sequences of the proper length.

<a id="operation-operation-latnf-rngintelt-latnfelt"></a>
### `L . i: LatNF, RngIntElt -> LatNFElt`

The $i$th pseudobasis vector of a number field lattice $L$. The given integer $i$ must be nonnegative (0 gives the zero vector, also obtainable by `Zero`), and not exceed the rank of $L$. The $i$th coefficient ideal must also be trivial.

<a id="function-coordinatestolattice-latnf-seqenum"></a>
### `CoordinatesToLattice(L, S): LatNF, SeqEnum -> LatNFElt`

<a id="function-coordinatestolattice-latnf-modtupfldelt"></a>
### `CoordinatesToLattice(L, v): LatNF, ModTupFldElt -> LatNFElt`

Given a sequence (or vector) $S$ coercible into the coefficient field of number field lattice $L$ whose length is equal to the rank of $L$, return the lattice vector with these coordinates. A check is made as to whether the vector ($S$ or $v$) is in $L$.

<a id="nf-elt-parent"></a>
## Parent and Element Relations

<a id="operation-op-in-modtuprngelt-latnf"></a>
### `v in L: ModTupRngElt, LatNF -> BoolElt, ModTupFldElt`

<a id="operation-op-in-latnfelt-latnf"></a>
### `v in L: LatNFElt, LatNF -> BoolElt, ModTupFldElt`

Given a vector in an ambient space $A$ of the number field lattice $L$ where $A$ has the same degree as $L$, determine whether $v$ is in $L$. If so, then the coordinates of $v$ with respect to the pseudobasis of $L$ will also be returned. The coordinates of $v$ will actually be returned whenever $v$ lies in the $K$-span of the pseudobasis.

<a id="function-parent-latnfelt"></a>
### `Parent(v): LatNFElt -> LatNF`

The parent number field lattice to which the given lattice vector $v$ belongs.

<a id="nf-elt-arith"></a>
## Arithmetic

<a id="operation-op-plus-latnfelt-latnfelt"></a>
### `v + w: LatNFElt, LatNFElt -> LatNFElt`

<a id="operation-op-minus-latnfelt-latnfelt"></a>
### `v - w: LatNFElt, LatNFElt -> LatNFElt`

<a id="operation-operation-latnfelt-latnfelt"></a>
### `- v: LatNFElt -> LatNFElt`

<a id="operation-op-eq-latnfelt-latnfelt"></a>
### `v eq w: LatNFElt, LatNFElt -> BoolElt`

<a id="operation-op-ne-latnfelt-latnfelt"></a>
### `v ne w: LatNFElt, LatNFElt -> BoolElt`

<a id="function-iszero-latnfelt"></a>
### `IsZero(v): LatNFElt -> BoolElt`

Addition, subtraction, negation, and (non)equality of the number field lattice elements $v$ and $w$.

<a id="operation-op-times-rngelt-latnfelt"></a>
### `s * v: RngElt, LatNFElt -> LatNFElt`

<a id="operation-op-times-latnfelt-rngelt"></a>
### `v * s: LatNFElt, RngElt -> LatNFElt`

<a id="operation-op-div-latnfelt-rngelt"></a>
### `v / s: LatNFElt, RngElt -> LatNFElt`

Given a vector $v$ belonging to the number field lattice $L$ defined over the number field $K$ and an element $s$ of $K$, scale $v$ by $s$ as indicated. The result is checked for membership of $L$.

<a id="operation-op-times-mtrx-latnfelt"></a>
### `T * v: Mtrx, LatNFElt -> LatNFElt`

Given a vector $v$ belonging to the number field lattice $L$ defined over the number field $K$, and a matrix $T$ defined over $K$, the pseudobasis coordinates of $v$ are transformed by $T$. The result is checked for membership of $L$.

<a id="operation-op-times-latnfelt-mtrx"></a>
### `v * T: LatNFElt, Mtrx -> LatNFElt`

Given a vector $v$ belonging to the number field lattice $L$ defined over the field $K$, and a matrix $T$ acting on the ambient space of $L$, transform $v$ by $T$. The result is checked for membership of $L$.

<a id="operation-op-pow-latnfelt-mtrx"></a>
### `v ^ M: LatNFElt, Mtrx -> LatNFElt`

Given an element $v$ belonging to the number field lattice $L$ and a matrix $M$ acting on the ambient space of $L$, return the image of $v$ under the transformation $M$. Here the action is on the coordinates of the vector (so $M$ must be square, of dimensions equal to the rank of $L$), and the resulting vector must belong to the lattice.

<a id="operation-op-pow-latnfelt-grpmat"></a>
### `v ^ G: LatNFElt, GrpMat -> Setq[LatNFElt]`

<a id="function-orbit-grpmat-latnfelt"></a>
### `Orbit(G, v): GrpMat, LatNFElt -> Setq[LatNFElt]`

Given an element $v$ belonging to the number field lattice $L$ and a matrix group $G$ acting on $L$, return the orbit of $v$ under the action of $G$. This operation is also available if $v$ is replaced by a set or sequence of elements of $L$. The user is responsible for ensuring that the orbit is finite.

<a id="function-stabilizer-grpmat-latnfelt"></a>
### `Stabilizer(G, v): GrpMat, LatNFElt -> GrpMat`

Given an element $v$ belonging to the number field lattice $L$ and a matrix group $G$ acting on the coordinates of the vectors of $L$, return the stabilizer of $v$ under the action of $G$. This operation is also available if $v$ is replaced by a set or sequence of elements of $L$. The user is responsible for ensuring that the group $G$ is finite.

<a id="function-norm-latnfelt"></a>
### `Norm(v): LatNFElt -> FldNumElt`

The norm of a given number field lattice element $v$.

<a id="function-innerproduct-latnfelt-latnfelt"></a>
### `InnerProduct(v, w): LatNFElt, LatNFElt -> FldNumElt`

The inner product of two number field lattice elements $v$ and $w$.

<a id="example-ex-9da2f4"></a>
### `Example: Arithmetic of Number Field Lattice Elements (ex-9da2f4)`

Here are some examples with number field lattice elements.

```magma
> K<s13> := NumberField(Polynomial([-13,0,1])); // Q(sqrt(13))
> L := NumberFieldLattice(K,3);
> v := Zero(L);
> assert IsZero(v);
> w1 := L.1;
> w2 := L.2-L.3;
> CoordinatesToLattice(L,Vector(5*w1-s13*w2));
(   5 -s13  s13)
> assert w2 in L;
> assert not Vector(w2)/2 in L; // cannot divide w2 by 2 directly
> assert Parent(v) eq L;
> Norm(w2);
2
> InnerProduct(w1,w2);
0
> T := Matrix(3,3,[K|s13,1,0, 3,-1,1+s13, s13,-s13,2+s13]);
> T*w2;
(-s13 + 3  s13 - 1       -1)
> w2*T; // same, as basis is standard
(-s13 + 3  s13 - 1       -1)
> S := sub<L|[w1,w2]>;
> Submatrix(T,1,1,2,2)*(S.1); // random input data, 2x2 mat in T*v
(s13   1  -1)
> G := AutomorphismGroup(L);
> assert #G eq 48;
> w2^G; // Orbit
{@
    ( 0  1 -1),
    (-1  1  0),
    ( 1  0 -1),
    (0 1 1),
    ( 1 -1  0),
    (-1  0 -1),
    (1 1 0),
    (1 0 1),
    ( 0 -1 -1),
    (-1  0  1),
    (-1 -1  0),
    ( 0 -1  1)
@}
> assert #$1 eq 12;
> #Stabilizer(G,w2); // 4*12 is 48
4
> #Stabilizer(G,w1);
8
> #Orbit(G,{w1,w2});
24
```

<a id="nf-elt-access"></a>
## Access Functions

<a id="function-vector-latnfelt"></a>
### `Vector(v): LatNFElt -> ModTupFldElt`

Given an element $v$ of the number field lattice $L$, return the underlying vector of the ambient space associated with $v$.

<a id="function-eltseq-latnfelt"></a>
### `Eltseq(v): LatNFElt -> SeqEnum`

Given an element $v$ of the number field lattice $L$, return the sequence corresponding to the `Vector` of the element.

<a id="function-coordinates-latnfelt"></a>
### `Coordinates(v): LatNFElt -> ModTupFldElt`

Given an element $v$ of the number field lattice $L$, return the coordinates of $v$, with respect to the pseudobasis of the parent lattice.
