Changeset e63576 in git for libpolys/polys/nc/old.gring.cc
- Timestamp:
- Aug 11, 2011, 4:42:02 PM (12 years ago)
- Branches:
- (u'spielwiese', 'd1ec153efbb92b07a03c829a7f893fe854f169d2')
- Children:
- 95eb6d00149ac8549074f366eba29162578e4ead
- Parents:
- 3e305b6ce4edb47687c2d4f484f63a86ab340c0f
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2011-08-11 16:42:02+02:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 13:19:16+01:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/polys/nc/old.gring.cc
r3e305b re63576 2474 2474 return(res); 2475 2475 } 2476 /*2477 ideal twostd(ideal I) // works in currRing only!2478 {2479 ideal J = kStd(I, currQuotient, testHomog, NULL, NULL, 0, 0, NULL); // in currRing!!!2480 idSkipZeroes(J); // ring independent!2481 2482 const int rN = currRing->N;2483 2484 loop2485 {2486 ideal K = NULL;2487 const int s = idElem(J); // ring independent2488 2489 for(int i = 0; i < s; i++)2490 {2491 const poly p = J->m[i];2492 2493 #ifdef PDEBUG2494 p_Test(p, currRing);2495 #if 02496 Print("p: "); // !2497 p_Write(p, currRing);2498 #endif2499 #endif2500 2501 for (int j = 1; j <= rN; j++) // for all j = 1..N2502 {2503 poly varj = p_One( currRing);2504 p_SetExp(varj, j, 1, currRing);2505 p_Setm(varj, currRing);2506 2507 poly q = pp_Mult_mm(p, varj, currRing); // q = J[i] * var(j),2508 2509 #ifdef PDEBUG2510 p_Test(varj, currRing);2511 p_Test(p, currRing);2512 p_Test(q, currRing);2513 #if 02514 Print("Reducing p: "); // !2515 p_Write(p, currRing);2516 Print("With q: "); // !2517 p_Write(q, currRing);2518 #endif2519 #endif2520 2521 p_Delete(&varj, currRing);2522 2523 if (q != NULL)2524 {2525 #ifdef PDEBUG2526 #if 02527 Print("Reducing q[j = %d]: ", j); // !2528 p_Write(q, currRing);2529 2530 Print("With p:");2531 p_Write(p, currRing);2532 2533 #endif2534 #endif2535 2536 // bug: lm(p) may not divide lm(p * var(i)) in a SCA!2537 if( p_LmDivisibleBy(p, q, currRing) )2538 q = nc_ReduceSpoly(p, q, currRing);2539 2540 2541 #ifdef PDEBUG2542 p_Test(q, currRing);2543 #if 02544 Print("reductum q/p: ");2545 p_Write(q, currRing);2546 2547 // Print("With J!\n");2548 #endif2549 #endif2550 2551 // if( q != NULL)2552 q = kNF(J, currQuotient, q, 0, KSTD_NF_NONORM); // in currRing!!!2553 2554 #ifdef PDEBUG2555 p_Test(q, currRing);2556 #if 02557 Print("NF(J/currQuotient)=> q: "); // !2558 p_Write(q, currRing);2559 #endif2560 #endif2561 if (q!=NULL)2562 {2563 if (p_IsConstant(q, currRing)) // => return (1)!2564 {2565 p_Delete(&q, currRing);2566 id_Delete(&J, currRing);2567 2568 if (K != NULL)2569 id_Delete(&K, currRing);2570 2571 ideal Q = idInit(1,1); // ring independent!2572 Q->m[0] = p_One(currRing);2573 2574 return(Q);2575 }2576 2577 // flag = false;2578 2579 // K += q:2580 2581 ideal Q = idInit(1,1); // ring independent2582 Q->m[0]=q;2583 2584 if( K == NULL )2585 K = Q;2586 else2587 {2588 ideal id_tmp = idSimpleAdd(K, Q); // in currRing2589 id_Delete(&K, currRing);2590 id_Delete(&Q, currRing);2591 K = id_tmp; // K += Q2592 }2593 }2594 2595 2596 } // if q != NULL2597 } // for all variables2598 2599 }2600 2601 if (K == NULL) // nothing new: i.e. all elements are two-sided2602 return(J);2603 // now we update GrBasis J with K2604 // iSize=IDELEMS(J);2605 #ifdef PDEBUG2606 idTest(J); // in currRing!2607 #if 02608 Print("J:");2609 idPrint(J);2610 PrintLn();2611 #endif // debug2612 #endif2613 2614 2615 2616 #ifdef PDEBUG2617 idTest(K); // in currRing!2618 #if 02619 Print("+K:");2620 idPrint(K);2621 PrintLn();2622 #endif // debug2623 #endif2624 2625 2626 int iSize = idElem(J); // ring independent2627 2628 // J += K:2629 ideal id_tmp = idSimpleAdd(J,K); // in currRing2630 id_Delete(&K, currRing); id_Delete(&J, currRing);2631 2632 #if 12633 BITSET save_test=test;2634 test|=Sy_bit(OPT_SB_1); // ring independent2635 J = kStd(id_tmp, currQuotient, testHomog, NULL, NULL, 0, iSize); // J = J + K, J - std // in currRing!2636 test = save_test;2637 #else2638 J=kStd(id_tmp, currQuotient,testHomog,NULL,NULL,0,0,NULL);2639 #endif2640 2641 id_Delete(&id_tmp, currRing);2642 idSkipZeroes(J); // ring independent2643 2644 #ifdef PDEBUG2645 idTest(J); // in currRing!2646 #if 02647 Print("J:");2648 idPrint(J);2649 PrintLn();2650 #endif // debug2651 #endif2652 } // loop2653 }2654 */2655 2656 2657 2476 /// returns matrix with the info on noncomm multiplication 2658 2477 matrix nc_PrintMat(int a, int b, ring r, int metric) … … 3510 3329 } 3511 3330 3512 /*3513 static ideal idPrepareStd(ideal T, ideal s, int k)3514 {3515 // T is a left SB, without zeros, s is a list with zeros3516 #ifdef PDEBUG3517 if (IDELEMS(s)!=IDELEMS(T))3518 {3519 Print("ideals of diff. size!!!");3520 }3521 #endif3522 ideal t = idCopy(T);3523 int j,rs=idRankFreeModule(s);3524 poly p,q;3525 3526 ideal res = idInit(2*idElem(t),1+idElem(t));3527 if (rs == 0)3528 {3529 for (j=0; j<IDELEMS(t); j++)3530 {3531 if (s->m[j]!=NULL) pSetCompP(s->m[j],1);3532 if (t->m[j]!=NULL) pSetCompP(t->m[j],1);3533 }3534 k = si_max(k,1);3535 }3536 for (j=0; j<IDELEMS(t); j++)3537 {3538 if (s->m[j]!=NULL)3539 {3540 p = s->m[j];3541 q = pOne();3542 pSetComp(q,k+1+j);3543 pSetmComp(q);3544 #if 03545 while (pNext(p)) pIter(p);3546 pNext(p) = q;3547 #else3548 p = pAdd(p,q);3549 s->m[j] = p;3550 #ifdef PDEBUG3551 pTest(p);3552 #endif3553 #endif3554 }3555 }3556 res = idSimpleAdd(t,s);3557 idDelete(&t);3558 res->rank = 1+idElem(T);3559 return(res);3560 }3561 */3562 3563 /*3564 ideal Approx_Step(ideal L)3565 {3566 int N=currRing->N;3567 int i,j; // k=syzcomp3568 int flag, flagcnt=0, syzcnt=0;3569 int syzcomp = 0;3570 int k=1; // for ideals not modules3571 ideal I = kStd(L, currQuotient,testHomog,NULL,NULL,0,0,NULL);3572 idSkipZeroes(I);3573 ideal s_I;3574 int idI = idElem(I);3575 ideal trickyQuotient;3576 if (currQuotient !=NULL)3577 {3578 trickyQuotient = idSimpleAdd(currQuotient,I);3579 }3580 else3581 trickyQuotient = I;3582 idSkipZeroes(trickyQuotient);3583 poly *var = (poly *)omAlloc0((N+1)*sizeof(poly));3584 // poly *W = (poly *)omAlloc0((2*N+1)*sizeof(poly));3585 resolvente S = (resolvente)omAlloc0((N+1)*sizeof(ideal));3586 ideal SI, res;3587 matrix MI;3588 poly x=pOne();3589 var[0]=x;3590 ideal h2, h3, s_h2, s_h3;3591 poly p,q,qq;3592 // init vars3593 for (i=1; i<=N; i++ )3594 {3595 x = pOne();3596 pSetExp(x,i,1);3597 pSetm(x);3598 var[i]=pCopy(x);3599 }3600 // init NF's3601 for (i=1; i<=N; i++ )3602 {3603 h2 = idInit(idI,1);3604 flag = 0;3605 for (j=0; j< idI; j++ )3606 {3607 q = pp_Mult_mm(I->m[j],var[i],currRing);3608 q = kNF(I,currQuotient,q,0,0);3609 if (q!=0)3610 {3611 h2->m[j]=pCopy(q);3612 // pShift(&(h2->m[flag]),1);3613 flag++;3614 pDelete(&q);3615 }3616 else3617 h2->m[j]=0;3618 }3619 // W[1..idElems(I)]3620 if (flag >0)3621 {3622 // compute syzygies with values in I3623 // idSkipZeroes(h2);3624 // h2 = idSimpleAdd(h2,I);3625 // h2->rank=flag+idI+1;3626 idTest(h2);3627 //idShow(h2);3628 ring orig_ring=currRing;3629 ring syz_ring=rCurrRingAssure_SyzComp();3630 syzcomp = 1;3631 rSetSyzComp(syzcomp);3632 if (orig_ring != syz_ring)3633 {3634 s_h2=idrCopyR_NoSort(h2,orig_ring);3635 // s_trickyQuotient=idrCopyR_NoSort(trickyQuotient,orig_ring);3636 // rDebugPrint(syz_ring);3637 s_I=idrCopyR_NoSort(I,orig_ring);3638 }3639 else3640 {3641 s_h2 = h2;3642 s_I = I;3643 // s_trickyQuotient=trickyQuotient;3644 }3645 idTest(s_h2);3646 // idTest(s_trickyQuotient);3647 Print(".proceeding with the variable %d\n",i);3648 s_h3 = idPrepareStd(s_I, s_h2, 1);3649 BITSET save_test=test;3650 test|=Sy_bit(OPT_SB_1);3651 idTest(s_h3);3652 idDelete(&s_h2);3653 s_h2=idCopy(s_h3);3654 idDelete(&s_h3);3655 Print("...computing Syz");3656 s_h3 = kStd(s_h2, currQuotient,(tHomog)FALSE,NULL,NULL,syzcomp,idI);3657 test=save_test;3658 //idShow(s_h3);3659 if (orig_ring != syz_ring)3660 {3661 idDelete(&s_h2);3662 for (j=0; j<IDELEMS(s_h3); j++)3663 {3664 if (s_h3->m[j] != NULL)3665 {3666 if (p_MinComp(s_h3->m[j],syz_ring) > syzcomp) // i.e. it is a syzygy3667 pShift(&s_h3->m[j], -syzcomp);3668 else3669 pDelete(&s_h3->m[j]);3670 }3671 }3672 idSkipZeroes(s_h3);3673 s_h3->rank -= syzcomp;3674 rChangeCurrRing(orig_ring);3675 // s_h3 = idrMoveR_NoSort(s_h3, syz_ring);3676 s_h3 = idrMoveR_NoSort(s_h3, syz_ring);3677 rKill(syz_ring);3678 }3679 idTest(s_h3);3680 S[syzcnt]=kStd(s_h3,currQuotient,(tHomog)FALSE,NULL,NULL);3681 syzcnt++;3682 idDelete(&s_h3);3683 } // end if flag >03684 else3685 {3686 flagcnt++;3687 }3688 }3689 if (flagcnt == N)3690 {3691 Print("the input is a two--sided ideal");3692 return(I);3693 }3694 if (syzcnt >0)3695 {3696 Print("..computing Intersect of %d modules\n",syzcnt);3697 if (syzcnt == 1)3698 SI = S[0];3699 else3700 SI = idMultSect(S, syzcnt);3701 //idShow(SI);3702 MI = idModule2Matrix(SI);3703 res= idInit(MATCOLS(MI),1);3704 for (i=1; i<= MATCOLS(MI); i++)3705 {3706 p = NULL;3707 for (j=0; j< idElem(I); j++)3708 {3709 q = pCopy(MATELEM(MI,j+1,i));3710 if (q!=NULL)3711 {3712 q = pMult(q,pCopy(I->m[j]));3713 p = pAdd(p,q);3714 }3715 }3716 res->m[i-1]=p;3717 }3718 Print("final std");3719 res = kStd(res, currQuotient,testHomog,NULL,NULL,0,0,NULL);3720 idSkipZeroes(res);3721 return(res);3722 }3723 else3724 {3725 Print("No syzygies");3726 return(I);3727 }3728 }3729 */3730 3331 3731 3332 // creates a commutative nc extension; "converts" comm.ring to a Plural ring
Note: See TracChangeset
for help on using the changeset viewer.