Browse Source
added some new functions to sylvan. isolated new code to make it easier to update sylvan to newer versions later
added some new functions to sylvan. isolated new code to make it easier to update sylvan to newer versions later
Former-commit-id: 6b489993a5
tempestpy_adaptions
dehnert
9 years ago
8 changed files with 643 additions and 380 deletions
-
302resources/3rdparty/sylvan/src/sylvan_mtbdd.c
-
65resources/3rdparty/sylvan/src/sylvan_mtbdd.h
-
43resources/3rdparty/sylvan/src/sylvan_obj.cpp
-
14resources/3rdparty/sylvan/src/sylvan_obj.hpp
-
464resources/3rdparty/sylvan/src/sylvan_storm_custom.c
-
95resources/3rdparty/sylvan/src/sylvan_storm_custom.h
-
20src/storage/dd/sylvan/InternalSylvanAdd.cpp
-
20test/functional/storage/SylvanDdTest.cpp
@ -0,0 +1,464 @@ |
|||
/** |
|||
* Binary operation Times (for MTBDDs of same type) |
|||
* Only for MTBDDs where either all leaves are Integer or Double. |
|||
* If either operand is mtbdd_false (not defined), |
|||
* then the result is mtbdd_false (i.e. not defined). |
|||
*/ |
|||
TASK_IMPL_2(MTBDD, mtbdd_op_divide, MTBDD*, pa, MTBDD*, pb) |
|||
{ |
|||
MTBDD a = *pa, b = *pb; |
|||
if (a == mtbdd_false || b == mtbdd_false) return mtbdd_false; |
|||
|
|||
// Do not handle Boolean MTBDDs... |
|||
|
|||
mtbddnode_t na = GETNODE(a); |
|||
mtbddnode_t nb = GETNODE(b); |
|||
|
|||
if (mtbddnode_isleaf(na) && mtbddnode_isleaf(nb)) { |
|||
uint64_t val_a = mtbddnode_getvalue(na); |
|||
uint64_t val_b = mtbddnode_getvalue(nb); |
|||
if (mtbddnode_gettype(na) == 0 && mtbddnode_gettype(nb) == 0) { |
|||
// both uint64_t |
|||
if (val_a == 0) return a; |
|||
else if (val_b == 0) return b; |
|||
else { |
|||
MTBDD result; |
|||
if (val_a == 1) result = b; |
|||
else if (val_b == 1) result = a; |
|||
else result = mtbdd_uint64(val_a*val_b); |
|||
int nega = mtbdd_isnegated(a); |
|||
int negb = mtbdd_isnegated(b); |
|||
if (nega ^ negb) return mtbdd_negate(result); |
|||
else return result; |
|||
} |
|||
} else if (mtbddnode_gettype(na) == 1 && mtbddnode_gettype(nb) == 1) { |
|||
// both double |
|||
double vval_a = *(double*)&val_a; |
|||
double vval_b = *(double*)&val_b; |
|||
if (vval_a == 0.0) return a; |
|||
else if (vval_b == 0.0) return b; |
|||
else { |
|||
MTBDD result; |
|||
if (vval_a == 0.0 || vval_b == 1.0) result = a; |
|||
|
|||
int nega = mtbdd_isnegated(a); |
|||
int negb = mtbdd_isnegated(b); |
|||
result = mtbdd_double(a / b); |
|||
if (nega ^ negb) return mtbdd_negate(result); |
|||
else return result; |
|||
} |
|||
} |
|||
else if (mtbddnode_gettype(na) == 2 && mtbddnode_gettype(nb) == 2) { |
|||
// both fraction |
|||
uint64_t nom_a = val_a>>32; |
|||
uint64_t nom_b = val_b>>32; |
|||
uint64_t denom_a = val_a&0xffffffff; |
|||
uint64_t denom_b = val_b&0xffffffff; |
|||
// multiply! |
|||
uint32_t c = gcd(denom_b, denom_a); |
|||
uint32_t d = gcd(nom_a, nom_b); |
|||
nom_a /= d; |
|||
denom_a /= c; |
|||
nom_a *= (denom_b/c); |
|||
denom_a *= (nom_b/d); |
|||
// compute result |
|||
int nega = mtbdd_isnegated(a); |
|||
int negb = mtbdd_isnegated(b); |
|||
MTBDD result = mtbdd_fraction(nom_a, denom_a); |
|||
if (nega ^ negb) return mtbdd_negate(result); |
|||
else return result; |
|||
} |
|||
} |
|||
|
|||
return mtbdd_invalid; |
|||
} |
|||
|
|||
/** |
|||
* Binary operation Equals (for MTBDDs of same type) |
|||
* Only for MTBDDs where either all leaves are Boolean, or Integer, or Double. |
|||
* For Integer/Double MTBDD, if either operand is mtbdd_false (not defined), |
|||
* then the result is mtbdd_false (i.e. not defined). |
|||
*/ |
|||
TASK_IMPL_2(MTBDD, mtbdd_op_equals, MTBDD*, pa, MTBDD*, pb) |
|||
{ |
|||
MTBDD a = *pa, b = *pb; |
|||
if (a == mtbdd_false && b == mtbdd_false) return mtbdd_true; |
|||
if (a == mtbdd_true && b == mtbdd_true) return mtbdd_true; |
|||
|
|||
mtbddnode_t na = GETNODE(a); |
|||
mtbddnode_t nb = GETNODE(b); |
|||
|
|||
if (mtbddnode_isleaf(na) && mtbddnode_isleaf(nb)) { |
|||
uint64_t val_a = mtbddnode_getvalue(na); |
|||
uint64_t val_b = mtbddnode_getvalue(nb); |
|||
if (mtbddnode_gettype(na) == 0 && mtbddnode_gettype(nb) == 0) { |
|||
// both uint64_t |
|||
int nega = mtbdd_isnegated(a); |
|||
int negb = mtbdd_isnegated(b); |
|||
if (val_a == val_b && !(nega ^ negb)) return mtbdd_true; |
|||
return mtbdd_false; |
|||
} else if (mtbddnode_gettype(na) == 1 && mtbddnode_gettype(nb) == 1) { |
|||
// both double |
|||
double vval_a = *(double*)&val_a; |
|||
double vval_b = *(double*)&val_b; |
|||
int nega = mtbdd_isnegated(a); |
|||
int negb = mtbdd_isnegated(b); |
|||
if (vval_a == vval_b && !(nega ^ negb)) return mtbdd_true; |
|||
return mtbdd_false; |
|||
} else if (mtbddnode_gettype(na) == 2 && mtbddnode_gettype(nb) == 2) { |
|||
// both fraction |
|||
uint64_t nom_a = val_a>>32; |
|||
uint64_t nom_b = val_b>>32; |
|||
uint64_t denom_a = val_a&0xffffffff; |
|||
uint64_t denom_b = val_b&0xffffffff; |
|||
int nega = mtbdd_isnegated(a); |
|||
int negb = mtbdd_isnegated(b); |
|||
if (nom_a == nom_b && denom_a == denom_b && !(nega ^ negb)) return mtbdd_true; |
|||
return mtbdd_false; |
|||
} |
|||
} |
|||
|
|||
if (a < b) { |
|||
*pa = b; |
|||
*pb = a; |
|||
} |
|||
|
|||
return mtbdd_invalid; |
|||
} |
|||
|
|||
/** |
|||
* Binary operation Equals (for MTBDDs of same type) |
|||
* Only for MTBDDs where either all leaves are Boolean, or Integer, or Double. |
|||
* For Integer/Double MTBDD, if either operand is mtbdd_false (not defined), |
|||
* then the result is mtbdd_false (i.e. not defined). |
|||
*/ |
|||
TASK_IMPL_2(MTBDD, mtbdd_op_less, MTBDD*, pa, MTBDD*, pb) |
|||
{ |
|||
MTBDD a = *pa, b = *pb; |
|||
if (a == mtbdd_false && b == mtbdd_false) return mtbdd_true; |
|||
if (a == mtbdd_true && b == mtbdd_true) return mtbdd_true; |
|||
|
|||
mtbddnode_t na = GETNODE(a); |
|||
mtbddnode_t nb = GETNODE(b); |
|||
|
|||
if (mtbddnode_isleaf(na) && mtbddnode_isleaf(nb)) { |
|||
uint64_t val_a = mtbddnode_getvalue(na); |
|||
uint64_t val_b = mtbddnode_getvalue(nb); |
|||
if (mtbddnode_gettype(na) == 0 && mtbddnode_gettype(nb) == 0) { |
|||
// both uint64_t |
|||
int nega = mtbdd_isnegated(a); |
|||
int negb = mtbdd_isnegated(b); |
|||
if (nega && !negb) return mtbdd_true; |
|||
if (!nega && negb) return mtbdd_false; |
|||
if (nega && negb && val_a < val_b) return mtbdd_false; |
|||
return mtbdd_true; |
|||
} else if (mtbddnode_gettype(na) == 1 && mtbddnode_gettype(nb) == 1) { |
|||
// both double |
|||
double vval_a = *(double*)&val_a; |
|||
double vval_b = *(double*)&val_b; |
|||
int nega = mtbdd_isnegated(a); |
|||
if (nega) vval_a = -vval_a; |
|||
int negb = mtbdd_isnegated(b); |
|||
if (negb) vval_b = -vval_b; |
|||
if (vval_a < vval_b) return mtbdd_true; |
|||
return mtbdd_false; |
|||
} else if (mtbddnode_gettype(na) == 2 && mtbddnode_gettype(nb) == 2) { |
|||
// both fraction |
|||
uint64_t nom_a = val_a>>32; |
|||
uint64_t nom_b = val_b>>32; |
|||
uint64_t denom_a = val_a&0xffffffff; |
|||
uint64_t denom_b = val_b&0xffffffff; |
|||
int nega = mtbdd_isnegated(a); |
|||
int negb = mtbdd_isnegated(b); |
|||
if (nega && !negb) return mtbdd_true; |
|||
if (!nega && negb) return mtbdd_false; |
|||
return nom_a * denom_b < nom_b * denom_a ? mtbdd_true : mtbdd_false; |
|||
} |
|||
} |
|||
|
|||
return mtbdd_invalid; |
|||
} |
|||
|
|||
/** |
|||
* Binary operation Equals (for MTBDDs of same type) |
|||
* Only for MTBDDs where either all leaves are Boolean, or Integer, or Double. |
|||
* For Integer/Double MTBDD, if either operand is mtbdd_false (not defined), |
|||
* then the result is mtbdd_false (i.e. not defined). |
|||
*/ |
|||
TASK_IMPL_2(MTBDD, mtbdd_op_less_or_equal, MTBDD*, pa, MTBDD*, pb) |
|||
{ |
|||
MTBDD a = *pa, b = *pb; |
|||
if (a == mtbdd_false && b == mtbdd_false) return mtbdd_true; |
|||
if (a == mtbdd_true && b == mtbdd_true) return mtbdd_true; |
|||
|
|||
mtbddnode_t na = GETNODE(a); |
|||
mtbddnode_t nb = GETNODE(b); |
|||
|
|||
if (mtbddnode_isleaf(na) && mtbddnode_isleaf(nb)) { |
|||
uint64_t val_a = mtbddnode_getvalue(na); |
|||
uint64_t val_b = mtbddnode_getvalue(nb); |
|||
if (mtbddnode_gettype(na) == 0 && mtbddnode_gettype(nb) == 0) { |
|||
// both uint64_t |
|||
int nega = mtbdd_isnegated(a); |
|||
int negb = mtbdd_isnegated(b); |
|||
if (nega && !negb) { |
|||
if (val_a != 0) return mtbdd_true; |
|||
if (val_b != 0) return mtbdd_true; |
|||
return mtbdd_false; |
|||
} |
|||
if (!nega && negb) { |
|||
if (val_b != 0) return mtbdd_false; |
|||
if (val_a != 0) return mtbdd_false; |
|||
return mtbdd_true; |
|||
} |
|||
if (nega && negb) { |
|||
return val_a >= val_b ? mtbdd_true : mtbdd_false; |
|||
} |
|||
return val_a <= val_b ? mtbdd_true : mtbdd_false; |
|||
} else if (mtbddnode_gettype(na) == 1 && mtbddnode_gettype(nb) == 1) { |
|||
// both double |
|||
double vval_a = *(double*)&val_a; |
|||
double vval_b = *(double*)&val_b; |
|||
int nega = mtbdd_isnegated(a); |
|||
if (nega) vval_a = -vval_a; |
|||
int negb = mtbdd_isnegated(b); |
|||
if (negb) vval_b = -vval_b; |
|||
if (vval_a <= vval_b) return mtbdd_true; |
|||
return mtbdd_false; |
|||
} else if (mtbddnode_gettype(na) == 2 && mtbddnode_gettype(nb) == 2) { |
|||
// both fraction |
|||
uint64_t nom_a = val_a>>32; |
|||
uint64_t nom_b = val_b>>32; |
|||
uint64_t denom_a = val_a&0xffffffff; |
|||
uint64_t denom_b = val_b&0xffffffff; |
|||
int nega = mtbdd_isnegated(a); |
|||
int negb = mtbdd_isnegated(b); |
|||
nom_a *= denom_b; |
|||
nom_b *= denom_a; |
|||
if (nega && !negb) { |
|||
if (nom_a != 0) return mtbdd_true; |
|||
if (nom_b != 0) return mtbdd_true; |
|||
return mtbdd_false; |
|||
} |
|||
if (!nega && negb) { |
|||
if (nom_a != 0) return mtbdd_false; |
|||
if (nom_b != 0) return mtbdd_false; |
|||
return mtbdd_true; |
|||
} |
|||
if (nega && negb) { |
|||
return nom_a >= nom_b ? mtbdd_true : mtbdd_false; |
|||
} |
|||
return val_a <= val_b ? mtbdd_true : mtbdd_false; |
|||
} |
|||
} |
|||
|
|||
return mtbdd_invalid; |
|||
} |
|||
|
|||
/** |
|||
* Binary operation Pow (for MTBDDs of same type) |
|||
* Only for MTBDDs where either all leaves are Double. |
|||
* For Integer/Double MTBDD, if either operand is mtbdd_false (not defined), |
|||
* then the result is mtbdd_false (i.e. not defined). |
|||
*/ |
|||
TASK_IMPL_2(MTBDD, mtbdd_op_pow, MTBDD*, pa, MTBDD*, pb) |
|||
{ |
|||
MTBDD a = *pa, b = *pb; |
|||
|
|||
mtbddnode_t na = GETNODE(a); |
|||
mtbddnode_t nb = GETNODE(b); |
|||
|
|||
if (mtbddnode_isleaf(na) && mtbddnode_isleaf(nb)) { |
|||
uint64_t val_a = mtbddnode_getvalue(na); |
|||
uint64_t val_b = mtbddnode_getvalue(nb); |
|||
if (mtbddnode_gettype(na) == 0 && mtbddnode_gettype(nb) == 0) { |
|||
assert(0); |
|||
} else if (mtbddnode_gettype(na) == 1 && mtbddnode_gettype(nb) == 1) { |
|||
// both double |
|||
double vval_a = *(double*)&val_a; |
|||
double vval_b = *(double*)&val_b; |
|||
int nega = mtbdd_isnegated(a); |
|||
if (nega) vval_a = -vval_a; |
|||
int negb = mtbdd_isnegated(b); |
|||
if (negb) vval_b = -vval_b; |
|||
return mtbdd_double(pow(vval_a, vval_b)); |
|||
} else if (mtbddnode_gettype(na) == 2 && mtbddnode_gettype(nb) == 2) { |
|||
assert(0); |
|||
} |
|||
} |
|||
|
|||
return mtbdd_invalid; |
|||
} |
|||
|
|||
/** |
|||
* Binary operation Mod (for MTBDDs of same type) |
|||
* Only for MTBDDs where either all leaves are Double. |
|||
* For Integer/Double MTBDD, if either operand is mtbdd_false (not defined), |
|||
* then the result is mtbdd_false (i.e. not defined). |
|||
*/ |
|||
TASK_IMPL_2(MTBDD, mtbdd_op_mod, MTBDD*, pa, MTBDD*, pb) |
|||
{ |
|||
MTBDD a = *pa, b = *pb; |
|||
|
|||
mtbddnode_t na = GETNODE(a); |
|||
mtbddnode_t nb = GETNODE(b); |
|||
|
|||
if (mtbddnode_isleaf(na) && mtbddnode_isleaf(nb)) { |
|||
uint64_t val_a = mtbddnode_getvalue(na); |
|||
uint64_t val_b = mtbddnode_getvalue(nb); |
|||
if (mtbddnode_gettype(na) == 0 && mtbddnode_gettype(nb) == 0) { |
|||
assert(0); |
|||
} else if (mtbddnode_gettype(na) == 1 && mtbddnode_gettype(nb) == 1) { |
|||
// both double |
|||
double vval_a = *(double*)&val_a; |
|||
double vval_b = *(double*)&val_b; |
|||
int nega = mtbdd_isnegated(a); |
|||
if (nega) vval_a = -vval_a; |
|||
int negb = mtbdd_isnegated(b); |
|||
if (negb) vval_b = -vval_b; |
|||
return mtbdd_double(fmod(vval_a, vval_b)); |
|||
} else if (mtbddnode_gettype(na) == 2 && mtbddnode_gettype(nb) == 2) { |
|||
assert(0); |
|||
} |
|||
} |
|||
|
|||
return mtbdd_invalid; |
|||
} |
|||
|
|||
/** |
|||
* Binary operation Log (for MTBDDs of same type) |
|||
* Only for MTBDDs where either all leaves are Double. |
|||
* For Integer/Double MTBDD, if either operand is mtbdd_false (not defined), |
|||
* then the result is mtbdd_false (i.e. not defined). |
|||
*/ |
|||
TASK_IMPL_2(MTBDD, mtbdd_op_logxy, MTBDD*, pa, MTBDD*, pb) |
|||
{ |
|||
MTBDD a = *pa, b = *pb; |
|||
|
|||
mtbddnode_t na = GETNODE(a); |
|||
mtbddnode_t nb = GETNODE(b); |
|||
|
|||
if (mtbddnode_isleaf(na) && mtbddnode_isleaf(nb)) { |
|||
uint64_t val_a = mtbddnode_getvalue(na); |
|||
uint64_t val_b = mtbddnode_getvalue(nb); |
|||
if (mtbddnode_gettype(na) == 0 && mtbddnode_gettype(nb) == 0) { |
|||
assert(0); |
|||
} else if (mtbddnode_gettype(na) == 1 && mtbddnode_gettype(nb) == 1) { |
|||
// both double |
|||
double vval_a = *(double*)&val_a; |
|||
double vval_b = *(double*)&val_b; |
|||
int nega = mtbdd_isnegated(a); |
|||
if (nega) vval_a = -vval_a; |
|||
int negb = mtbdd_isnegated(b); |
|||
if (negb) vval_b = -vval_b; |
|||
return mtbdd_double(log(vval_a) / log(vval_b)); |
|||
} else if (mtbddnode_gettype(na) == 2 && mtbddnode_gettype(nb) == 2) { |
|||
assert(0); |
|||
} |
|||
} |
|||
|
|||
return mtbdd_invalid; |
|||
} |
|||
|
|||
TASK_IMPL_2(MTBDD, mtbdd_op_not_zero, MTBDD, a, size_t, v) |
|||
{ |
|||
/* We only expect "double" terminals, or false */ |
|||
if (a == mtbdd_false) return mtbdd_false; |
|||
if (a == mtbdd_true) return mtbdd_true; |
|||
|
|||
// a != constant |
|||
mtbddnode_t na = GETNODE(a); |
|||
|
|||
if (mtbddnode_isleaf(na)) { |
|||
if (mtbddnode_gettype(na) == 0) { |
|||
return mtbdd_getuint64(a) != 0 ? mtbdd_true : mtbdd_false; |
|||
} else if (mtbddnode_gettype(na) == 1) { |
|||
return mtbdd_getdouble(a) != 0.0 ? mtbdd_true : mtbdd_false; |
|||
} else if (mtbddnode_gettype(na) == 2) { |
|||
return mtbdd_getnumer(a) != 0 ? mtbdd_true : mtbdd_false; |
|||
} |
|||
} |
|||
|
|||
// Ugly hack to get rid of the error "unused variable v" (because there is no version of uapply without a parameter). |
|||
return v > 0 ? mtbdd_invalid : mtbdd_invalid; |
|||
} |
|||
|
|||
TASK_IMPL_1(MTBDD, mtbdd_not_zero, MTBDD, dd) |
|||
{ |
|||
return mtbdd_uapply(dd, TASK(mtbdd_op_not_zero), 0); |
|||
} |
|||
|
|||
TASK_IMPL_2(MTBDD, mtbdd_op_floor, MTBDD, a, size_t, v) |
|||
{ |
|||
/* We only expect "double" terminals, or false */ |
|||
if (a == mtbdd_false) return mtbdd_false; |
|||
if (a == mtbdd_true) return mtbdd_true; |
|||
|
|||
// a != constant |
|||
mtbddnode_t na = GETNODE(a); |
|||
|
|||
if (mtbddnode_isleaf(na)) { |
|||
if (mtbddnode_gettype(na) == 0) { |
|||
return a; |
|||
} else if (mtbddnode_gettype(na) == 1) { |
|||
MTBDD result = mtbdd_double(floor(mtbdd_getdouble(a))); |
|||
return mtbdd_isnegated(a) ? mtbdd_negate(result) : result; |
|||
} else if (mtbddnode_gettype(na) == 2) { |
|||
MTBDD result = mtbdd_fraction(mtbdd_getnumer(a) / mtbdd_getdenom(a), 1); |
|||
return mtbdd_isnegated(a) ? mtbdd_negate(result) : result; |
|||
} |
|||
} |
|||
|
|||
// Ugly hack to get rid of the error "unused variable v" (because there is no version of uapply without a parameter). |
|||
return v > 0 ? mtbdd_invalid : mtbdd_invalid; |
|||
} |
|||
|
|||
TASK_IMPL_1(MTBDD, mtbdd_floor, MTBDD, dd) |
|||
{ |
|||
return mtbdd_uapply(dd, TASK(mtbdd_op_floor), 0); |
|||
} |
|||
|
|||
TASK_IMPL_2(MTBDD, mtbdd_op_ceil, MTBDD, a, size_t, v) |
|||
{ |
|||
/* We only expect "double" terminals, or false */ |
|||
if (a == mtbdd_false) return mtbdd_false; |
|||
if (a == mtbdd_true) return mtbdd_true; |
|||
|
|||
// a != constant |
|||
mtbddnode_t na = GETNODE(a); |
|||
|
|||
if (mtbddnode_isleaf(na)) { |
|||
if (mtbddnode_gettype(na) == 0) { |
|||
return a; |
|||
} else if (mtbddnode_gettype(na) == 1) { |
|||
MTBDD result = mtbdd_double(ceil(mtbdd_getdouble(a))); |
|||
return mtbdd_isnegated(a) ? mtbdd_negate(result) : result; |
|||
} else if (mtbddnode_gettype(na) == 2) { |
|||
MTBDD result = mtbdd_fraction(mtbdd_getnumer(a) / mtbdd_getdenom(a) + 1, 1); |
|||
return mtbdd_isnegated(a) ? mtbdd_negate(result) : result; |
|||
} |
|||
} |
|||
|
|||
// Ugly hack to get rid of the error "unused variable v" (because there is no version of uapply without a parameter). |
|||
return v > 0 ? mtbdd_invalid : mtbdd_invalid; |
|||
} |
|||
|
|||
TASK_IMPL_1(MTBDD, mtbdd_ceil, MTBDD, dd) |
|||
{ |
|||
return mtbdd_uapply(dd, TASK(mtbdd_op_ceil), 0); |
|||
} |
|||
|
|||
TASK_IMPL_2(MTBDD, mtbdd_op_bool_to_double, MTBDD, a, size_t, v) |
|||
{ |
|||
/* We only expect "double" terminals, or false */ |
|||
if (a == mtbdd_false) return mtbdd_double(0); |
|||
if (a == mtbdd_true) return mtbdd_double(1.0); |
|||
|
|||
// Ugly hack to get rid of the error "unused variable v" (because there is no version of uapply without a parameter). |
|||
return v > 0 ? mtbdd_invalid : mtbdd_invalid; |
|||
} |
|||
|
|||
TASK_IMPL_1(MTBDD, mtbdd_bool_to_double, MTBDD, dd) |
|||
{ |
|||
return mtbdd_uapply(dd, TASK(mtbdd_op_bool_to_double), 0); |
|||
} |
@ -0,0 +1,95 @@ |
|||
/** |
|||
* Compute a - b |
|||
*/ |
|||
#define mtbdd_minus(a, b) mtbdd_plus(a, mtbdd_negate(b)) |
|||
|
|||
/** |
|||
* Binary operation Divide (for MTBDDs of same type) |
|||
* Only for MTBDDs where all leaves are Integer or Double. |
|||
* If either operand is mtbdd_false (not defined), |
|||
* then the result is mtbdd_false (i.e. not defined). |
|||
*/ |
|||
TASK_DECL_2(MTBDD, mtbdd_op_divide, MTBDD*, MTBDD*); |
|||
#define mtbdd_divide(a, b) mtbdd_apply(a, b, TASK(mtbdd_op_divide)) |
|||
|
|||
/** |
|||
* Binary operation equals (for MTBDDs of same type) |
|||
* Only for MTBDDs where either all leaves are Boolean, or Integer, or Double. |
|||
* For Integer/Double MTBDD, if either operand is mtbdd_false (not defined), |
|||
* then the result is the other operand. |
|||
*/ |
|||
TASK_DECL_2(MTBDD, mtbdd_op_equals, MTBDD*, MTBDD*); |
|||
#define mtbdd_equals(a, b) mtbdd_apply(a, b, TASK(mtbdd_op_equals)) |
|||
|
|||
/** |
|||
* Binary operation Less (for MTBDDs of same type) |
|||
* Only for MTBDDs where either all leaves are Boolean, or Integer, or Double. |
|||
* For Integer/Double MTBDD, if either operand is mtbdd_false (not defined), |
|||
* then the result is the other operand. |
|||
*/ |
|||
TASK_DECL_2(MTBDD, mtbdd_op_less, MTBDD*, MTBDD*); |
|||
#define mtbdd_less_as_bdd(a, b) mtbdd_apply(a, b, TASK(mtbdd_op_less)) |
|||
|
|||
/** |
|||
* Binary operation Less (for MTBDDs of same type) |
|||
* Only for MTBDDs where either all leaves are Boolean, or Integer, or Double. |
|||
* For Integer/Double MTBDD, if either operand is mtbdd_false (not defined), |
|||
* then the result is the other operand. |
|||
*/ |
|||
TASK_DECL_2(MTBDD, mtbdd_op_less_or_equal, MTBDD*, MTBDD*); |
|||
#define mtbdd_less_or_equal_as_bdd(a, b) mtbdd_apply(a, b, TASK(mtbdd_op_less_or_equal)) |
|||
|
|||
/** |
|||
* Binary operation Pow (for MTBDDs of same type) |
|||
* Only for MTBDDs where either all leaves are Integer, Double or a Fraction. |
|||
* For Integer/Double MTBDD, if either operand is mtbdd_false (not defined), |
|||
* then the result is the other operand. |
|||
*/ |
|||
TASK_DECL_2(MTBDD, mtbdd_op_pow, MTBDD*, MTBDD*); |
|||
#define mtbdd_pow(a, b) mtbdd_apply(a, b, TASK(mtbdd_op_pow)) |
|||
|
|||
/** |
|||
* Binary operation Mod (for MTBDDs of same type) |
|||
* Only for MTBDDs where either all leaves are Integer, Double or a Fraction. |
|||
* For Integer/Double MTBDD, if either operand is mtbdd_false (not defined), |
|||
* then the result is the other operand. |
|||
*/ |
|||
TASK_DECL_2(MTBDD, mtbdd_op_mod, MTBDD*, MTBDD*); |
|||
#define mtbdd_mod(a, b) mtbdd_apply(a, b, TASK(mtbdd_op_mod)) |
|||
|
|||
/** |
|||
* Binary operation Log (for MTBDDs of same type) |
|||
* Only for MTBDDs where either all leaves are Double or a Fraction. |
|||
* For Integer/Double MTBDD, if either operand is mtbdd_false (not defined), |
|||
* then the result is the other operand. |
|||
*/ |
|||
TASK_DECL_2(MTBDD, mtbdd_op_logxy, MTBDD*, MTBDD*); |
|||
#define mtbdd_logxy(a, b) mtbdd_apply(a, b, TASK(mtbdd_op_logxy)) |
|||
|
|||
/** |
|||
* Monad that converts double to a Boolean MTBDD, translate terminals != 0 to 1 and to 0 otherwise; |
|||
*/ |
|||
TASK_DECL_2(MTBDD, mtbdd_op_not_zero, MTBDD, size_t) |
|||
TASK_DECL_1(MTBDD, mtbdd_not_zero, MTBDD) |
|||
#define mtbdd_not_zero(dd) CALL(mtbdd_not_zero, dd) |
|||
|
|||
/** |
|||
* Monad that floors all values Double and Fraction values. |
|||
*/ |
|||
TASK_DECL_2(MTBDD, mtbdd_op_floor, MTBDD, size_t) |
|||
TASK_DECL_1(MTBDD, mtbdd_floor, MTBDD) |
|||
#define mtbdd_floor(dd) CALL(mtbdd_floor, dd) |
|||
|
|||
/** |
|||
* Monad that ceils all values Double and Fraction values. |
|||
*/ |
|||
TASK_DECL_2(MTBDD, mtbdd_op_ceil, MTBDD, size_t) |
|||
TASK_DECL_1(MTBDD, mtbdd_ceil, MTBDD) |
|||
#define mtbdd_ceil(dd) CALL(mtbdd_ceil, dd) |
|||
|
|||
/** |
|||
* Monad that converts Boolean to a Double MTBDD, translate terminals true to 1 and to 0 otherwise; |
|||
*/ |
|||
TASK_DECL_2(MTBDD, mtbdd_op_bool_to_double, MTBDD, size_t) |
|||
TASK_DECL_1(MTBDD, mtbdd_bool_to_double, MTBDD) |
|||
#define mtbdd_bool_to_double(dd) CALL(mtbdd_bool_to_double, dd) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue