Let $k$ be a finite field of order $p^a$ and characteristic $p$, and $\mathcal{C}$ a $k$ isogeny class of elliptic curves over $k$. Let $w$ be the (Galois conjugacy class of the) Weil $k$-number attached to $\mathcal{C}$, and let $f(x)\in\mathbf{Z}[x]$ be its minimal, monic polynomial.

Assume that $\mathcal{C}$ is such that $f(x)$ has degree $>1$ (this amounts to exclude the case $a=2a'$ even and $f(x)=x\pm p^{a'}$). Equivalently, assume that any object $E$ in $\mathcal{C}$ has a commutative ring of $k$-endomorphisms, which is an order in an imaginary quadratic field (notice that this is weaker than to require $\mathcal{C}$ be given by ordinary elliptic curves).

Question: what is the number $R(f)$ of isomorphisms classes of objects in $\mathcal{C}$?

Candidate answer: $R(f)$ is the same as the number $S(f)$ of $SL_2(\mathbf{Z})$-orbits of 2x2 matrices $m\in M_2(\mathbf{Z})$ with integral coefficients with characteristic polynomial equal to $f(x)$, and with bottow left entry, say, positive (the $SL_2(\mathbf{Z})$-action is via conjugation, the sign of the bottom left entry is indeed a conjugacy invariant thanks to the fact that the discriminant of $f(x)$ is $<0$).

It seems that in the literature people tend to considered the weighted number $R'(f)$ of isomorphism classes of elliptic curves. This, at least when $k$ is the prime field, is known to be equal to a certain Kronecker class number $H(D)$ (cf. Lenstra, $\textit{Factoring integers with elliptic curves}$, Annals of Math., 126 (1987), 649-673), depending on the discriminant $D$ of $f(x)$. The Kronecker number $H(D)$ parametrizes weighted isomorphisms classes of positive definite, binary quadratic forms of discriminant $D$ (not necessarily primitive!).

The link with conjugacy classes of $2x2$ matrices proposed above comes from the fact that such number $S(f)$ is equal to the number of isomorphism classes of positive definite, binary quadratic forms of discriminant $D$ (not necessarily primitive!).

[One way to see this is by noticing that multiplication to the left by $(0, 1; -1, 0)$ gives a map from $M_2(\mathbf{Z})$ to itself which turns the $SL_2(\mathbf{Z})$ conjugation action into the $SL_2(\mathbf{Z})$ similitude action, i.e., $m\rightarrow g m g^t$, where $g^t$ is the transpose of $g$]

Basically, I would like a procedure that given an elliptic curve E in $\mathcal{C}$ produces a 2x2 matrix with characteristic polynomial equal to $f(x)$, whose conjugacy class determines that of $E$ (one might need to make some choices at the beginning, but that's fine). The standard idea (may be?) would be to fix an "origin" $E_0$ of $\mathcal{C}$ and then to attach to each isogeny $\varphi:E_0\rightarrow E$ the ideal $I_E$ of $\textrm{End}_k(E_0)$ given by those morphisms factoring through $\varphi$. Then one could try to show that the free rank $2$, $\mathbf{Z}$-module $I_E$ equipped with the multiplication action by $\pi_{E_0}\in\textrm{End}_k(E_0)$ (the Frobenius of $E_0$ relative to $k$) determines completely the isomorphism class of $E$. (I learnt of this approach from Waterhouse, $\textit{Abelian varieties over finite fields}$. However he tends to consider isomorphism classes of objects lying in a given isogeny class and with a fixed endomorphism ring that is a maximal order). Any comments, hints, or the answer itself would be appreciated. Thanks.