<< gf_characteristic Fields gf_create_field >>

Galois Fields >> Galois Fields > Fields > gf_check_field

gf_check_field

Checks that a variable is a field created by gf_create_field

Syntax

gf_check_field(F, caller)

Arguments

F

Any Scilab variable.

caller

Name of the calling function, used at the start of the error message.

Description

gf_check_field returns silently when F is a valid field (a list of 4 items with a prime characteristic, a supported degree and a primitive polynomial of the right size), and raises an error attributed to caller otherwise.

It is used by the toolbox's own functions and is useful when writing new functions that take a field as an argument.

Examples

function y=my_field_size(F)
    gf_check_field(F, "my_field_size");
    y = gf_order(F);
endfunction

my_field_size(gf_create_field(5, 2))   // 25

try
    my_field_size(list(1, 2))
catch
    disp(lasterror())   // my_field_size: Wrong type for input argument #1: ...
end

See also

History

VersionDescription
2.0.0

Function added.


Report an issue
<< gf_characteristic Fields gf_create_field >>