Changeset c2ef83 in git for kernel/GBEngine/kstd2.cc
- Timestamp:
- Sep 14, 2016, 5:31:33 PM (8 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
- Children:
- 70e6d9158f56d7f8637aac958e7576145d67b9cb
- Parents:
- 57b2b9bd91b192001e22eedc5da8c62ec7ffc879
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/GBEngine/kstd2.cc
r57b2b9 rc2ef83 1739 1739 number coef; 1740 1740 coef=kBucketPolyRed(P.bucket,strat->S[j],pLength(strat->S[j]),strat->kNoether); 1741 nDelete(&coef); 1742 } 1743 h = kBucketGetLm(P.bucket); // FRAGE OLIVER 1744 if (h==NULL) 1745 { 1746 kBucketDestroy(&P.bucket); 1747 1748 #ifdef KDEBUG 1749 // if (TEST_OPT_DEBUG) 1750 // { 1751 // PrintS("redNF: starting S:\n"); 1752 // for( j = 0; j <= max_ind; j++ ) 1753 // { 1754 // Print("S[%d] (of size: %d): ", j, pSize(strat->S[j])); 1755 // pWrite(strat->S[j]); 1756 // } 1757 // }; 1758 #endif 1759 1760 return NULL; 1761 } 1762 kbTest(P.bucket); 1763 P.p=h; 1764 P.t_p=NULL; 1765 P.SetShortExpVector(); 1766 #ifdef KDEBUG 1767 if (TEST_OPT_DEBUG) 1768 { 1769 PrintS("\nto:"); 1770 wrp(h); 1771 PrintLn(); 1772 } 1773 #endif 1774 } 1775 else 1776 { 1777 P.p=kBucketClear(P.bucket); 1778 kBucketDestroy(&P.bucket); 1779 pNormalize(P.p); 1780 1781 #ifdef KDEBUG 1782 // if (TEST_OPT_DEBUG) 1783 // { 1784 // PrintS("redNF: starting S:\n"); 1785 // for( j = 0; j <= max_ind; j++ ) 1786 // { 1787 // Print("S[%d] (of size: %d): ", j, pSize(strat->S[j])); 1788 // pWrite(strat->S[j]); 1789 // } 1790 // }; 1791 #endif 1792 1793 return P.p; 1794 } 1795 } 1796 } 1797 1798 /*2 1799 * reduction procedure from global case but with jet bound 1800 */ 1801 1802 poly redNFBound (poly h,int &max_ind,int nonorm,kStrategy strat,int bound) 1803 { 1804 if (h==NULL) return NULL; 1805 h = pJet(h,bound); 1806 int j; 1807 max_ind=strat->sl; 1808 1809 if (0 > strat->sl) 1810 { 1811 return h; 1812 } 1813 LObject P(h); 1814 P.SetShortExpVector(); 1815 P.bucket = kBucketCreate(currRing); 1816 kBucketInit(P.bucket,P.p,pLength(P.p)); 1817 kbTest(P.bucket); 1818 #ifdef HAVE_RINGS 1819 BOOLEAN is_ring = rField_is_Ring(currRing); 1820 #endif 1821 #ifdef KDEBUG 1822 // if (TEST_OPT_DEBUG) 1823 // { 1824 // PrintS("redNF: starting S:\n"); 1825 // for( j = 0; j <= max_ind; j++ ) 1826 // { 1827 // Print("S[%d] (of size: %d): ", j, pSize(strat->S[j])); 1828 // pWrite(strat->S[j]); 1829 // } 1830 // }; 1831 #endif 1832 1833 loop 1834 { 1835 j=kFindDivisibleByInS(strat,&max_ind,&P); 1836 if (j>=0) 1837 { 1838 #ifdef HAVE_RINGS 1839 if (!is_ring) 1840 { 1841 #endif 1842 int sl=pSize(strat->S[j]); 1843 int jj=j; 1844 loop 1845 { 1846 int sll; 1847 jj=kFindNextDivisibleByInS(strat,jj+1,max_ind,&P); 1848 if (jj<0) break; 1849 sll=pSize(strat->S[jj]); 1850 if (sll<sl) 1851 { 1852 #ifdef KDEBUG 1853 if (TEST_OPT_DEBUG) Print("better(S%d:%d -> S%d:%d)\n",j,sl,jj,sll); 1854 #endif 1855 //else if (TEST_OPT_PROT) { PrintS("b"); mflush(); } 1856 j=jj; 1857 sl=sll; 1858 } 1859 } 1860 if ((nonorm==0) && (!nIsOne(pGetCoeff(strat->S[j])))) 1861 { 1862 pNorm(strat->S[j]); 1863 //if (TEST_OPT_PROT) { PrintS("n"); mflush(); } 1864 } 1865 #ifdef HAVE_RINGS 1866 } 1867 #endif 1868 nNormalize(pGetCoeff(P.p)); 1869 #ifdef KDEBUG 1870 if (TEST_OPT_DEBUG) 1871 { 1872 PrintS("red:"); 1873 wrp(h); 1874 PrintS(" with "); 1875 wrp(strat->S[j]); 1876 } 1877 #endif 1878 #ifdef HAVE_PLURAL 1879 if (rIsPluralRing(currRing)) 1880 { 1881 number coef; 1882 nc_kBucketPolyRed(P.bucket,strat->S[j],&coef); 1883 nDelete(&coef); 1884 } 1885 else 1886 #endif 1887 { 1888 number coef; 1889 coef=kBucketPolyRed(P.bucket,strat->S[j],pLength(strat->S[j]),strat->kNoether); 1890 P.p = kBucketClear(P.bucket); 1891 P.p = pJet(P.p,bound); 1892 kBucketDestroy(&P.bucket); 1893 P.SetShortExpVector(); 1894 P.bucket = kBucketCreate(currRing); 1895 kBucketInit(P.bucket,P.p,pLength(P.p)); 1741 1896 nDelete(&coef); 1742 1897 } … … 3271 3426 } 3272 3427 3428 poly kNF2Bound (ideal F,ideal Q,poly q,int bound,kStrategy strat, int lazyReduce) 3429 { 3430 assume(q!=NULL); 3431 assume(!(idIs0(F)&&(Q==NULL))); // NF(q, std(0) in polynomial ring? 3432 3433 // lazy_reduce flags: can be combined by | 3434 //#define KSTD_NF_LAZY 1 3435 // do only a reduction of the leading term 3436 //#define KSTD_NF_NONORM 4 3437 // only global: avoid normalization, return a multiply of NF 3438 poly p; 3439 3440 //if ((idIs0(F))&&(Q==NULL)) 3441 // return pCopy(q); /*F=0*/ 3442 //strat->ak = idRankFreeModule(F); 3443 /*- creating temp data structures------------------- -*/ 3444 BITSET save1; 3445 SI_SAVE_OPT1(save1); 3446 si_opt_1|=Sy_bit(OPT_REDTAIL); 3447 initBuchMoraCrit(strat); 3448 strat->initEcart = initEcartBBA; 3449 strat->enterS = enterSBba; 3450 #ifndef NO_BUCKETS 3451 strat->use_buckets = (!TEST_OPT_NOT_BUCKETS) && (!rIsPluralRing(currRing)); 3452 #endif 3453 /*- set S -*/ 3454 strat->sl = -1; 3455 /*- init local data struct.---------------------------------------- -*/ 3456 /*Shdl=*/initS(F,Q,strat); 3457 /*- compute------------------------------------------------------- -*/ 3458 //if ((TEST_OPT_INTSTRATEGY)&&(lazyReduce==0)) 3459 //{ 3460 // for (i=strat->sl;i>=0;i--) 3461 // pNorm(strat->S[i]); 3462 //} 3463 kTest(strat); 3464 if (TEST_OPT_PROT) { PrintS("r"); mflush(); } 3465 if (BVERBOSE(23)) kDebugPrint(strat); 3466 int max_ind; 3467 p = redNFBound(pCopy(q),max_ind,lazyReduce & KSTD_NF_NONORM,strat,bound); 3468 if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0)) 3469 { 3470 if (TEST_OPT_PROT) { PrintS("t"); mflush(); } 3471 if (rField_is_Ring(currRing)) 3472 { 3473 p = redtailBba_Z(p,max_ind,strat); 3474 } 3475 else 3476 { 3477 si_opt_1 &= ~Sy_bit(OPT_INTSTRATEGY); 3478 p = redtailBbaBound(p,max_ind,strat,bound,(lazyReduce & KSTD_NF_NONORM)==0); 3479 //p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0); 3480 } 3481 } 3482 /*- release temp data------------------------------- -*/ 3483 assume(strat->L==NULL); /* strat->L unused */ 3484 assume(strat->B==NULL); /* strat->B unused */ 3485 omFree(strat->sevS); 3486 omFree(strat->ecartS); 3487 assume(strat->T==NULL);//omfree(strat->T); 3488 assume(strat->sevT==NULL);//omfree(strat->sevT); 3489 assume(strat->R==NULL);//omfree(strat->R); 3490 omfree(strat->S_2_R); 3491 omfree(strat->fromQ); 3492 idDelete(&strat->Shdl); 3493 SI_RESTORE_OPT1(save1); 3494 if (TEST_OPT_PROT) PrintLn(); 3495 return p; 3496 } 3497 3273 3498 ideal kNF2 (ideal F,ideal Q,ideal q,kStrategy strat, int lazyReduce) 3274 3499 { … … 3323 3548 { 3324 3549 p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0); 3550 } 3551 } 3552 res->m[i]=p; 3553 } 3554 //else 3555 // res->m[i]=NULL; 3556 } 3557 /*- release temp data------------------------------- -*/ 3558 assume(strat->L==NULL); /* strat->L unused */ 3559 assume(strat->B==NULL); /* strat->B unused */ 3560 omFree(strat->sevS); 3561 omFree(strat->ecartS); 3562 assume(strat->T==NULL);//omfree(strat->T); 3563 assume(strat->sevT==NULL);//omfree(strat->sevT); 3564 assume(strat->R==NULL);//omfree(strat->R); 3565 omfree(strat->S_2_R); 3566 omfree(strat->fromQ); 3567 idDelete(&strat->Shdl); 3568 SI_RESTORE_OPT1(save1); 3569 if (TEST_OPT_PROT) PrintLn(); 3570 return res; 3571 } 3572 3573 ideal kNF2Bound (ideal F,ideal Q,ideal q,int bound,kStrategy strat, int lazyReduce) 3574 { 3575 assume(!idIs0(q)); 3576 assume(!(idIs0(F)&&(Q==NULL))); 3577 // lazy_reduce flags: can be combined by | 3578 //#define KSTD_NF_LAZY 1 3579 // do only a reduction of the leading term 3580 //#define KSTD_NF_NONORM 4 3581 // only global: avoid normalization, return a multiply of NF 3582 poly p; 3583 int i; 3584 ideal res; 3585 int max_ind; 3586 3587 //if (idIs0(q)) 3588 // return idInit(IDELEMS(q),si_max(q->rank,F->rank)); 3589 //if ((idIs0(F))&&(Q==NULL)) 3590 // return idCopy(q); /*F=0*/ 3591 //strat->ak = idRankFreeModule(F); 3592 /*- creating temp data structures------------------- -*/ 3593 BITSET save1; 3594 SI_SAVE_OPT1(save1); 3595 si_opt_1|=Sy_bit(OPT_REDTAIL); 3596 initBuchMoraCrit(strat); 3597 strat->initEcart = initEcartBBA; 3598 strat->enterS = enterSBba; 3599 /*- set S -*/ 3600 strat->sl = -1; 3601 #ifndef NO_BUCKETS 3602 strat->use_buckets = (!TEST_OPT_NOT_BUCKETS) && (!rIsPluralRing(currRing)); 3603 #endif 3604 /*- init local data struct.---------------------------------------- -*/ 3605 /*Shdl=*/initS(F,Q,strat); 3606 /*- compute------------------------------------------------------- -*/ 3607 res=idInit(IDELEMS(q),si_max(q->rank,F->rank)); 3608 si_opt_1 &= ~Sy_bit(OPT_INTSTRATEGY); 3609 for (i=IDELEMS(q)-1; i>=0; i--) 3610 { 3611 if (q->m[i]!=NULL) 3612 { 3613 if (TEST_OPT_PROT) { PrintS("r");mflush(); } 3614 p = redNFBound(pCopy(q->m[i]),max_ind,lazyReduce & KSTD_NF_NONORM,strat,bound); 3615 if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0)) 3616 { 3617 if (TEST_OPT_PROT) { PrintS("t"); mflush(); } 3618 if (rField_is_Ring(currRing)) 3619 { 3620 p = redtailBba_Z(p,max_ind,strat); 3621 } 3622 else 3623 { 3624 p = redtailBbaBound(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0,bound); 3325 3625 } 3326 3626 }
Note: See TracChangeset
for help on using the changeset viewer.