| 492 | |
| 493 | template<class View> |
| 494 | forceinline bool |
| 495 | channel(Space& home, ViewArray<View>& x, ViewArray<View>& y, |
| 496 | ViewArray<View>& z, bool& nofix) { |
| 497 | int n = x.size(); |
| 498 | for (int i=0; i<n; i++) { |
| 499 | if (z[i].assigned()) { |
| 500 | int v = z[i].val(); |
| 501 | if (x[i].assigned()) { |
| 502 | // channel equality from x to y |
| 503 | ModEvent me = y[v].eq(home, x[i].val()); |
| 504 | if (me_failed(me)) |
| 505 | return false; |
| 506 | nofix |= me_modified(me); |
| 507 | } else { |
| 508 | if (y[v].assigned()) { |
| 509 | // channel equality from y to x |
| 510 | ModEvent me = x[i].eq(home, y[v].val()); |
| 511 | if (me_failed(me)) |
| 512 | return false; |
| 513 | nofix |= me_modified(me); |
| 514 | } else { |
| 515 | // constrain upper bound |
| 516 | ModEvent me = x[i].lq(home, y[v].max()); |
| 517 | if (me_failed(me)) |
| 518 | return false; |
| 519 | nofix |= me_modified(me); |
| 520 | |
| 521 | // constrain lower bound |
| 522 | me = x[i].gq(home, y[v].min()); |
| 523 | if (me_failed(me)) |
| 524 | return false; |
| 525 | nofix |= me_modified(me); |
| 526 | |
| 527 | // constrain the sorted variable |
| 528 | // constrain upper bound |
| 529 | me = y[v].lq(home, x[i].max()); |
| 530 | if (me_failed(me)) |
| 531 | return false; |
| 532 | nofix |= me_modified(me); |
| 533 | |
| 534 | // constrain lower bound |
| 535 | me = y[v].gq(home, x[i].min()); |
| 536 | if (me_failed(me)) |
| 537 | return false; |
| 538 | nofix |= me_modified(me); |
| 539 | } |
| 540 | } |
| 541 | } else { |
| 542 | // if the permutation variable is undetermined |
| 543 | int l = z[i].min(); |
| 544 | int r = z[i].max(); |
| 545 | // upper bound |
| 546 | ModEvent me = x[i].lq(home, y[r].max()); |
| 547 | if (me_failed(me)) |
| 548 | return false; |
| 549 | nofix |= me_modified(me); |
| 550 | |
| 551 | // lower bound |