Returns the fglmVector v, s.t. p = v[1]*basis(1) + .. + v[basisSize]*basis(basisSize) So the size of v depends on the current size of the basis. Assumes that such an representation exists, i.e. all monoms in p have to be smaller than basis[basisSize] and that basis[k] < basis[l] for k < l.
| 540 | // Assumes that such an representation exists, i.e. all monoms in p have to be |
| 541 | // smaller than basis[basisSize] and that basis[k] < basis[l] for k < l. |
| 542 | fglmVector |
| 543 | fglmSdata::getVectorRep( const poly p ) |
| 544 | { |
| 545 | fglmVector temp( basisSize ); |
| 546 | poly m = p; |
| 547 | int num = basisSize; |
| 548 | while ( m != NULL ) { |
| 549 | int comp = pCmp( m, basis[num] ); |
| 550 | if ( comp == 0 ) { |
| 551 | fglmASSERT( num > 0, "Error(1) in fglmSdata::getVectorRep" ); |
| 552 | number newelem = nCopy( pGetCoeff( m ) ); |
| 553 | temp.setelem( num, newelem ); |
| 554 | num--; |
| 555 | pIter( m ); |
| 556 | } |
| 557 | else { |
| 558 | if ( comp < 0 ) { |
| 559 | num--; |
| 560 | } |
| 561 | else { |
| 562 | // This is the place where we can detect if the sourceIdeal |
| 563 | // is not reduced. In this case m is not in basis[]. Since basis[] |
| 564 | // is ordered this is the case, if and only if basis[i]<m |
| 565 | // and basis[j]>m for all j>i |
| 566 | _state= FALSE; |
| 567 | return temp; |
| 568 | } |
| 569 | } |
| 570 | } |
| 571 | return temp; |
| 572 | } |
| 573 | |
| 574 | // Searches through the border for a monomial bm which divides m and returns |
| 575 | // its normalform in vector representation. |
no test coverage detected