2.5 Cast

Up to this point, it is not explicitly explained in this package how data used in various ZDD operations and functions will be automatically converted (cast) to the corresponding data type.

For example, the operation of 2*a described in the previous section is derived by multiplying ZDD object variable a with Ruby integer 2.

The multiplication operator of ZDD * obtains two ZDD object as arguments, if it is not a ZDD object as shown in the example, the contents are automatically converted to ZDD object for calculation.

Internally, 2*a operates as ZDD::constant(2)*a. Here, constatnt function defines the weight of empty itemset.

In the following examples, the Ruby character string "a b" is automatically converted to ZDD object. Internally, it is operated as (a+ZDD::itemset("a b")).show.

> (a+"a b").show
 a b + a

In the following, the character string of the two operands is combined to become a Ruby String object .

> s="a b"+"c d"
> p s
"a bc d"