# Definition of a Module

## Construction of Modules of $n$-tuples

### `RSpace(R, n): Rng, RngIntElt -> ModTupRng`

### `RModule(R, n): Rng, RngIntElt -> ModRng`

Given a ring $R$ and a non-negative integer $n$, create the free right $R$-module $R^{(n)}$, consisting of all $n$-tuples over $R$. The module is created with the standard basis, $e_1, \ldots, e_n$, where $e_i$ $(i = 1, \ldots, n)$ is the vector containing a $1$ in the $i$-th position and zeros elsewhere. The function `RModule` creates a module in reduced mode while `RSpace` creates a module in embedded mode.

### `RSpace(R, n, F): Rng, RngIntElt, Mtrx -> ModTupRng`

Given a ring $R$, a non-negative integer $n$ and a square $n \times n$ symmetric matrix $F$, create the free right $R$-module $R^{(n)}$ (in embedded form), with inner product matrix $F$. This is the same as `RSpace(R, n)`, except that the functions `Norm` and `InnerProduct` (see below) will be with respect to the inner product matrix $F$.

### `Example: Create Z6 (ex-d42492)`

We construct the module consisting of $6$-tuples over the integers.

```magma
> Z := IntegerRing();
> M := RModule(Z, 6);
> M;
RModule M of dimension 6 with base ring Integer Ring

```

## Construction of Modules of $m \times n$ Matrices

### `RMatrixSpace(R, m, n): Rng, RngIntElt, RngIntElt -> ModMatRng`

The module comprising all $m \times n$ matrices over the ring $R$.

## Construction of a Module with Specified Basis

### `RModuleWithBasis(Q): [ModFldElt] -> ModFld`

### `RSpaceWithBasis(Q): [ModTupRngElt] -> ModTupRng`

### `RSpaceWithBasis(a): AlgMatElt -> ModTupRng`

### `RSpaceWithBasis(a): ModMatRngElt -> ModTupRng`

Given a sequence $Q$ (or matrix $a$) of $k$ independent vectors each lying in a module $M$, construct the submodule of $M$ of dimension $k$ whose basis is $Q$ (or the rows of $a$). The basis is echelonized internally but all functions which depend on the basis of the space (e.g. `Coordinates`) will use the given basis.

### `RMatrixSpaceWithBasis(Q): [ModTupRngElt] -> ModMatRng`

The module of $m \times n$ matrices whose basis is given by the linearly independent matrices of the sequence $Q$.
