<< gf_multiply Element arithmetic gf_subtract >>

Galois Fields >> Galois Fields > Element arithmetic > gf_power

gf_power

Raises elements of a finite field to an integer power

Syntax

c = gf_power(F, a, e)

Arguments

F

A field created by gf_create_field.

a

Field elements.

  • In GF(p) (n = 1): a matrix of integers in 0 .. p-1, of any size.

  • In GF(p^n), n > 1: a matrix with n columns, one element per row. Each row holds the coefficients of a polynomial in α of degree < n, constant term first.

Coefficients outside 0 .. p-1 are rejected; reduce them first with gf_mod if needed.

e

Exponent: a non-negative integer scalar.

c

a^e for each element of a, in the same form as a.

Description

gf_power(F, a, e) computes a^e in the field F for every element of a.

Examples

F = gf_create_field(2, 4);
alpha = [0 1 0 0];
gf_power(F, alpha, 4)      // [1 1 0 0]: alpha^4 = 1 + alpha
gf_power(F, alpha, 15)     // [1 0 0 0]: alpha^15 = 1
gf_to_exponential(F, gf_power(F, alpha, 100))   // 10, as 100 = 6*15 + 10

P = gf_create_field(7, 1);
gf_power(P, 1:6, 3)        // [1 1 6 1 6 6]

See also

History

VersionDescription
2.0.0

Refactoring of the function/toolbox. Accepts several elements at once. Fixed: a^(q-1) now gives 1 for non-zero a.


Report an issue
<< gf_multiply Element arithmetic gf_subtract >>