Polynomial {boolfun} | R Documentation |
Implements an element of e, that is, a multivariate polynomial (in x1,...,xn where xi^2=xi holds for all i) with coefficients in GF(2), the field with two elements. Some basic functionality such as addition and multiplication are implemented.
x <- Polynomial( initializer )
initializer |
a vector containing 2^n integers in {0,1} or a string holding 2^n characters in {'0','1'}. |
Addition and multiplication are computed using C code. For more information, type vignette(polynomial)
.
The returned value f
is an S3 object which is defined using the R.oo package. Methods of the returned value, say weight()
, can be accessed in two ways using x$weight()
or weight(x)
.
n() | number of variables n | |
anf() | vector of 2^n coefficients | |
deg() | algebraic degree | |
*.Polynomial(p) | returns (this * p ) as new Polynomial |
|
+.Polynomial(p) | returns (this + p ) as new Polynomial |
|
[[.Polynomial(x) | evaluate the polynomial on assignment (vector) x |
|
string() | algebraic normal form as string | |
print() | displays the result of string() |
|
len() | returns 2^n |
F.Lafitte
BooleanFunction
, Assignment
, R.oo:Object
p <- Polynomial( c(0,1,0,1) ) q <- Polynomial( "01011011" ) r <- Polynomial( c(anf(p),anf(p),anf(q)) ) print(p) deg(p) p <- p*q + r print(p)