Module helpers

Module helpers 

Source
Expand description

This module defines methods that assist in plumbing together methods that operate on u32s, such as the ones on FpVector, with methods that operate on FieldElement<Fp<P>>s, such as the ones on FqVector.

The difficulty is that the field is necessary to make the conversion, through the FieldInternal::el method, but depending on the field, the return type will be different. For example, depending on whether an FpVector is over F2 or F3, the field element will be either FieldElement<Fp<P2>> or FieldElement<Fp<P3>>. Therefore, it is the struct itself that needs to make the conversion using its own field attribute.

It would in theory be possible to just hide the conversion in a more complicated macro, but because the u32 arguments have various names and appear in different positions in the signature of the methods, I suspect it would be a major hassle.