| 2591 | } |
| 2592 | |
| 2593 | number resMatrixDense::getSubDet() |
| 2594 | { |
| 2595 | int k,i,j,l; |
| 2596 | resVector *vecp; |
| 2597 | |
| 2598 | // generate quadratic matrix mat of size subSize |
| 2599 | matrix mat= mpNew( subSize, subSize ); |
| 2600 | |
| 2601 | for ( i= 1; i <= MATROWS( mat ); i++ ) |
| 2602 | { |
| 2603 | for ( j= 1; j <= MATCOLS( mat ); j++ ) |
| 2604 | { |
| 2605 | MATELEM(mat,i,j)= pInit(); |
| 2606 | pSetCoeff0( MATELEM(mat,i,j), nInit(0) ); |
| 2607 | } |
| 2608 | } |
| 2609 | j=1; |
| 2610 | for ( k= numVectors - 1; k >= 0; k-- ) |
| 2611 | { |
| 2612 | vecp= getMVector(k); |
| 2613 | if ( vecp->isReduced ) continue; |
| 2614 | l=1; |
| 2615 | for ( i= numVectors - 1; i >= 0; i-- ) |
| 2616 | { |
| 2617 | if ( getMVector(i)->isReduced ) continue; |
| 2618 | if ( vecp->getElemNum(numVectors - i - 1) && !nIsZero(vecp->getElemNum(numVectors - i - 1)) ) |
| 2619 | { |
| 2620 | pSetCoeff(MATELEM(mat, j , l ), nCopy(vecp->getElemNum(numVectors - i - 1))); |
| 2621 | } |
| 2622 | /* else |
| 2623 | { |
| 2624 | MATELEM(mat, j , l )= pOne(); |
| 2625 | pSetCoeff(MATELEM(mat, j , l ), nInit(0) ); |
| 2626 | } |
| 2627 | */ |
| 2628 | l++; |
| 2629 | } |
| 2630 | j++; |
| 2631 | } |
| 2632 | |
| 2633 | poly res= singclap_det( mat, currRing ); |
| 2634 | |
| 2635 | number numres; |
| 2636 | if ((res != NULL) && (!nIsZero(pGetCoeff( res ))) ) |
| 2637 | { |
| 2638 | numres= nCopy(pGetCoeff( res )); |
| 2639 | } |
| 2640 | else |
| 2641 | { |
| 2642 | numres= nInit(0); |
| 2643 | } |
| 2644 | pDelete( &res ); |
| 2645 | return numres; |
| 2646 | } |
| 2647 | //<-- |
| 2648 | |
| 2649 | //----------------------------------------------------------------------------- |
no test coverage detected