# Module Elements

## Construction

### `elt< M | a₁, ..., aₙ >: ModRng, List -> ModRngElt`

Given a module $M$ with underlying vector space $K^{(n)}$, and elements $a_1, \ldots, a_n$ belonging to $K$, construct the element $m = (a_1, \ldots, a_n)$ of $M$. Note that if $m$ is not an element of $M$, an error will result.

### `M ! Q: ModRng, [RngElt] -> ModRngElt`

Given the module $M$ with underlying vector space $K^n$, and a sequence $Q = [a_1, \ldots, a_n]$ with universe $K$, construct the element $m = (a_1, \ldots, a_n)$ of $M$. Note that if $m$ is not an element of $M$, an error will result.

### `Zero(M): ModRng -> ModRngElt`

### `M ! 0: ModRng, RngIntElt -> ModRngElt`

The zero element for the $A$-module $M$.

### `Random(M): ModRng -> ModRngElt`

Given a module $M$ defined over a finite ring or field, return a random vector.

## Deconstruction of Module Elements

### `ElementToSequence(u): ModRngElt -> [RngElt]`

### `Eltseq(u): ModRngElt -> [RngElt]`

Given an element $u$ belonging to the $A$-module $M$, return $u$ in the form of a sequence $Q$ of elements of $K$.

## Action of the Algebra on the Module

### `u * a: ModRngElt, AlgElt -> ModRngElt`

Given a vector $u$ belonging to an $A$-module $M$, and an element $a \in A$ return the image of $u$ under the action of $a$.

### `u * g: ModGrpElt, GrpElt -> ModGrpElt`

Given a vector $u$ belonging to an $K[G]$-module $M$, and an element $g$ belonging to the group $G$, return the image of $u$ under the action of $K[G]$ on the module $M$.

## Arithmetic with Module Elements

### `u + v: ModRngElt, ModRngElt -> ModRngElt`

Sum of the elements $u$ and $v$, where $u$ and $v$ lie in the same $A$-module $M$.

### `- u: ModRngElt -> ModRngElt`

Additive inverse of the element $u$.

### `u - v: ModRngElt, ModRngElt -> ModRngElt`

Difference of the elements $u$ and $v$, where $u$ and $v$ lie in the same $A$-module $M$.

### `k * u: RngElt, ModRngElt -> ModRngElt`

Given an element $u$ in an $A$-module $M$, where $A$ is a $K$-algebra and an element $k \in K$, return the scalar product $k * u$ as an element of $M$.

### `u * k: ModRngElt, RngElt -> ModRngElt`

Given an element $u$ in an $A$-module $M$, where $A$ is a $K$-algebra and an element $k \in K$, return the scalar product $u * k$ as an element of $M$.

### `u / k: ModRngElt, RngElt -> ModRngElt`

Given an element $u$ in an $A$-module $M$, where $A$ is a $K$-algebra and a non-zero element $k \in K$, return the scalar product $u * (1/k)$ as an element of $M$.

## Indexing

### `u[i]: ModRngElt, RngIntElt -> RngElt`

Given an element $u$ belonging to a submodule $M$ of the $R$-module $R^{(n)}$ and a positive integer $i$, $1 \leq i\leq n$, return the $i$-th component of $u$ (as an element of the ring $R$).

### `u[i] := x: ModRngElt, RngIntElt, RngElt -> ModRngElt`

Given an element $u$ belonging to a submodule $M$ of the $R$-module $T = R^{(n)}$, a positive integer $i$, $1 \leq i\leq n$, and an element $x$ of the ring $R$, redefine the $i$-th component of $u$ to be $x$. The parent of $u$ is changed to $T$ (since the modified element $u$ need not lie in $M$).

## Properties of Module Elements

### `IsZero(u): ModRngElt -> BoolElt`

Returns `true` if the element $u$ of the $A$-module $M$ is the zero element.

### `Support(u): ModRngElt -> { RngIntElt }`

A set of integers giving the positions of the non-zero components of the vector $u$.
