| 668 | } |
| 669 | |
| 670 | void pointSet::lift( int l[] ) |
| 671 | { |
| 672 | bool outerL= true; |
| 673 | int i, j; |
| 674 | int sum; |
| 675 | |
| 676 | dim++; |
| 677 | |
| 678 | if ( l==NULL ) |
| 679 | { |
| 680 | outerL= false; |
| 681 | l= (int *)omAlloc( (dim+1) * sizeof(int) ); // [1..dim-1] |
| 682 | |
| 683 | for(i = 1; i < dim; i++) |
| 684 | { |
| 685 | l[i]= 1 + siRand() % LIFT_COOR; |
| 686 | } |
| 687 | } |
| 688 | for ( j=1; j <= num; j++ ) |
| 689 | { |
| 690 | sum= 0; |
| 691 | for ( i=1; i < dim; i++ ) |
| 692 | { |
| 693 | sum += (int)points[j]->point[i] * l[i]; |
| 694 | } |
| 695 | points[j]->point[dim]= sum; |
| 696 | } |
| 697 | |
| 698 | #ifdef mprDEBUG_ALL |
| 699 | PrintS(" lift vector: "); |
| 700 | for ( j=1; j < dim; j++ ) Print(" %d ",l[j] ); |
| 701 | PrintLn(); |
| 702 | #ifdef mprDEBUG_ALL |
| 703 | PrintS(" lifted points: \n"); |
| 704 | for ( j=1; j <= num; j++ ) |
| 705 | { |
| 706 | Print("%d: <",j);print_exp(points[j],dim);PrintS(">\n"); |
| 707 | } |
| 708 | PrintLn(); |
| 709 | #endif |
| 710 | #endif |
| 711 | |
| 712 | lifted= true; |
| 713 | |
| 714 | if ( !outerL ) omFreeSize( (void *) l, (dim+1) * sizeof(int) ); |
| 715 | } |
| 716 | //<- |
| 717 | |
| 718 | //-> global functions |