Assignment {boolfun}R Documentation

Input to a Boolean function

Description

Implements an element of {0,1}^n that can be used as input to a BooleanFunction or Polynomial instance.

Usage

    x <- Assignment( initializer )

Arguments

initializer a vector containing 2^n integers in {0,1} or a string holding 2^n characters in {'0','1'}.

Value

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).

Public Methods

int() returns the integer encoded by the element of {0,1}^n.
Note: "100" encodes the integer 1 instead of 4.
val() returns a vector of n integer holding the value of each variable.
len() returns the number of variables (n).
string() returns a string representation of the corresponding monomial. For example,
string(Assignment(c(1,0,1,0))) returns "x1*x3" and
string(Assignment(c(0,0,0)) returns "1".
weight() returns the Hamming weight, i.e. the number of variables that are set to 1.
equals() -
print() -

Author(s)

F.Lafitte

See Also

BooleanFunction, Polynomial, R.oo:Object

Examples

    x <- Assignment( c(0,1,0,1) )
    y <- Assignment( "010110" )
    print(x)  # returns "Assignment with 4 variables."
    string(x) # returns "x2*x4"
    int(x)    # returns 10 (i.e. 0001 encodes 8 instead of 1)

[Package boolfun version 0.2.6 Index]