algebra
algebra copied to clipboard
Field should return size
Field should return extension degree + characteristic (already impl) so that one can easily determine its order.
One can determine the extension degree recursively. So for any extension of degree > 1, it returns d * Self::BaseField::extension_degree(), and primefield returns 1.
Unfortunately, representing this modulus is a problem. Since, one usually has a modulus that is just shy of setting all the bits in the BigInteger representation. So for a field extension like Fp12 or higher, one is not guaranteed that one can represent the modulus.
I don't think we need the field to return the size (due to the representation problem), I view providing the extension degree and characteristic as sufficient.
Maybe we could add a floor_field_size_in_bits, by calculating floor(extension_degree * log_2(characteristic)) with a logarithm method that returns a decimal. (Don't want to return float, due to non-determinism across arch's)