# Number Field Lattice Elements

## Creation

### `Zero(L): LatNF -> LatNFElt`

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

### `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.

### `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.

### `CoordinatesToLattice(L, S): LatNF, SeqEnum -> LatNFElt`

### `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$.

## Parent and Element Relations

### `v in L: ModTupRngElt, LatNF -> BoolElt, ModTupFldElt`

### `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.

### `Parent(v): LatNFElt -> LatNF`

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

## Arithmetic

### `v + w: LatNFElt, LatNFElt -> LatNFElt`

### `v - w: LatNFElt, LatNFElt -> LatNFElt`

### `- v: LatNFElt -> LatNFElt`

### `v eq w: LatNFElt, LatNFElt -> BoolElt`

### `v ne w: LatNFElt, LatNFElt -> BoolElt`

### `IsZero(v): LatNFElt -> BoolElt`

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

### `s * v: RngElt, LatNFElt -> LatNFElt`

### `v * s: LatNFElt, RngElt -> LatNFElt`

### `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$.

### `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$.

### `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$.

### `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.

### `v ^ G: LatNFElt, GrpMat -> Setq[LatNFElt]`

### `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.

### `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.

### `Norm(v): LatNFElt -> FldNumElt`

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

### `InnerProduct(v, w): LatNFElt, LatNFElt -> FldNumElt`

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

### `Example: Nflatelt Ex (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

```

## Access Functions

### `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$.

### `Eltseq(v): LatNFElt -> SeqEnum`

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

### `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.
