GF expression can be calculated using gfexpr Tcl command. It accepts the following types of data:
The expression string can contain nested Tcl commands or Tcl variables.
The following table displays the list of supported operators.
operator | type | description |
---|---|---|
unary operators | ||
- | -value | negate GF value, (-x) |
-matrix | negate each element of the matrix | |
~ | ~value | get inverse GF value, x-1 |
~matrix | invert matrix | |
binary operators | ||
+ | value+value | add in GF, x + y |
value+poly | treat GF element as a polynomial and add the polynomials | |
poly+value | ||
poly+poly | add polynomials | |
matrix+matrix | add matrices | |
+ | value-value | subtract in GF, x - y |
value-poly | treat GF element as a polynomial and subtract the polynomials | |
poly-value | ||
poly-poly | subtract polynomials | |
matrix-matrix | subtract matrices | |
* | value*value | multiply in GF, x·y |
value*poly | treat GF element as a polynomial and multiply the polynomials | |
poly*value | ||
poly*poly | multiply polynomials | |
value*matrix | multiply matrix by value | |
matrix*value | ||
matrix*matrix | multiply matrices | |
/ | value/value | divide GF values, x·y-1 |
value/poly | treat GF element as a polynomial and divide the polynomials | |
poly/value | ||
poly/poly | divide polynomials | |
% | value/value | always 0 |
value%poly | treat GF element as a polynomial and and find the remainder of division | |
poly%value | ||
poly%poly | find remainder of the polynomial division | |
** | matrix**matrix | Kronecker product of two matrices |
^ | value^integer | exponentiate GF value, xn |
poly^integer | exponentiate polynomial | |
( ) | change operator precdence |