pub struct PrimitivePolynomialField { /* private fields */ }
Expand description

Implements field arithmetic compatible with primitive IrreducablePolynomials.

Recall that there are two strategies for optimizing field arithmetic in GF(2^8): accessing direct multiplication and division tables, and manipulating logarithms and exponentials. The latter method requires fewer operations, but is only possible if the given IrreducablePolynomial is primitive.

This struct uses exponentiation and logarithm tables, and is only compatible with primitive IrreducablePolynomials. For an implementation compatible with all IrreducablePolynomials, see GeneralField.

Note that this implementation may also use multiplication and division tables for its vectorized operations. See the Field documentation for more details.

Implementations§

Constructs a new PrimitivePolynomialField with all tables initialized.

If the given poly argument is not primitive, this function returns None; otherwise it returns Some(f: PrimitivePolynomialField). In situations where the use of Option<PrimitivePolynomialField> is less ideal than incurring a panic, consider new_might_panic.

Constructs a new PrimitivePolynomialField with all tables initialized.

If the given poly argument is not primitive, this function panics. The contents of the resulting error message are not defined. In situations where incurring a panic is less ideal than the use of Option<PrimitivePolynomialField>, consider new.

Trait Implementations§

Returns the polynomial modulo which all operations are performed.
Returns the result of src * scale in this field.
Returns the result of src / scale in this field. Read more
Returns the result of 2^x in this field.
Returns the result of scale * 2^x in this field.
Adds scale * src[0..len] into dst[0..len] in place.
Multiplies dst[0..len] by scale in place.
Divides dst[0..len] by scale in place. Read more
Adds left and right, returning their sum.
Subtracts right from left, returning the difference.
Adds src[0..len] into dst[0..len].
Adds src into dst in place, over the smallest common length. Read more
Adds src[0..len] into dst[0..len]. Read more
Adds src * scale into dst in place, over the smallest common length. Read more
Adds src[0..len] * scale into dst[0..len]. Read more
Subtracts src[0..len] from dst[0..len] in place.
Subracts scale * src[0..len] from dst[0..len] in place.
Subtracts src from dst in place, over the smallest common length. Read more
Subtracts src[0..len] from dst[0..len] in place. Read more
Subtracts scale * src from dst in place, over the smallest common length. Read more
Subtracts scale * src[0..len] from dst[0..len] in place. Read more
Multiplies dst by scale in place.
Divides dst by scale in place. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.