Contenuto principale

gftrunc

Minimize length of polynomial representation

Description

c = gftrunc(a) truncates a row vector, a, by removing nonsignificant high-order zeros at the end of a If a(k) = 0 whenever k>d+1, the polynomial has degree d. The row vector c omits these high-order zeros and thus has length d+1.

example

Examples

collapse all

Use gftrunc to truncate the row-vector representation of x2+2x3+3x4+4x7+5x8, removing nonsignificant zero-valued elements.

vec = [0 0 1 2 3 0 0 4 5 0 0]
vec = 1×11

     0     0     1     2     3     0     0     4     5     0     0

gfpretty([vec])
 
                         2      3      4      7      8
                        X  + 2 X  + 3 X  + 4 X  + 5 X 

Zeros are removed from the end of the row-vector representation, but not from the beginning or middle of the row vector.

c = gftrunc([0 0 1 2 3 0 0 4 5 0 0])
c = 1×9

     0     0     1     2     3     0     0     4     5

gfpretty(c)
 
                         2      3      4      7      8
                        X  + 2 X  + 3 X  + 4 X  + 5 X 

Input Arguments

collapse all

Coefficient of GF(p) polynomial, specified as a numeric row vector in ascending order.

Data Types: single | double

Output Arguments

collapse all

Truncated coefficients of GF(p) polynomial, returned as a numeric row vector with the trailing zeros removed. Zeros are removed only from the end of the row-vector, not from the beginning or middle.

Data Types: single | double

Version History

Introduced before R2006a