# Brandt Module Creation

We first describe the various constructors for Brandt modules and their elements.

## `BrandtModule(D): RngIntElt -> ModBrdt`

## `BrandtModule(D, m): RngIntElt, RngIntElt -> ModBrdt`

```magma
ComputeGrams: BoolElt                    Default: true
```

Given a product $D$ of an odd number of primes, and a integer $m$ which has valuation at most one at each prime divisor $p$ of $D$, return a Brandt module of level $(D,m)$ over the integers. If not specified, then the conductor $m$ is taken to be $1$.

The parameter `ComputeGrams` can be set to `false` in order to not compute the $h \times h$ array, where $h$ is the left class number of level $(D,m)$, of reduced Gram matrices of the quaternion ideal norm forms. Instead the basis of quaternion ideals is stored and the collection of degree $p$ ideal homomorphisms is then computed in order to find the Hecke operator $T_p$ for each prime $p$.

For very large levels, setting `ComputeGrams` to `false` is more space efficient. For moderate sized levels for which one wants to compute many Hecke operators, it is preferable to compute the Gram matrices and determine the Hecke operators using theta series.

## `BrandtModule(A): AlgQuatOrd -> ModBrdt`

## `BrandtModule(A, R): AlgQuatOrd, Rng -> ModBrdt`

```magma
ComputeGrams: BoolElt                    Default: true
```

Given a definite order $A$ in a quaternion algebra over ${\mathbb{Q}}$, returns the Brandt module on the left ideals classes for $A$, as a module over $R$. If not specified, the ring $R$ is taken to be the integers. The parameter `ComputeGrams` is as previously described.

## `BaseExtend(M, R): ModBrdt, Rng -> ModBrdt`

Forms the Brandt module with coefficient ring base extended to $R$.

## `BrandtModule(M, N): AlgQuatOrd, RngElt -> ModBrdt`

This constructor is an alternative to `BrandtModule(D, N)` above, and *uses a different algorithm* which is preferable in the case where $N$ is not very small.

It constructs the Brandt module attached to an Eichler order of level $N$ inside the maximal order $M$. The algorithm avoids explicitly working with the Eichler order.

## `Example: Mod Brdt:Constructors (ex-800093)`

In the following example we create the Brandt module of level $101$ over the field of $7$ elements and decompose it into its invariant subspaces.

```magma
> A := QuaternionOrder(101);
> FF := FiniteField(7);
> M := BrandtModule(A,FF);
> Decomposition(M,13);
[
    Brandt module of level (101,1), dimension 1, and degree 9 over Finite
    field of size 7,
    Brandt module of level (101,1), dimension 1, and degree 9 over Finite
    field of size 7,
    Brandt module of level (101,1), dimension 1, and degree 9 over Finite
    field of size 7,
    Brandt module of level (101,1), dimension 6, and degree 9 over Finite
    field of size 7
]

```

We note that Brandt modules of non-prime discriminant can be useful for studying isogeny factors of modular curves, since it is possible to describe exactly the piece of cohomology of interest, without first computing a much larger space. In this example we see that the space of weight $2$ cusp forms for $\Gamma_0(1491)$, where $1491 = 3\cdot 7\cdot 71$, is of dimension $189$ (plus an Eisenstein space of dimension $7$), while the newspace has dimension $71$. The Jacobian of the Shimura curve $X^{1491}_0(1)$ is isogenous to the new factor of $J_0(1491)$, so that we can study the newspace directly via the Brandt module.

```magma
> DimensionCuspFormsGamma0(3*7*71,2);
189
> DimensionNewCuspFormsGamma0(3*7*71,2);
71
> BrandtModuleDimension(3*7*71,1);
72
> M := BrandtModule(3*7*71 : ComputeGrams := false);
> S := CuspidalSubspace(M);
> Dimension(S);
71
> [ Dimension(N) : N in Decomposition(S,13 : Sort := true) ];
[ 6, 6, 6, 6, 11, 12, 12, 12 ]

```

In this example by setting `ComputeGrams` equal to `false` we obtain the Brandt module much faster, but the decomposition is much more expensive. For most applications the default computation of Gram matrices is preferable.

## Creation of Elements

### `M ! x: ModBrdt, . -> ModBrdtElt`

Given a sequence or module element $x$ compatible with the Brandt module $M$, forms the corresponding element in $M$.

### `M . i: ModBrdt, RngIntElt -> ModBrdtElt`

For a Brandt module $M$ and integer $i$, returns the $i$-th basis element.

## Operations on Elements

Brandt module elements support standard operations.

### `a * x: RngElt, ModBrdtElt -> ModBrdtElt`

### `x * a: ModBrdtElt, RngElt -> ModBrdtElt`

The scalar multiplication of a Brandt module element $x$ by an element $a$ in the base ring.

### `x * T: ModBrdtElt, AlgMatElt -> ModBrdtElt`

Given a Brandt module element $x$ and an element $T$ of the algebra of Hecke operators of degree compatible with the parent of $x$ or of its ambient module, returns the image of $x$ under $T$.

### `x + y: ModBrdtElt, ModBrdtElt -> ModBrdtElt`

Returns the sum of two Brandt module elements.

### `x - y: ModBrdtElt, ModBrdtElt -> ModBrdtElt`

Returns the difference of two Brandt module elements.

### `x eq y: ModBrdtElt, ModBrdtElt -> BoolElt`

Returns `true` if $x$ and $y$ are equal elements of the same Brandt module.

### `Eltseq(x): ModBrdtElt -> SeqEnum`

Returns the sequence of coefficients of the Brandt module element $x$.

### `InnerProduct(x, y): ModBrdtElt, ModBrdtElt -> RngElt`

Returns the inner product of the Brandt module elements $x$ and $y$ with respect to the canonical pairing on their common parent.

### `Norm(x): ModBrdtElt -> RngElt`

Returns the inner product of the Brandt module element $x$ with itself.

## Categories and Parent

Brandt modules belong to the category `ModBrdt`, with elements of type `ModBrdtElt`, involved in the type checking of arguments in Magma programming. The `Parent` of an element is the space to which it belongs.

### `Category(M): ModBrdt -> Cat`

### `Type(M): ModBrdt -> Cat`

### `Category(x): ModBrdtElt -> Cat`

### `Type(x): ModBrdtElt -> Cat`

The category, `ModBrdt` or `ModBrdtElt`, of the Brandt module $M$ or of the Brandt module element $x$.

### `Parent(x): ModBrdtElt -> ModBrdt`

The parent module $M$ of a Brandt module element $x$.

### `x in M: ModBrdtElt, ModBrdt -> BoolElt`

Returns `true` if $M$ is the parent of $x$.

## Elementary Invariants

Here we describe the elementary invariants of the Brandt module, defined with respect to a definite quaternion order $A$ in a quaternion algebra ${\mathbb{H}}$ over ${\mathbb{Q}}$. The *level* of $M$ is defined to be the reduced discriminant of $A$, the *discriminant* is defined to be the discriminant of the algebra ${\mathbb{H}}$, and the *conductor* to be the index of $A$ in any maximal order of ${\mathbb{H}}$ which contains it. We note that the discriminant of $M$ is just the product of the ramified primes of ${\mathbb{H}}$, and the product of the conductor and discriminant of $M$ is the reduced discriminant of $A$.

### `Level(M): ModBrdt -> RngIntElt`

Returns the level of the Brandt module, which is the product of the discriminant and the conductor, and equal to the reduced discriminant of its defining quaternion order.

### `Discriminant(M): ModBrdt -> RngIntElt`

Returns the discriminant of the quaternion algebra ${\mathbb{H}}$ with respect to which the Brandt module $M$ is defined (equal to the product of the primes which ramify in ${\mathbb{H}}$).

### `Conductor(M): ModBrdt -> RngIntElt`

Returns the conductor or index of the defining quaternion order of the Brandt module $M$ in a maximal order of its quaternion algebra.

### `BaseRing(M): ModBrdt -> Rng`

The ring over which the Brandt module $M$ is defined.

### `Basis(M): ModBrdt -> SeqEnum`

Returns the basis of the Brandt module $M$.

## Associated Structures

The following give structures associated to Brandt modules. In particular we note the definition of the `AmbientModule`, which is the full module containing a given Brandt module whose basis corresponds to the left quaternion ideals. Elements of every submodule of the ambient module are displayed with respect to the basis of the ambient module.

### `AmbientModule(M): ModBrdt -> ModBrdt`

The full module of level $(D,m)$ containing a given module of this level.

### `IsAmbient(M): ModBrdt -> BoolElt`

Returns `true` if and only if the Brandt module $M$ is its own ambient module.

### `Dimension(M): ModBrdt -> RngIntElt`

### `Rank(M): ModBrdt -> RngIntElt`

Returns the rank of the Brandt module $M$ over its base ring.

### `Degree(M): ModBrdt -> RngIntElt`

Returns the degree of the Brandt module $M$, defined to be the dimension of its ambient module.

### `GramMatrix(M): ModBrdt -> AlgMatElt`

The matrix $(\langle{u_i,u_j}\rangle)$ defined with respect to the basis $\{ u_i \}$ of the Brandt module $M$.

### `InnerProductMatrix(M): ModBrdt -> AlgMatElt`

Returns the Gram matrix of the ambient module of the Brandt module $M$.

### `Example: ModBrdt:Module Creation (ex-3bb6f4)`

The following example demonstrates the use of `AmbientModule` to get back to the original Brandt module.

```magma
> M := BrandtModule(3,17);
> S := CuspidalSubspace(M);
> M eq AmbientModule(M);
true

```

### `Ideals(M): ModBrdt -> []`

This constructs the quaternionic ideals which correspond to the basis of the Brandt module $M$. It is only implemented when $M$ was constructed using `BrandtModule(M, N)` – the case where the new algorithm is used, which avoids constructing these ideals explicitly.

## Verbose Output

The verbose level for Brandt modules is set with the command `SetVerbose("Brandt",n)`. Since the construction of a Brandt module requires intensive quaternion algebra machinery for ideal enumeration, the `Quaternion` verbose flag is also relevant. In both cases, the value of $n$ can be $0$ (silent), $1$ (verbose), or $2$ (very verbose).

### `Example: ModBrdt:Verbose Output (ex-15591a)`

In the following example we show the verbose output from the quaternion ideal enumeration in the creation of the Brandt module of level $(37,1)$.

```magma
> SetVerbose("Quaternion",2);
> BrandtModule(37);
Ideal number 1, right order module
Full RSpace of degree 4 over Integer Ring
Inner Product Matrix:
[ 2  0  1  1]
[ 0  4 -1  2]
[ 1 -1 10  0]
[ 1  2  0 20]
Frontier at 2-depth 1 has 3 elements.
Number of ideals = 1
Ideal number 2, new right order module
Full RSpace of degree 4 over Integer Ring
Inner Product Matrix:
[ 2 -1  0  1]
[-1  8 -1 -4]
[ 0 -1 10 -2]
[ 1 -4 -2 12]
Ideal number 3, new right order module
Full RSpace of degree 4 over Integer Ring
Inner Product Matrix:
[ 2  1  0 -1]
[ 1  8  1  3]
[ 0  1 10 -2]
[-1  3 -2 12]
Frontier at 2-depth 2 has 4 elements.
Number of ideals = 3
Brandt module of level (37,1), dimension 3, and degree 3 over Integer Ring

```
