Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

log

Logarithm in Galois field

Syntax

y = log(x)

Description

y = log(x) computes the logarithm of each element in the Galois array x. y is an integer array that solves the equation A.^y = x, where A is the primitive element used to represent elements in x. More explicitly, the base A of the logarithm is gf(2,x.m) or gf(2,x.m,x.prim_poly). All elements in x must be nonzero because the logarithm of zero is undefined.

Examples

The code below illustrates how the logarithm operation inverts exponentiation.

m = 4; x = gf([8 1 6; 3 5 7; 4 9 2],m);
y = log(x);
primel = gf(2,m); % Primitive element in the field
z = primel .^ y; % This is now the same as x.
ck = isequal(x,z)

The output is

ck =

     1

The code below shows that the logarithm of 1 is 0 and that the logarithm of the base (primel) is 1.

m = 4; primel = gf(2,m);
yy = log([1, primel])

The output is

yy =

     0     1

Introduced before R2006a

Was this topic helpful?