| 404 | |
| 405 | |
| 406 | short term_ordering::compare_to_zero(const Integer* v) const |
| 407 | { |
| 408 | unsigned short last_index=weighted_block_size+elimination_block_size; |
| 409 | double w=0; |
| 410 | |
| 411 | // First check the elimination variables. |
| 412 | |
| 413 | if(elimination_block_size>0) |
| 414 | switch(elimination_ordering) |
| 415 | { |
| 416 | case LEX: |
| 417 | |
| 418 | for(short i=weighted_block_size;i<last_index;i++) |
| 419 | { |
| 420 | Integer actual_component=v[i]; |
| 421 | if(actual_component>0) |
| 422 | return 1; |
| 423 | if(actual_component<0) |
| 424 | return -1; |
| 425 | } |
| 426 | |
| 427 | break; |
| 428 | |
| 429 | case DEG_LEX: |
| 430 | |
| 431 | // compute the degree |
| 432 | for(short i=weighted_block_size;i<last_index;i++) |
| 433 | w+=v[i]; |
| 434 | |
| 435 | if(w>0) |
| 436 | return 1; |
| 437 | if(w<0) |
| 438 | return -1; |
| 439 | |
| 440 | // if the degree is zero: |
| 441 | // tie breaking with the lexicographical ordering |
| 442 | for(short i=weighted_block_size;i<last_index;i++) |
| 443 | { |
| 444 | Integer actual_component=v[i]; |
| 445 | if(actual_component>0) |
| 446 | return 1; |
| 447 | if(actual_component<0) |
| 448 | return -1; |
| 449 | } |
| 450 | |
| 451 | break; |
| 452 | |
| 453 | case DEG_REV_LEX: |
| 454 | |
| 455 | //compute the degree |
| 456 | for(short i=weighted_block_size;i<last_index;i++) |
| 457 | w+=v[i]; |
| 458 | |
| 459 | if(w>0) |
| 460 | return 1; |
| 461 | if(w<0) |
| 462 | return -1; |
| 463 | // if the degree is zero: |
no outgoing calls
no test coverage detected