Main Content

# isprimitive

True for primitive polynomial for Galois field

## Syntax

``ispl = isprimitive(prpoly)``

## Description

````ispl = isprimitive(prpoly)` returns `1` if the polynomial that `prpoly` represents is primitive for the Galois field GF(2m). Otherwise, it returns `0`.```

example

## Examples

collapse all

Find all the primitive polynomials for GF(8).

`a = primpoly(3,'all','nodisplay') % All primitive polynomials for GF(8)`
```a = 2×1 11 13 ```

Use `isprimitive` to check if specific polynomials are primitive.

`isp1 = isprimitive(13) % 13 represents a primitive polynomial.`
```isp1 = logical 1 ```
`isp2 = isprimitive(14) % 14 represents a nonprimitive polynomial.`
```isp2 = logical 0 ```

Examining the vector `a`, you can see that `isp1` is true because 13 is an element in `a` and `isp2` is false because 14 is not an element in `a`.

## Input Arguments

collapse all

Primitive polynomial, specified as one of the following:

• A nonnegative integer less than 217. The binary representation of this integer indicates the coefficients of the polynomial. In this case, m is `floor(log2(prpoly))`.

• A Galois row vector in GF(2), listing the coefficients of the polynomial in order of descending powers. In this case, m is the order of the polynomial represented by `prpoly`.

Data Types: `double`

## Output Arguments

collapse all

True or false result, returned as logical 1 (true) or logical 0 (false) indicating if the input is primitive or not.

Data Types: `logical`

## Version History

Introduced before R2006a