# Modules over orders, conjugacy classes of integral matrices, and abelian varieties over finite fields

Stefano Marseglia

► To cite this version:

Stefano Marseglia. Modules over orders, conjugacy classes of integral matrices, and abelian varieties over finite fields. Research in Number Theory, 2025, 11 (1), pp.27. 10.1007/s40993-024-00584-9. hal-04968928

HAL Id: hal-04968928

https://hal.science/hal-04968928v1

Submitted on 27 Feb 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
MODULES OVER ORDERS,
CONJUGACY CLASSES OF INTEGRAL MATRICES, AND
ABELIAN VARIETIES OVER FINITE FIELDS

STEFANO MARSEGLIA

ABSTRACT. We give an algorithm to compute representatives of the conju-
gacy classes of semisimple square integral matrices with given minimal and
characteristic polynomials. We also give an algorithm to compute the $\mathbb{F}_q$-
isomorphism classes of abelian varieties over a finite field $\mathbb{F}_q$ which belong
to an isogeny class determined by a characteristic polynomial $h$ of Frobenius
when $h$ is ordinary, or $q$ is prime and $h$ has no real roots.

# 1. INTRODUCTION

The problem of classifying finitely generated modules over a commutative unitary
ring $R$ up to isomorphism is in general very hard. It has been studied for several
classes of rings $R$, producing a vast literature which goes back to Eichler and Ja-
cobinski, and spans several decades. Excellent accounts can be found, for example,
in the books [CR81] and [CR87] by Curtis and Reiner, in the books [RHD70] by
Roggenkamp and Huber-Dyson, and in [Rog70] by Roggenkamp. Further references
are provided in this introduction.

In some very special cases, we do have theoretical classifications of the isomor-
phism classes of modules: this is the case, for example, when $R$ is a field, a principal
ideal domain, or a Dedekind domain. The latter case, which is usually referred to
as Steinitz Theory [Ste12], will be the starting point of the investigation contained
in this paper.

In other cases, as explained in Section 1.3, there are algorithms to produce rep-
resentatives of the isomorphism classes. In this paper, we produce a new algorithm
that vastly supersedes the previous ones in terms of generality.

1.1. **First main result.** In this introduction, in order to simplify the presentation, we will work under more restrictive hypotheses than in most of the paper. We will give only the essential definitions and refer the reader to Section 2 for the missing ones. The following is the first main result of this paper, which can be found as Theorem 3.6 in Section 3.

**Main Theorem 1.** Let $R$ be a $\mathbb{Z}$-order in a direct product of number fields $K = K_1 \times \cdots \times K_n$. For positive integers $s_1, \ldots, s_n$, consider the $K$-module $V = K_1^{s_1} \oplus \cdots \oplus K_n^{s_n}$. We provide Algorithm 3.5 that computes representatives of the $R$-linear isomorphism classes of $\mathbb{Z}$-lattices of full rank in $V$ that are closed under the induced action by $R$.

Very briefly, Algorithm 3.5 uses the fact that all representatives of the sought
isomorphism classes can be found among the *R*-modules between two specific ones,
that depend on the maximal order $\mathcal{O}$ of $K$ and the conductor $f = (R : \mathcal{O})$ of $R$
in $\mathcal{O}$; see Theorem 3.2. Theorem 3.2 can be interpreted as an effective version
of the Jordan-Zassenhaus Theorem, specialized to commutative $Z$-orders, which states that the number of isomorphism classes is finite. Once we have a list of these intermediate modules, one can sieve out a minimal set of representatives of the isomorphism classes using the work by Bley-Hofmann-Johnston [BHJ22], whose relevance for our work is discussed in Remark 3.8. In Remark 3.9, we discuss the running time of Algorithm 3.5. As a by-product of Algorithm 3.5, we obtain a scheme to sort, and hence label, these modules; see Remark 3.10. From our methodology it is also easy to see that the number of the isomorphism classes computed in Main Theorem 1 is divisible by the size of $\text{Pic}(\mathcal{O})$. See Corollary 3.7.

We pause to stress that the two facts just stated above, namely, that the classes have representatives in the range mentioned, and that the size of $\text{Pic}(\mathcal{O})$ divides the number of the classes, are certainly known to the experts, and can be deduced from known results about genera of modules. Recall that the genus of a module $M$ is the set of modules which are locally isomorphic to $M$ at every rational prime $p$; see for example [CR81, Sec. 31]. In particular, the first statement can be deduced from [Jac68, Satz 2]; see also [Rog70, Ch. VII, Thm. 1.11]. The second statement follows from the fact that the stable isomorphism classes of modules in a given genus form an abelian group, which admits a surjective map onto $\text{Pic}(\mathcal{O})$; see [Wie84, Lemma 2.9]. By the Jacobinski Cancellation Theorem, stable isomorphism is the same as isomorphism as long as the order satisfies the Eichler condition; see [CR87, Sec. 51]. We also mention that these results have been generalized for other classes of rings and modules in a series of papers by Guralnick; see [Gur84], [Gur86], [Gur87]. Our proofs of Main Theorem 1 and Corollary 3.7 are shorter and simpler. In particular, we don't need the concepts of genera or stable isomorphism.

## 1.2. Applications.

In this paper we treat two applications of Algorithm 3.5. The first one, which is treated in Section 4, is a solution to the conjugacy classes problem for semisimple $r \times r$ integral matrices. Recall that a matrix is semisimple if its minimal polynomial is squarefree, that is, with no repeated irreducible factors. Two such matrices $A$ and $B$ are conjugate if there exists $P \in \text{GL}_r(\mathbb{Z})$ such that $PA = BP$. The problem of understanding the conjugacy classes with given minimal and characteristic polynomials has a long history. The first results are due to Latimer-MacDuffee [LM33] for matrices with squarefree characteristic polynomial. See also [Tau49]. These two papers describe bijections between certain modules over orders and conjugacy classes of integral square matrices with prescribed characteristic polynomial. Generalization of the Latimer-MacDuffee correspondence are provided by Bender in [Ben67], Buccino in [Buc69], Estes and Guralnick in [EG84] and Brzezinski in [Brz90]. Further results on conjugacy of matrices can be found in [Reh77], [Gur80], [Wal84], [Sol99] and [KS24].

In [Mar20, Thm 8.1] we give a direct proof of a version of the Latimer-MacDuffee Theorem that applies to all square semisimple integral matrices. This generalization, which is recorded in the text as Theorem 4.1, when combined with Algorithm 3.5, leads to the second main theorem of the paper, which can be found below as Theorem 4.2.

**Main Theorem 2.** Let $m_1, \dots, m_n$ be irreducible monic polynomials in $\mathbb{Z}[x]$ generating pairwise coprime ideals in $\mathbb{Q}[x]$. Put $m = m_1 \cdots m_n$ and $h = m_1^{s_1} \cdots m_n^{s_n}$, where $s_1, \dots, s_n$ are positive integers. Algorithm 3.5 allows us to compute the conjugacy classes of integral matrices with minimal polynomial $m$ and characteristic polynomial $h$.
The second application of Algorithm 3.5 regards abelian varieties over a finite field $\mathbb{F}_q$. It constitutes the content of Section 5, and we refer the reader to that for missing definitions. Consider an $\mathbb{F}_q$-isogeny class $\mathcal{I}_h$ of abelian varieties over $\mathbb{F}_q$ determined by a characteristic polynomial $h \in \mathbb{Z}[x]$ of Frobenius. We assume that $\mathcal{I}_h$ is ordinary, or that $q$ is prime and $h$ has no real roots. Observe that we make no assumptions on the factorization of $h$. Using results by Deligne [Del69] and Centeleghe-Stix [CS15], we can describe these abelian varieties in terms of modules over a certain order determined by $h$; see Theorem 5.1. This result, combined with Algorithm 3.5, leads to the third main theorem of the paper, which is later reported as Theorem 5.2.

**Main Theorem 3.** Let $\mathcal{I}_h$ be the $\mathbb{F}_q$-isogeny class of abelian varieties over the finite field $\mathbb{F}_q$ determined by the characteristic polynomial $h$ of Frobenius. Assume that $h$ is ordinary, or that $q$ is prime and $h$ has no real roots. Algorithm 3.5 allows us to compute the $\mathbb{F}_q$-isomorphism classes of abelian varieties in $\mathcal{I}_h$.

The above-mentioned labelling scheme for modules induces a way to sort and label the abelian varieties we are computing in Main Theorem 3. This is interesting if one wants to incorporate data about the isomorphism classes of such abelian varieties in a database, like the LMFDB [LMF22].

Finally, in Section 6 we include two examples. In Example 6.1 we compute isomorphism classes of abelian varieties over $\mathbb{F}_3$ in a given isogeny class. In particular, we exhibit 3 pairwise non-isomorphic abelian surfaces which become all isomorphic after taking the product with one elliptic curve. In Example 6.2 we compute conjugacy classes of matrices.

The implementation in MAGMA [BCP97] of Algorithm 3.5 is available at

https://github.com/stmar89/AlgEt<fnref n="1" />,

together with the code to reproduce the examples (see the webpage of the author for a precise link). Part of this implementation uses functionalities from the julia package Nemo/Hecke [FHHJ17].

**1.3. Comparison with previous and related results.** Main Theorem 1 is a generalization of the results contained in [Mar20], where we consider the case $V = K$, that is, $s_i = 1$ for all $i$. In this case, the $R$-modules we are considering are fractional $R$-ideals. In [Mar20], we first study the problem locally, introducing the notion of weak equivalence between fractional ideals. Two fractional $R$-ideals $I$ and $J$ are weakly equivalent if $I_p \simeq J_p$ for every prime ideal $p$ of $R$. As observed in [LW85, Sec. 5], two fractional ideals are weakly equivalent if and only if they belong to the same genus. Once we have computed the weak equivalence classes, for every overorder $S$ of $R$, we let the Picard group Pic$(S)$ act on the weak equivalence classes with multiplicator ring $S$ to compute all the isomorphism classes of fractional $R$-ideals. Computing weak equivalence classes in general requires an expensive enumeration step, analogous to the one needed in Algorithm 3.5. On the other hand, since weak equivalence is coarser than isomorphism, the quotient in which enumeration takes places is typically smaller. Furthermore, checking whether two ideals are weakly equivalent is faster than checking whether they are isomorphic. Moreover, in certain cases, we can skip the enumeration part entirely. Indeed, if $S$ is an overorder of $R$ which is Gorenstein, that is, every fractional $R$-ideal with multiplicator ring $S$ is invertible in $S$, then there is only one weak equivalence class with multiplicator ring $S$. We extend this statement in [Mar22, Sec. 6] where we classify all weak equivalence classes with multiplicator rings which are close-to-being Gorenstein.

<footnote n="1">¹at the moment of submission, the most recent commit is 4c22349</footnote>
Another case where we have a method to efficiently compute the $R$-modules is when $V = K^s$ for some positive integer $s$, that is, when $s_i = s$ for all $i$, and the order $R$ is assumed to be Bass, which means that all overorders are Gorenstein. In this case there is a classification of the $R$-modules in $V$ due to Bass [Bas62] and Borevič-Faddeev [BF65]. Such a classification makes them easy to compute. If $R$ is Bass but $V$ is not a pure power of $K$ then the classification of the classes becomes immediately much more complicated; see [BS22].

In the cases $V = K$ and $V = K^s$ with $R$ Bass, we used the above-mentioned results to produce algorithms to compute conjugacy classes of $Z$-matrices, see [Mar20, Cor. 8.2], and isomorphism classes of abelian varieties over finite fields, see [Mar21] and [Mar19]. For the reasons we just explained, these specialized algorithms will typically perform better than the methods described in Main Theorems 2 and 3.

We conclude the introduction with two asides. Contrary to the problem of computing representatives of the conjugacy classes of square integral matrices which is discussed in this paper, the problem of determining whether two such matrices are conjugate has recently received a lot of attention. Algorithms can be found in the thesis of Husert [Hus16], in previous work of the author [Mar20], in Eick-Hofmann-O’Brien [EHO19], and in the above-mentioned paper by Bley-Hofmann-Johnston [BHJ22]. The first two deal with special cases, while third and the fourth work with all square integral matrices, including the non-semisimple ones.

The second comment regards almost-ordinary abelian varieties over finite fields of odd characteristic. For simple isogeny classes, the work of Oswal-Shankar [OS20] gives a description of such abelian varieties in terms of modules analogous to the ones used to obtain Main Theorem 3. These results were generalized by Bergström-Karemaker and the author in [BKM23, Thm. 2.12] to isogeny classes of almost-ordinary abelian varieties in odd characteristic, with commutative endomorphism algebras, or, equivalently, with squarefree characteristic polynomial. For this reason, one should use the specialized algorithms contained in [Mar20] and [Mar21] to compute them.

**Acknowledgements.** The idea of this paper took form during a collaboration with Jonas Bergström and Valentijn Karemaker. The author is thankful for their encouragement to write it down. The author expresses his gratitude to them and to Tommy Hofmann for comments on a preliminary version. Special thanks go to Robert Guralnick for suggesting improvements and several references. The author is grateful to the anonymous referees for carefully reading the paper and suggesting several improvements. The author was supported by Nederlandse Organisatie voor Wetenschappelijk Onderzoek, grant number VI.Veni.202.107, and in part by Agence Nationale de la Recherche under the MELODIA project, grant number ANR-20-CE40-0013.

## 2. NOTATION AND DEFINITIONS

All rings in this paper are commutative and unitary. Let $Z$ be a Dedekind domain with fraction field $Q$. For us, fields are not Dedekind domains. Let $V$ be a finite dimensional $Q$-vector space. A *lattice* in $V$ is a finitely-generated sub-$Z$-module of $V$ which contains a $Q$-basis of $V$. In particular, if $L$ is such a lattice then $LQ = V$.

Let $K_1, \dots, K_n$ be finite field extensions of $Q$ and let $K$ be the direct product

$$K = K_1 \times \dots \times K_n.$$

An *order* $R$ in $K$ is a subring of $K$ which is also a lattice in $K$. A *fractional* $R$-ideal is a finitely generated sub-$R$-module of $K$ which is also a lattice in $K$, or, equivalently, which contains an invertible element of $K$. For example, if $R$ is a
domain then an ideal I of R is a fractional R-ideal if and only if I is non-zero. Two fractional R-ideals I and J are called *isomorphic* if they are so as R-modules. This is equivalent to having an invertible element $\lambda$ in K such that $I = \lambda J$. Observe that given two fractional R-ideals I and J, the sum $I + J$, the product $IJ$ and the colon

$$ (I : J) = \{x \in K : xJ \subseteq I\} $$

are also fractional R-ideals. The *multiplicator ring* of a fractional R-ideal I is the order $(I : I)$. We say that a fractional R-ideal I is *invertible* if there exists a fractional R-ideal J such that $IJ = R$. Note that if this is the case, then J equals $(R : I)$. We define the *Picard group* of R as the abelian group Pic(R) of isomorphism classes of invertible fractional R-ideals with the operation of multiplication.

Since K is commutative, the integral closure $\mathcal{O}$ of Z (embedded diagonally) in K is a subring of K. More precisely, we have

$$ \mathcal{O} = \mathcal{O}_1 \times \cdots \times \mathcal{O}_n, $$

where $\mathcal{O}_i$ is the integral closure of Z in $K_i$. By the Krull-Akizuki Theorem, each $\mathcal{O}_i$ is a Dedekind domain. Every element of any order is integral over Z, which implies that $\mathcal{O}$ contains every order in K.

Define the *conductor* $f$ of an order $R$ in $\mathcal{O}$ as

$$ f = (R : \mathcal{O}) = \{x \in K : x\mathcal{O} \subseteq R\}. $$

Note that since $f$ is an $\mathcal{O}$-ideal, we have a decomposition

$$ f = f_1 \oplus \cdots \oplus f_n, $$

where each $f_i$ is an $\mathcal{O}_i$-ideal. One can prove that $f$ contains an invertible element of K if and only if $\mathcal{O}$ is finitely generated as a Z-module. If this is the case then $\mathcal{O}$ is an order, the *maximal order* of K. We will assume that this is the case for the rest of the paper. Moreover, for every fractional $\mathcal{O}$-ideal I we have a decomposition $I = \bigoplus_{i=1}^n I_i$ for fractional $\mathcal{O}_i$-ideals $I_i$, and hence also

$$ \mathrm{Pic}(\mathcal{O}) = \mathrm{Pic}(\mathcal{O}_1) \times \cdots \times \mathrm{Pic}(\mathcal{O}_n). $$

### 3. ISOMORPHISM CLASSES OF LATTICES

Let Z, Q, K = $K_1 \times \cdots \times K_n$ and $\mathcal{O} = \mathcal{O}_1 \times \cdots \times \mathcal{O}_n$ be as in Section 2. We assume that $\mathcal{O}$ is finitely generated as a Z-module. Fix positive integers $s_1, \dots, s_n$ and consider the K-module

$$ V = K_1^{s_1} \oplus \cdots \oplus K_n^{s_n}, $$

where the action of K is component-wise diagonal.

Let R be an order in K. Denote by $\mathcal{L}(R, V)$ the category of sub-R-modules of V which are also lattices, with R-linear morphisms. For every M in $\mathcal{L}(R, V)$, the extension MO is also a lattice in V and hence it belongs to $\mathcal{L}(\mathcal{O}, V)$. Pick a morphism $\varphi: M \to N$ in $\mathcal{L}(R, V)$. Since $RQ = \mathcal{O}Q = K$ and $MQ = NQ = V$, the morphism $\varphi$ extends uniquely to a K-linear endomorphism of V, which in turns restricts to a unique morphism MO $\to$ NO in $\mathcal{L}(\mathcal{O}, V)$. We denote the induced morphisms also by $\varphi$.

The following is a restatement of Steinitz Theory; see [Ste12].

**Proposition 3.1.** Let M be in $\mathcal{L}(\mathcal{O}, V)$. Then there are fractional $\mathcal{O}_i$-ideals $I_i$ and there exists an $\mathcal{O}$-linear isomorphism

$$ M \simeq \bigoplus_{i=1}^{n} \left( \mathcal{O}_{i}^{\oplus (s_{i}-1)} \oplus I_{i} \right). $$
Moreover, the isomorphism class of M is uniquely determined by the integers $s_i$ and the isomorphism class of the fractional $O$-ideal $I = I_1 \oplus \cdots \oplus I_n$.

*Proof.* Since $O = O_1 \times \cdots \times O_n$ is a direct product of rings, we have a decomposition

$$M = M_1 \oplus \cdots \oplus M_n,$$

where each $M_i$ is in $\mathcal{L}(O_i, K_i^{s_i})$. By the structure theorem for finitely generated modules over a Dedekind domain, see [Ste12], there exists a fractional $O_i$-ideal $I_i$ such that

$$M_i \simeq O_i^{\oplus(s_i-1)} \oplus I_i.$$

Furthermore, the isomorphism class of each $M_i$ is uniquely determined by the rank $s_i$ and the isomorphism class of $I_i$. The same holds true after taking the direct sum. $\square$

We now consider $\mathcal{L}(R, V)$ for a general order $R$. Let $f = \bigoplus_{i=1}^n f_i$ be the conductor of $R$ in $O$.

**Theorem 3.2.** Let $M$ be in $\mathcal{L}(R, V)$. Then there exist an $M'$ in $\mathcal{L}(R, V)$, and fractional $O_i$-ideals $I_i$ such that

(i) $M' \simeq M$ as an $R$-module.

(ii) $M'\mathcal{O} = \bigoplus_{i=1}^n (O_i^{\oplus(s_i-1)} \oplus I_i)$.

(iii) $\bigoplus_{i=1}^n (f_i^{\oplus(s_i-1)} \oplus f_i I_i) \subseteq M' \subseteq \bigoplus_{i=1}^n (O_i^{\oplus(s_i-1)} \oplus I_i)$.

*Proof.* By Proposition 3.1, there exists an $O$-linear isomorphism

$$\varphi : MO \xrightarrow{\sim} \bigoplus_{i=1}^{n} (O_i^{\oplus(s_i-1)} \oplus I_i),$$

for some fractional $O_i$-ideals $I_i$. Define $M' = \varphi(M)$. Observe that $M'$ is in $\mathcal{L}(R, V)$ and $M \simeq M'$ by construction. We have

$$M' \subseteq M'\mathcal{O} = \varphi(M)\mathcal{O} = \varphi(M\mathcal{O}) = \bigoplus_{i=1}^{n} (O_i^{\oplus(s_i-1)} \oplus I_i).$$

For the other inclusion, note that

$$\bigoplus_{i=1}^{n} (f_i^{\oplus(s_i-1)} \oplus f_i I_i) = f \left( \bigoplus_{i=1}^{n} (O_i^{\oplus(s_i-1)} \oplus I_i) \right) = fM'\mathcal{O} = fM' \subseteq M',$$

where the last equality holds because $f\mathcal{O} = f$, and the inclusion follows from $f \subseteq R$ and $M'R = M'$. $\square$

In the rest of the section we describe how to turn Theorem 3.2 into an algorithm to compute representatives of the isomorphism classes of modules in $\mathcal{L}(R, V)$. We will need some additional assumptions on $R$ and $O$, which will be discussed in Remark 3.3. We need to assume that:

(A) We have algorithms for working with $Z$-lattices in $V$ and $K$ and for working with fractional $R$-ideals for an arbitrary order in $K$.

(B) We have an algorithm to compute the maximal order $O$ of $K$ and the conductor $(R : O)$ of an arbitrary order $R$ in $K$.

(C) For each $i$, the group Pic$(O_i)$ is finite, and we have an algorithm PicardGroup to compute it.

(D) For each fractional $O$-ideal $I = I_1 \oplus \cdots \oplus I_n$, the quotient

$$Q(I) = \frac{O_1^{\oplus(s_1-1)} \oplus I_1 \oplus \cdots \oplus O_n^{\oplus(s_n-1)} \oplus I_n}{f_1^{\oplus(s_1-1)} \oplus f_1 I_1 \oplus \cdots \oplus f_n^{\oplus(s_n-1)} \oplus f_n I_n}$$
has finitely many sub-$R$-modules, and we have an algorithm called **SubModules** to list them all.

(E) We have an algorithm **IsIsomorphic** that returns whether $M$ and $N$ in $\mathcal{L}(R, V)$ are isomorphic.

**Remark 3.3.** We will focus on the case when $Q$ is a global field, that is, a number field or a finite extension of a function field $k(T)$ where $k$ is a finite field and $T$ is an indeterminate. Under this assumption, the number of isomorphism classes of $\mathcal{L}(R, V)$ is finite by the Jordan-Zassenhaus Theorem [Rei03, Thm. 26.4], which holds in much greater generality than the case we are considering. For example, it holds also for non-commutative orders. Nevertheless, Theorem 3.2 could be interpreted as an effective version of the Jordan-Zassenhaus Theorem in the special case of a commutative $Z$-order $R$ in an étale $Q$-algebra $K$ with $Q$ a global field.

If $Q$ is a global field, hypothesis (A) is satisfied by using algorithms based on (pseudo) hermite normal form or linear algebra over finite fields. See for example [Coh93] and [Coh00]. In the same context also hypothesis (B) is satisfied: see for example [Bau16] for the computation of the maximal order and see [KP05, Sec. 6] for the conductor.

Under the running assumption that $Q$ is a global field, $\mathrm{Pic}(\mathcal{O})$ is a finite abelian group. If $Q$ is a number field, the problem of computing each $\mathrm{Pic}(\mathcal{O}_i)$ is classical, see [BW89]. For finite extensions of function field, see [Hes99]. Hence, in both cases, hypothesis (C) is satisfied.

Assume again that $Q$ is a global field. Then the quotient $\mathcal{Q}(I)$ defined in (D) is a finite abelian group. We want to list all sub-$R$-modules $N$ of $\mathcal{Q}(I)$ with trivial extension, that is, such that $NO = \mathcal{Q}(I)$. These modules are in bijection with the modules $M'$ from Theorem 3.2. We will produce them by recursively computing the sub-$R$-modules of $\mathcal{Q}(I)$ which are maximal with respect to inclusion, as we now explain. This procedure is an adaptation of [FHS19, Sec. 5.2]. Let $N$ be a such a maximal sub-$R$-module. Then there exists a rational prime $p$ such that $p\mathcal{Q}(I) \subseteq N$. Hence $N$ can be identified with a sub-$\mathbb{F}_p$-vector space of $\mathcal{Q}(I)/p\mathcal{Q}(I)$. Now, one can use the **MEATAXE** algorithm, see [Par84] and [HEO05, Sec. 7.4], to enumerate all the maximal sub-$R$-modules of $\mathcal{Q}(I)/p\mathcal{Q}(I)$, which are closed under the induced action of $R$. From this list we need to keep only the ones with trivial extension: indeed if $NO \neq \mathcal{Q}(I)$ then all the sub-$R$-modules of $N$ will not have trivial extension as well. Now we repeat the process with $N$ instead of $\mathcal{Q}(I)$, and so on recursively until we have all sub-$R$-modules of $\mathcal{Q}(I)$ with trivial extension.

Finally, in [BHJ22], the authors describe an algorithm **IsIsomorphic** that in particular works for orders in étale algebras over $\mathbb{Q}$. Hence, such orders satisfy also assumption (E). To the best of our knowledge, there is no known analogous algorithm when $Q$ is an extension of a function field.

We conclude that orders in étale algebras over $\mathbb{Q}$ satisfy all hypotheses (A), (B), (C), (D) and (E). Note also that if $Q$ is a global field, then $Z$ is Japanese, which means that $\mathcal{O}$ is finitely generated as a $Z$-module, as required at the beginning of the section.

We introduce now some notation that we will use throughout the rest of this section. For any fractional $\mathcal{O}$-ideal $I = \oplus_i I_i$ define the quotient

$$ \mathcal{Q}(I) = \frac{\mathcal{O}_1^{\oplus(s_1-1)} \oplus I_1 \oplus \cdots \oplus \mathcal{O}_n^{\oplus(s_n-1)} \oplus I_n}{f_1^{\oplus(s_1-1)} \oplus f_1 I_1 \oplus \cdots \oplus f_n^{\oplus(s_n-1)} \oplus f_n I_n}, $$

as done before in (D). Denote by $q_I$ the quotient map onto $\mathcal{Q}(I)$. Define

$$ \tilde{M}_I = \{ \text{sub-$R$-module } \tilde{N} \text{ of } \mathcal{Q}(I) : \tilde{N}\mathcal{O} = \mathcal{Q}(I) \}, $$
and

$$ \mathcal{M}_I = \{ q_I^{-1}(\tilde{N}) \in \mathcal{L}(R, V) : \tilde{N} \in \tilde{\mathcal{M}}_I \}. $$

The following lemma will be used in Theorem 3.6 to prove the correctness of Algorithm 3.5.

**Lemma 3.4.**

(i) There is an $R$-linear isomorphism $\tilde{\psi} : \mathcal{Q}(\mathcal{O}) \to \mathcal{Q}(I)$.

(ii) The isomorphism $\tilde{\psi}$ induces a bijection $\psi : \mathcal{M}_{\mathcal{O}} \to \mathcal{M}_I$ defined by $\psi(M) = q_I^{-1}(\tilde{\psi}(q_{\mathcal{O}}(M)))$.

(iii) The bijection $\psi$ induces a bijection between the sets of $R$-linear isomorphism classes in $\mathcal{M}_{\mathcal{O}}$ and in $\mathcal{M}_I$.

*Proof.* By replacing $I$ with an isomorphic fractional $\mathcal{O}$-ideal, we can assume that $I$ is coprime to the conductor $f$, that is, $\mathcal{O} = f + I$; see [Coh00, Cor. 1.2.11]. This implies that $f_i I_i = f_i \cap I_i$ and $f_i + I_i = \mathcal{O}_i$, for every $i$. Therefore, for every $i$, we have the following isomorphism of $R$-modules

$$ \frac{I_i}{f_i I_i} = \frac{I_i}{f_i \cap I_i} \simeq \frac{I_i + f_i}{f_i} = \frac{\mathcal{O}_i}{f_i}. $$

By taking direct sums, we obtain the desired isomorphism $\tilde{\psi} : \mathcal{Q}(\mathcal{O}) \to \mathcal{Q}(I)$, completing the proof of Part (i). Part (ii) is an immediate consequence of Part (i). For Part (iii) we argue as follows. Pick $M_1$ and $M_2$ in $\mathcal{M}_{\mathcal{O}}$ and let $\varphi : M_1 \to M_2$ be an $R$-linear isomorphism. Since $\mathcal{Q}(\mathcal{O}) = M_i \mathcal{O} \otimes_{\mathcal{O}} (\mathcal{O}/f)$, for $i = 1, 2$, we see that $\varphi$ induces an automorphism of $\mathcal{Q}(\mathcal{O})$. Pushing this forward via $\tilde{\psi}$, we obtain an automorphism of $\mathcal{Q}(I)$ which then lifts to an isomorphism $\psi(M_1) \simeq \psi(M_2)$. In an analogous manner, given isomorphic $M_1$ and $M_2$ in $\mathcal{M}_I$, we obtain an isomorphism $\psi^{-1}(M_1) \simeq \psi^{-1}(M_2)$. Hence we obtain a bijection between the sets of $R$-linear isomorphism classes in $\mathcal{M}_{\mathcal{O}}$ and in $\mathcal{M}_I$, as required. $\square$

**Algorithm 3.5.** Assume that (A), (B), (C), (D) and (E) hold. The following steps will return a list $\mathcal{L}_{\text{out}}$ of representatives of the isomorphism classes of $\mathcal{L}(R, V)$.

(1) Compute the maximal order $\mathcal{O}$ of $K$ and the conductor $f = f_1 \oplus \cdots \oplus f_n$ of $R$ in $\mathcal{O}$.

(2) Use PicardGroup to compute representatives $I^{(k)} = \oplus_{i=1}^n I_i^{(k)}$ of
$$ \mathrm{Pic}(\mathcal{O}) = \bigoplus_{i=1}^n \mathrm{Pic}(\mathcal{O}_i). $$

(3) Form the quotient

$$ \mathcal{Q}(\mathcal{O}) = \frac{\mathcal{O}_1^{\oplus s_1} \oplus \cdots \oplus \mathcal{O}_n^{\oplus s_n}}{f_1^{\oplus s_1} \oplus \cdots \oplus f_n^{\oplus s_n}}, $$

and denote by $q_{\mathcal{O}}$ the natural quotient map.

(4) Use SubModules to produce a list $\tilde{\mathcal{M}}_{\mathcal{O}}$ of all the finitely many sub-$R$-modules $\tilde{M}$ of $\mathcal{Q}(\mathcal{O})$ such that $\tilde{M}\mathcal{O} = \mathcal{Q}(\mathcal{O})$.

(5) Initialize an empty list $\mathcal{L}$.

(6) For each $\tilde{M}$ in $\tilde{\mathcal{M}}_{\mathcal{O}}$ do:

(a) Compute $M = q_{\mathcal{O}}^{-1}(\tilde{M})$.

(b) If IsIsomorphic returns that there is no module $M'$ in $\mathcal{L}$ which is isomorphic to $M$ then append $M$ to $\mathcal{L}$.

(7) Initialize an empty output list $\mathcal{L}_{\text{out}}$.

(8) For each $k$ do:

(a) Initialize an empty list $\mathcal{L}^{(k)}$.
(b) Compute $\tilde{\psi} : Q(O) \xrightarrow{\sim} Q(I^{(k)})$ as in Lemma 3.4.(i).

(c) For each $M$ in $\mathcal{L}$ do:

(i) Compute $M' = q_I^{-1}(\tilde{\psi}(q_O(M)))$.

(ii) Append $M'$ to $\mathcal{L}^{(k)}$.

(d) Concatenate $\mathcal{L}^{(k)}$ to $\mathcal{L}_{\text{out}}$.

(9) Return $\mathcal{L}_{\text{out}}$.

**Theorem 3.6.** *Algorithm 3.5 returns a minimal set of representatives of the isomorphism classes in $\mathcal{L}(R, V)$.*

*Proof.* By Theorem 3.2 for every $M$ in $\mathcal{L}(R, V)$ there exist an index $k$ and an element $M'$ of $M_{I^{(k)}}$ such that $M \simeq M'$. By Lemma 3.4.(iii), there exists $M''$ in $\mathcal{L}^{(k)}$ such that $M \simeq M''$. In other words, the list $\mathcal{L}_{\text{out}}$ contains representatives of all isomorphism classes of $\mathcal{L}(R, V)$. We need to show that there are no repetitions, that is, that the elements of $\mathcal{L}_{\text{out}}$ are pairwise non-isomorphic. Again by Lemma 3.4.(iii), for each index $k$, the elements of $\mathcal{L}^{(k)}$ are pairwise non-isomorphic. We are left to show that given two distinct indices $k$ and $k'$, and modules $M \in \mathcal{L}^{(k)}$ and $M' \in \mathcal{L}^{(k')}$, there cannot be an isomorphism $M \simeq M'$. Indeed, if this were the case then we would have an isomorphism $MO \simeq M'O$, contradicting Proposition 3.1. $\square$

**Corollary 3.7.** *The number of isomorphism classes in $\mathcal{L}(R, V)$ is divisible by the size of $\text{Pic}(O)$.*

*Proof.* This is a consequence of the fact that the lists $\mathcal{L}^{(k)}$ defined in Step (8) of Algorithm 3.5 all have size equal to the size of the list $\mathcal{L}$ built in Step (6). $\square$

**Remark 3.8.** In Step (6) of Algorithm 3.5, we use as a black-box the algorithm *IsIsomorphic* to test whether two $R$-modules $M$ and $M'$ are isomorphic, where $M$ is fixed while $M'$ loops over all elements of $\mathcal{L}$. As pointed out in Remark 3.3, in the case of orders in *étale algebras* over $Q$, we can use the algorithm provided by [BHJ22], which we now briefly review. Set $A = \text{Hom}_K(V, V)$, $X = \text{Hom}_R(M, M')$ and $\Lambda = \text{End}_R(M')$. By [BHJ22, Prop 3.1], we have that $M$ and $M'$ are isomorphic if and only if the $\Lambda$-lattice $X$ is free of rank 1, and every (any) free generator of $X$ over $\Lambda$ is an isomorphism. The number of the Steps below refers to [BHJ22, Alg. 8.3], which returns whether $X$ is free of rank 1 over $\Lambda$ and, if so, a generator. All outputs of Steps (1)-(4), (8)-(9) should be cached, since they depend only on $M$. Moreover, following the proof of [BHJ22, Thm. 8.4], Step (5) is probabilistic polynomial-time reducible to one call of *IsPrincipal* for each $1 \le i \le n$. Hence, one should also cache $\text{Pic}(O_{K_i})$, and also $O_{K_i}^\times$ since it is used in Step (10). Step (6) is probabilistic polynomial-time reducible to computing a factorization of an integer, which should also be stored.

**Remark 3.9.** We discuss here the running time of Algorithm 3.5 under the assumption that $R$ is a $\mathbb{Z}$-order in an *étale algebra* over $Q$. In this case the required operations with $\mathbb{Z}$-lattices and fractional ideals (cf. hypothesis (A)) can be performed in polynomial time. Steps (7) and (9) are trivial. Steps (1) and (3) have polynomial running time in the size of the input once the computation of the maximal order $O$ is completed which requires to know the prime factors of the discriminant of a polynomial defining $K$ over $Q$. Step (2) can be achieved in heuristic sub-exponential running time using for example [CDyDO97]. Step (8) requires the computations of a representative coprime to the conductor which is probabilistic polynomial time; see [BHJ22, Cor. A.2]. In Step (6), we have to run *IsIsomorphic* a number of times which is bounded by above by the size of the output of Step (4) and the size of the list $\mathcal{L}$. The algorithm provided by [BHJ22] reduces in probabilistic polynomial time to well known algorithm in number theory (like *IsPrincipal*
and UnitGroup). It follows that the running time of Algorithm 3.5 depends on the size of output of Step (4), the list $\tilde{\mathcal{M}}_O$, which is produced by SubModules using, for example, the ideas described in Remark 3.3. In general, it is not easy to give an upper bound for the size of this list, but a lower bound is computed as follows. Let $\mathfrak{p}$ be a maximal ideal of $R$ above the conductor $f$ of $R$. Write $\mathfrak{p}O = \mathfrak{P}_1 \oplus \cdots \oplus \mathfrak{P}_n$, where $\mathfrak{P}_i$ is an ideal of $O_i$, for each $i$. Then the number of sub-$R$-modules of $Q(O)$ is bounded from below from the number $C_{\mathfrak{p}}$ of sub-$R/\mathfrak{p}$-vector subspaces of the $R/\mathfrak{p}$-vector space

$$ \frac{\mathcal{O}_1^{\oplus s_1} \oplus \cdots \oplus \mathcal{O}_n^{\oplus s_n}}{\mathfrak{P}_1^{\oplus s_1} \oplus \cdots \oplus \mathfrak{P}_n^{\oplus s_n}}. $$

Then taking the maximum of $C_{\mathfrak{p}}$ over all maximal $R$-ideals above $f$ gives a lower bound.

**Remark 3.10.** When $R$ is an order in an étale algebra over $\mathbb{Q}$, the process described in Algorithm 3.5 can be used to label the isomorphism classes of lattices in $\mathcal{L}(R, V)$, as we now describe.

The representatives of each $\mathrm{Pic}(O_i)$ can be ordered in a deterministic way by [CPS20]. Taking direct sums, we obtain an induced ordering on $\mathrm{Pic}(O)$, and hence we can order the various quotients $Q(I^{(k)}).$

To conclude it suffices to sort the sub-$R$-modules $\tilde{M}$ of $Q(O)$, that is, the elements of the list $\tilde{\mathcal{M}}_O$. This can be done, for example, as follows. Let $q_O$ be the quotient map onto $Q(O)$. For each $\tilde{M}$, compute the Hermite Normal Form of the matrix representing a $\mathbb{Z}$-basis of $M_0 := q_O^{-1}(\tilde{M})$ with respect to a fixed $\mathbb{Q}$-basis of $V$. Then one simply sorts these matrices to obtain the desired result. In fact, one can use this method together with invariants that take into account the $R$-module structure of $M_0$, like, for example, the $R/\mathfrak{p}$-dimensions of $M_0 \otimes_R R/\mathfrak{p}$ where $\mathfrak{p}$ runs over the finitely many primes $\mathfrak{p}$ of $R$ above the conductor $f = (R : O)$.

## 4. CONJUGACY CLASSES OF SEMISIMPLE INTEGRAL MATRICES

Let $A$ and $B$ be two square matrices with integer coefficients, both of dimension $r$. Recall that $A$ and $B$ are $\mathbb{Z}$-conjugate if there exists a matrix $P$ in $\mathrm{GL}_r(\mathbb{Z})$ such that $PA = BP$, in which case we will write $A \sim_B B$. If $A$ and $B$ are $\mathbb{Z}$-conjugate then they have the same minimal and characteristic polynomials.

Let $m$ be a squarefree polynomial in $\mathbb{Z}[x]$, that is, such that the factors appearing in its irreducible factorization

$$ m = m_1 \cdots m_n $$

generate pairwise coprime ideals in $\mathbb{Q}[x]$. Fix positive integers $s_1, \dots, s_n$. Define

$$ h = m_1^{s_1} \cdots m_n^{s_n}. $$

Denote by $\mathrm{Mat}_{m,h}$ the set of integral square matrices with minimal polynomial $m$ and characteristic polynomial $h$. Since $m$ is squarefree, these matrices are semisimple. Consider the étale algebra $K = \mathbb{Q}[x]/m$, and the order $R = \mathbb{Z}[\pi]$, where $\pi$ denotes the class of the variable $x$ in $K$. Consider

$$ V = K_1^{s_1} \oplus \cdots \oplus K_n^{s_n}. $$

As before, $\mathcal{L}(R, V)$ denotes the category of $\mathbb{Z}$-lattices in $V$ which are $R$-modules. Pick $M$ in $\mathcal{L}(R, V)$ and choose a $\mathbb{Z}$-basis $B$ of $M$. Define $A_{M,B}$ as the matrix that represents multiplication by $\pi$ on $M$ with respect to the basis $B$. Since $M$ is an $R$-module, the matrix $A_{M,B}$ has integer entries. Denote by $\Psi$ the function that associates the pair $(M, B)$ to the matrix $A_{M,B}$. In previous work, we proved the following theorem, which is a generalization of the Latimer-MacDuffee Theorem [LM33].
**Theorem 4.1.** [Mar20, Thm. 8.1] The function $\Psi$ induces a bijection between the isomorphism classes in $\mathcal{L}(R, V)$ and $\mathrm{Mat}_{m,h} / \sim_{\mathbb{Z}}$.

Combining Theorem 4.1 with Algorithm 3.5 we obtain the following theorem.

**Theorem 4.2.** *Algorithm 3.5 allows us to compute a minimal set of representatives of $\mathrm{Mat}_{m,h} / \sim_{\mathbb{Z}}$.*

**Remark 4.3.** As mentioned above, the matrices in $\mathrm{Mat}_{m,h}$ are semisimple. It is known that, in general, an integral square matrix $A$ can be written uniquely as $A = S+N$, where $S$ is semisimple, $N$ is nilpotent and $SN = NS$. If $A' = S'+N'$ is another matrix, with analogous decomposition, then there exists an invertible integral matrix $P$ such that $PA = A'P$ if and only if $PS = S'P$ and there exists an invertible integral matrix $T$ in the stabilizer of $S'$ such that $TPN = N'TP$. This seems to suggest that in order to generalize Theorem 4.1, one first needs to find a method to compute conjugacy classes of nilpotent matrices with prescribed minimal and characteristic polynomials, where the conjugation is realized only by matrices in a subgroup of $\mathrm{GL}_n(\mathbb{Z})$. To the best of our knowledge, this problem has not been solved yet.

**Remark 4.4.** Theorem 4.1 together with Remark 3.10 gives a method to label the representatives of the conjugacy classes in $\mathrm{Mat}_{m,h}$.

## 5. ISOMORPHISM CLASSES OF ABELIAN VARIETIES OVER FINITE FIELDS

In this section we describe how to use Algorithm 3.5 to compute the isomorphism classes of abelian varieties over a finite field $\mathbb{F}_q$ belonging to isogeny classes satisfying certain hypotheses. Here, by isogeny classes, we mean $\mathbb{F}_q$-isogeny classes. Recall that by Honda-Tate theory, see [Tat66], [Hon68] and [Tat71], such an isogeny class is uniquely determined by the characteristic polynomial $h$ of Frobenius of any abelian variety in the isogeny class. We will denote the isogeny class by $\mathcal{I}_h$, and turn it into a category by considering $\mathbb{F}_q$-morphisms between the objects. The polynomial $h$ is in $\mathbb{Z}[x]$, has degree $2g$, where $g$ is the dimension of any abelian variety in $\mathcal{I}_h$, and all its complex roots have norm $\sqrt{q}$. Recall also that $\mathcal{I}_h$ is ordinary if the coefficient of $x^g$ in $h$ is coprime to $q$.

Consider the factorization

$$h = m_1^{s_1} \cdots m_n^{s_n}$$

into irreducible factors, with the $m_i$ generating pairwise coprime ideals in $\mathbb{Q}[x]$. Put $m = m_1 \cdots m_n$. Define $K_i = \mathbb{Q}[x]/m_i$ for each $i$, and denote by $\pi$ the class of $x$ in $K = K_1 \times \cdots \times K_n$. Consider the order $R = \mathbb{Z}[\pi, q/\pi]$ in $K$. Finally, set

$$V = K_1^{s_1} \oplus \cdots \oplus K_n^{s_n}.$$

As before, $\mathcal{L}(R, V)$ denotes the category of $\mathbb{Z}$-lattices in $V$ which are $R$-modules, with $R$-linear morphisms.

**Theorem 5.1.**

(i) Assume that $h$ is ordinary. Then there is a categorical equivalence between $\mathcal{I}_h$ and $\mathcal{L}(R, V)$.

(ii) Assume that $q$ is prime and that $h$ does not have real roots. Then there is a categorical anti-equivalence between $\mathcal{I}_h$ and $\mathcal{L}(R, V)$.

In both cases, we obtain a bijection between the isomorphism classes of abelian varieties in $\mathcal{I}_h$ and the isomorphism classes in $\mathcal{L}(R, V)$.

*Proof.* See [Mar19, Theorem 4.1.(a)] for a complete proof in the case where $h$ is a power of $m$. We review the main steps here for completeness. We first handle the ordinary case. By Deligne [Del69, Sec. 7, Théorème], there is an equivalence
between $\mathcal{I}_h$ and the category of pairs $(T, F)$ where $T$ is a free finitely generated $\mathbb{Z}$-module and $F$ is an endomorphism of $T$ with characteristic polynomial $h$, which is semisimple, and there is a $\mathbb{Z}$-linear endomorphism $V$ of $T$ such that $V \circ F$ and $F \circ V$ are both the multiplication-by-$q$ map on $T$. A morphism between two pairs $(T, F)$ and $(T', F')$ is a $\mathbb{Z}$-linear morphism $\varphi: T \to T'$ such that $F' \circ \varphi = \varphi \circ F$.

Fix a pair $(T, F)$ as above. Since $F$ is semisimple, its minimal polynomial is $m$. Hence we can identify $F$ with $\pi$ and $V$ with $q/\pi$. This identification induces an $R$-module structure on $T$, and induces a $K$-linear isomorphism $T \otimes_{\mathbb{Z}} \mathbb{Q} \simeq V$. Via this isomorphism, we can identify $T$ with an element of $\mathcal{L}(R, V)$. Therefore we obtain an equivalence between $\mathcal{I}_h$ and $\mathcal{L}(R, V)$.

Applying the same argument to the result of Centeleghé-Stix [CS15, Thm. 1], with arrows reversed, induces the anti-equivalence in the case where $q$ is prime and $h$ has no real roots. □

Combining Theorem 5.1 with Algorithm 3.5 we obtain the following result.

**Theorem 5.2.** Assume that $h$ is ordinary, or that $q$ is prime and $h$ has no real roots. Algorithm 3.5 allows us to compute all the representatives of the isomorphism classes of abelian varieties in $\mathcal{I}_h$.

**Remark 5.3.** Theorem 5.2 together with Remark 3.10 gives a method to label abelian varieties in the isogeny class $\mathcal{I}_h$.

## 6. EXAMPLES

Algorithm 3.5 has been implemented in MAGMA [BCP97]. Such implementation is available at https://github.com/stmar89/AlgEt<fnref n="2" />, together with the code to reproduce the examples (see the webpage of the author for a precise link). Even if it is possible run the code using only MAGMA, it is much faster to combine it with the implementation of IsIsomorphic from [BHJ22] which is included in the julia package Nemo/Hecke [FHHJ17]. Detailed instructions are included in the code.

**Example 6.1.** Consider the polynomials

$$m_1 = x^2 - x + 3 \quad \text{and} \quad m_2 = x^2 + x + 3.$$

Put $K_i = \mathbb{Q}[x]/m_i$ for $i = 1, 2$ and let $\pi_i$ be the class of $x$ in $K_i$. Consider the isogeny classes $\mathcal{I}_{m_1}$ and $\mathcal{I}_{m_2}$ of ordinary elliptic curves over $\mathbb{F}_3$ determined by $m_1$ and $m_2$. Since both $\mathcal{O}_1 = \mathbb{Z}[\pi_1]$ and $\mathcal{O}_2 = \mathbb{Z}[\pi_2]$ are maximal and have trivial Picard group, we see that both isogeny classes contain a unique isomorphism class of elliptic curves. We will denote the representatives by $E_1$ and $E_2$, respectively.

Now we consider the product

$$m = m_1 m_2 = x^4 + 5x^2 + 9.$$

Put $K = K_1 \times K_2$ and denote by $\pi$ the class of $x$ in $K$. Put $R = \mathbb{Z}[\pi, 3/\pi]$. Using Algorithm 3.5, we see that there are 4 isomorphism classes in $\mathcal{L}(R, K)$. Note that such modules are fractional $R$-ideals in $K$, so in fact it is more efficient to use the specialized code from [Mar20]. The only overorder of $R$ is the maximal order $\mathcal{O} = \mathcal{O}_1 \times \mathcal{O}_2$ of $K$. Among the 4 classes, 3 come from $\text{Pic}(R)$, and the last one from $\text{Pic}(\mathcal{O})$, which is trivial. These isomorphism classes correspond to 4 isomorphism classes of abelian varieties in $\mathcal{I}_m$ by Theorem 5.1. More precisely, the isomorphism classes in $\mathcal{I}_m$ are represented by 3 abelian surfaces, $A_1, A_2, A_3$, all with endomorphism ring isomorphic to $R$, and then the class of $E_1 \times E_2$. Since the order $R$ is not a direct product of orders from $K_1$ and $K_2$, we deduce that no surface $A_i$ is isomorphic to a product of elliptic curves.

<footnote n="2">²at the moment of submission, the most recent commit is 4c22349</footnote>
Consider the isogeny class $\mathcal{I}_h$ of abelian threefolds determined by

$$h = m_1^2 m_2 = x^6 - x^5 + 8x^4 - 5x^3 + 24x^2 - 9x - 27.$$

Algorithm 3.5 shows that there are 2 isomorphism classes in $\mathcal{L}(R, K_1^2 \oplus K_2)$, represented by $O_1 \times R$ and $O_1 \times O_1 \times O_2$. By Theorem 5.1, these correspond to the isomorphism classes of abelian varieties in $\mathcal{I}_h$, represented by

$$A_1 \times E_1 \text{ and } E_1^2 \times E_2.$$

In particular, we have $\mathbb{F}_3$-isomorphisms

$$A_1 \times E_1 \simeq A_2 \times E_1 \simeq A_3 \times E_1.$$

**Example 6.2.** In this example we consider again the polynomials

$$m_1 = x^2 - x + 3,$$

$$m_2 = x^2 + x + 3,$$

$$m = m_1 m_2 = x^4 + 5x^2 + 9,$$

$$h = m_1^2 m_2 = x^6 - x^5 + 8x^4 - 5x^3 + 24x^2 - 9x - 27.$$

from Example 6.1. For $i = 1, 2$, define $K_i = \mathbb{Q}[x]/m_i$. Put $K = K_1 \times K_2$ as before, but now we consider the order $E = \mathbb{Z}[\pi]$, where $\pi$ is the class of $x$ in $K$ (instead of $R = \mathbb{Z}[\pi, 3/\pi]$ as in Example 6.1).

We want to compute the representatives of $\mathbb{Z}$-conjugacy classes of integral matrices having minimal polynomial $m$ and characteristic polynomial $h$, that is, in the notation from Section 4, we want to compute representatives of $\mathrm{Mat}_{m,h} / \sim_{\mathbb{Z}}$. By Theorem 4.1 we have to compute the isomorphism classes of modules in $\mathcal{L}(E, K_1^2 \oplus K_2)$. Algorithm 3.5 returns that there are 4 classes, represented by the following matrices.

$$\begin{pmatrix} 0 & 1 & 0 & 0 & 0 & 0 \\ -3 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & -3 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & -3 & -1 \end{pmatrix},$$

$$\begin{pmatrix} 0 & 1 & 0 & 0 & 0 & 0 \\ -3 & 1 & 0 & 0 & 0 & -1 \\ 0 & 0 & 0 & 1 & -2 & 0 \\ 0 & 0 & -3 & 1 & -1 & 2 \\ 0 & 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & -3 & -1 \end{pmatrix}$$

$$\begin{pmatrix} 0 & 1 & 0 & 0 & 0 & 2 \\ -3 & 1 & 0 & 0 & 2 & 0 \\ 0 & 0 & 0 & 1 & 0 & 1 \\ 0 & 0 & -3 & 1 & 1 & 0 \\ 0 & 0 & 0 & 0 & 0 & 3 \\ 0 & 0 & 0 & 0 & -1 & -1 \end{pmatrix},$$

$$\begin{pmatrix} 0 & 1 & 0 & 0 & 0 & 1 \\ -3 & 1 & 0 & 0 & 1 & -1 \\ 0 & 0 & 0 & 1 & -1 & 2 \\ 0 & 0 & -3 & 1 & 2 & 3 \\ 0 & 0 & 0 & 0 & 0 & 3 \\ 0 & 0 & 0 & 0 & -1 & -1 \end{pmatrix}.$$

**Competing interest statement**

The author has no competing interests to declare that are relevant to the content of this article.

**Data availability statement**

No datasets were generated or analysed during the current study.

**Published version**

This version of the article has been accepted for publication, after peer review but is not the Version of Record and does not reflect post-acceptance improvements, or any corrections. The Version of Record is available online at: https://doi.org/10.1007/s40993-024-00584-9
REFERENCES

[Bas62] Hyman Bass. Torsion free and projective modules. *Trans. Amer. Math. Soc.*, 102:319–327, 1962.

[Bau16] Jens-Dietrich Bauch. Computation of integral bases. *J. Number Theory*, 165:382–407, 2016.

[BCP97] Wieb Bosma, John Cannon, and Catherine Playoust. The Magma algebra system. I. The user language. *J. Symbolic Comput.*, 24(3-4):235–265, 1997.

[Ben67] Edward A. Bender. Classes of matrices over an integral domain. *Illinois Journal of Mathematics*, 11(4):697 – 702, 1967.

[BF65] Zenon Ivanovich Borevič and Dmitrii Konstantinovich Faddeev. Representations of orders with cyclic index. *Trudy Mat. Inst. Steklov*, 80:51–65, 1965.

[BHJ22] Werner Bley, Tommy Hofmann, and Henri Johnston. Computation of lattice isomorphisms and the integral matrix similarity problem. *Forum Math. Sigma*, 10:Paper No. e87, 36, 2022.

[BKM23] Jonas Bergström, Valentijn Karemaker, and Stefano Marseglia. Polarizations of abelian varieties over finite fields via canonical liftings. *Int. Math. Res. Not. IMRN*, (4):3194–3248, 2023.

[Brz90] J. Brzezinski. On two classical theorems in the theory of orders. *Journal of Number Theory*, 34(1):21–32, 1990.

[BS22] Nicholas R. Baeth and Daniel Smertnig. Lattices over Bass rings and graph agglomerations. *Algebr. Represent. Theory*, 25(3):669–704, 2022.

[Buc69] Alphonse Buccino. Matrix classes and ideal classes. *Illinois J. Math.*, 13:188–191, 1969.

[BW89] Johannes Buchmann and H. C. Williams. On the computation of the class number of an algebraic number field. *Math. Comp.*, 53(188):679–688, 1989.

[CDyDO97] H. Cohen, F. Diaz y Diaz, and M. Olivier. Subexponential algorithms for class group and unit computations. volume 24, pages 433–441. 1997. Computational algebra and number theory (London, 1993).

[Coh93] Henri Cohen. *A course in computational algebraic number theory*, volume 138 of *Graduate Texts in Mathematics*. Springer-Verlag, Berlin, 1993.

[Coh00] Henri Cohen. *Advanced topics in computational number theory*, volume 193 of *Graduate Texts in Mathematics*. Springer-Verlag, New York, 2000.

[CPS20] John Cremona, Aurel Page, and Andrew V. Sutherland. Sorting and labelling integral ideals in a number field. *arXiv e-prints*, page arXiv:2005.09491, May 2020.

[CR81] Charles W. Curtis and Irving Reiner. *Methods of representation theory. Vol. I*. Pure and Applied Mathematics. John Wiley & Sons, Inc., New York, 1981. With applications to finite groups and orders.

[CR87] Charles W. Curtis and Irving Reiner. *Methods of representation theory. Vol. II*. Pure and Applied Mathematics (New York). John Wiley & Sons, Inc., New York, 1987. With applications to finite groups and orders, A Wiley-Interscience Publication.

[CS15] Tommaso Giorgio Centeghe and Jakob Stix. Categories of abelian varieties over finite fields, I: Abelian varieties over $F_p$. *Algebra Number Theory*, 9(1):225–265, 2015.

[Del69] Pierre Deligne. Variétés abéliennes ordinaires sur un corps fini. *Invent. Math.*, 8:238–243, 1969.

[EG84] Dennis R. Estes and Robert M. Guralnick. Representations under ring extensions: Latimer-MacDuffee and Taussky correspondences. *Adv. in Math.*, 54(3):302–313, 1984.

[EHO19] Bettina Eick, Tommy Hofmann, and E. A. O'Brien. The conjugacy problem in $GL(n, \mathbb{Z})$. *J. Lond. Math. Soc. (2)*, 100(3):731–756, 2019.

[FHHJ17] Claus Fieker, William Hart, Tommy Hofmann, and Fredrik Johansson. Nemo/Hecke: Computer algebra and number theory packages for the julia programming language. In *Proceedings of the 2017 ACM on International Symposium on Symbolic and Algebraic Computation*, ISSAC '17, pages 157–164, New York, NY, USA, 2017. ACM.

[FHS19] Claus Fieker, Tommy Hofmann, and Carlo Sircana. On the construction of class fields. In *Proceedings of the Thirteenth Algorithmic Number Theory Symposium*, volume 2 of *Open Book Ser.*, pages 239–255. Math. Sci. Publ., Berkeley, CA, 2019.

[Gur80] Robert M. Guralnick. A note on the local-global principle for similarity of matrices. *Linear Algebra and its Applications*, 30:241–245, 1980.

[Gur84] Robert M. Guralnick. The genus of a module. *J. Number Theory*, 18(2):169–177, 1984.

[Gur86] Robert M. Guralnick. Power cancellation of modules. *Pacific J. Math.*, 124(1):131–144, 1986.
[Gur87] Robert M. Guralnick. The genus of a module. II. Roüter's theorem, power cancellation and extension of scalars. *J. Number Theory*, 26(2):149-165, 1987.

[HEO05] Derek F. Holt, Bettina Eick, and Eamonn A. O'Brien. *Handbook of computational group theory*. Discrete Mathematics and its Applications (Boca Raton). Chapman & Hall/CRC, Boca Raton, FL, 2005.

[Hes99] Florian Hess. *Zur Divisorenklassengruppenberechnung in globalen Funktio- nenkörpern*. 1999. Ph.D. Thesis, Technische Universität, Berlin.

[Hon68] Taira Honda. Isogeny classes of abelian varieties over finite fields. *J. Math. Soc. Japan*, 20:83-95, 1968.

[Hus16] David Husert. *Similarity of integer matrices*. University of Paderborn, 2016. PhD Thesis.

[Jac68] H. Jacobinski. Über die Geschlechter von Gittern über Ordnungen. *J. Reine Angew. Math.*, 230:29-39, 1968.

[KP05] Jürgen Klüners and Sebastian Pauli. Computing residue class rings and Picard groups of orders. *J. Algebra*, 292(1):47-64, 2005.

[KS24] Lucy Knight and Alexander Stasinski. Representatives of similarity classes of matrices over pids corresponding to ideal classes. *Glasgow Mathematical Journal*, 66(1):88-103, 2024.

[LM33] Claiborne G. Latimer and C. C. MacDuffee. A correspondence between classes of ideals and classes of matrices. *Ann. of Math. (2)*, 34(2):313-316, 1933.

[LMF22] The LMFDB Collaboration. The L-functions and modular forms database. http://www.lmfdb.org, 2022. [Online; accessed 02 August 2022].

[LW85] Lawrence S. Levy and Roger Wiegand. Dedekind-like behavior of rings with 2-generated ideals. *J. Pure Appl. Algebra*, 37(1):41-58, 1985.

[Mar19] Stefano Marseglia. Computing abelian varieties over finite fields isogenous to a power. *Res. Number Theory*, 5(4):Paper No. 35, 17, 2019.

[Mar20] Stefano Marseglia. Computing the ideal class monoid of an order. *J. Lond. Math. Soc. (2)*, 101(3):984-1007, 2020.

[Mar21] Stefano Marseglia. Computing square-free polarized abelian varieties over finite fields. *Math. Comp.*, 90(328):953-971, 2021.

[Mar22] Stefano Marseglia. Cohen-Macaulay type of orders, generators and ideal classes. *arXiv e-prints*, page arXiv:2206.03758, June 2022.

[OS20] Abhishek Oswal and Ananth N. Shankar. Almost ordinary abelian varieties over finite fields. *J. Lond. Math. Soc. (2)*, 101(3):923-937, 2020.

[Par84] Richard Alan Parker. The computer calculation of modular characters (the meat-axe). In *Computational group theory (Durham, 1982)*, pages 267-274. Academic Press, London, 1984.

[Reh77] Hans P. Rehm. On Ochoa's special matrices in matrix classes. *Linear Algebra Appl.*, 17(2):181-188, 1977.

[Rei03] Irving Reiner. *Maximal orders*, volume 28 of *London Mathematical Society Monographs. New Series*. The Clarendon Press, Oxford University Press, Oxford, 2003.

[RHD70] Klaus W. Roggenkamp and Verena Huber-Dyson. *Lattices over orders. I*. Lecture Notes in Mathematics, Vol. 115. Springer-Verlag, Berlin-New York, 1970.

[Rog70] Klaus W. Roggenkamp. *Lattices over orders. II*. Lecture Notes in Mathematics, Vol. 142. Springer-Verlag, Berlin-New York, 1970.

[Sol99] Louis Solomon. Similarity of the companion matrix and its transpose. volume 302/303, pages 555-561. 1999. With an appendix by Robert M. Guralnick, Special issue dedicated to Hans Schneider (Madison, WI, 1998).

[Ste12] Ernst Steinitz. Rechteckige Systeme und Moduln in algebraischen Zahlkörpern. II. *Math. Ann.*, 72(3):297-345, 1912.

[Tat66] John Tate. Endomorphisms of abelian varieties over finite fields. *Invent. Math.*, 2:134-144, 1966.

[Tat71] John Tate. Classes d'isogénie des variétés abéliennes sur un corps fini (d'après T. Honda). In *Séminaire Bourbaki. Vol. 1968/69: Exposés 347-363*, volume 175 of *Lecture Notes in Math.*, pages Exp. No. 352, 95-110. Springer, Berlin, 1971.

[Tau49] Olga Taussky. On a theorem of Latimer and MacDuffee. *Canadian J. Math.*, 1:300-302, 1949.

[Wal84] D. I. Wallace. Conjugacy classes of hyperbolic matrices in $Sl(n, \mathbb{Z})$ and ideal classes in an order. *Trans. Amer. Math. Soc.*, 283(1):177-184, 1984.

[Wie84] Roger Wiegand. Cancellation over commutative rings of dimension one and two. *J. Algebra*, 88(2):438-459, 1984.
MATHEMATICAL INSTITUTE, UTRECHT UNIVERSITY, P.O. BOX 80010, 3508 TA, UTRECHT, THE NETHERLANDS

(current) LABORATOIRE DE MATHÉMATIQUES GAATI, UNIVERSITÉ DE LA POLYNÉSIE FRANÇAISE, FAAA, FRENCH POLYNESIA

Email address: stefano.marseglia@upf.pf