- Timestamp:
- May 3, 2013, 8:56:15 PM (11 years ago)
- Branches:
- (u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
- Children:
- a8f51f2cbfd5e70ab9d6ada456b3c4f409b753bd
- Parents:
- 552d26572655f537d219086f12ab104e239f7db2ed95e6148ac6926aac6e83629cf4545c5c95a7a7
- Location:
- Singular
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/absfact.lib
r552d26 r2391e4 26 26 PROCEDURES: 27 27 absFactorize(); absolute factorization of poly 28 absBiFactorize(); absolute factorization of bivariate poly 28 29 "; 29 30 … … 609 610 } 610 611 612 //////////////////////////////////////////////////////////////////////////////// 613 proc absBiFactorize(poly p, list #) 614 "USAGE: absBiFactorize(p [,s]); p poly, s string 615 ASSUME: coefficient field is the field of rational numbers or a 616 transcendental extension thereof 617 RETURN: ring @code{R} which is obtained from the current basering 618 by adding a new parameter (if a string @code{s} is given as a 619 second input, the new parameter gets this string as name). The ring 620 @code{R} comes with a list @code{absolute_factors} with the 621 following entries: 622 @format 623 absolute_factors[1]: ideal (the absolute factors) 624 absolute_factors[2]: intvec (the multiplicities) 625 absolute_factors[3]: ideal (the minimal polynomials) 626 absolute_factors[4]: int (total number of nontriv. absolute factors) 627 @end format 628 The entry @code{absolute_factors[1][1]} is a constant, the 629 entry @code{absolute_factors[3][1]} is the parameter added to the 630 current ring.@* 631 Each of the remaining entries @code{absolute_factors[1][j]} stands for 632 a class of conjugated absolute factors. The corresponding entry 633 @code{absolute_factors[3][j]} is the minimal polynomial of the 634 field extension over which the factor is minimally defined (its degree 635 is the number of conjugates in the class). If the entry 636 @code{absolute_factors[3][j]} coincides with @code{absolute_factors[3][1]}, 637 no field extension was necessary for the @code{j}th (class of) 638 absolute factor(s). 639 NOTE: The input polynomial p is assumed to be bivariate or to contain one para- 640 meter and one variable. All factors are presented denominator- and 641 content-free. The constant factor (first entry) is chosen such that the 642 product of all (!) the (denominator- and content-free) absolute factors 643 of @code{p} equals @code{p / absolute_factors[1][1]}. 644 SEE ALSO: factorize, absPrimdecGTZ, absFactorize 645 EXAMPLE: example absBiFactorize; shows an example 646 " 647 { 648 int dblevel = printlevel - voice + 2; 649 dbprint(dblevel,"Entering absfact.lib::absBiFactorize with ",p); 650 def MP = basering; 651 int i; 652 if (char(MP) != 0) 653 { 654 ERROR("// absfact.lib::absBiFactorize is only implemented for "+ 655 "characteristic 0"); 656 } 657 if(minpoly!=0) 658 { 659 ERROR("// absfact.lib::absBiFactorize is not implemented for algebraic " 660 +"extensions"); 661 } 662 663 int n = nvars(MP); 664 int pa=npars(MP); 665 list lMP= ringlist(MP); 666 intvec vv,vk; 667 for(i=1;i<=n;i++){vv[i]=1;} 668 vk=vv,1; 669 670 //if the basering has parameters, add the parameters to the variables 671 //takes care about coefficients and possible denominators 672 if(pa>0) 673 { 674 poly qh=cleardenom(p); 675 if (p==0) 676 { 677 number cok=0; 678 } 679 else 680 { 681 number cok=leadcoef(p)/leadcoef(qh); 682 } 683 p=qh; 684 string sp; 685 for(i=1;i<=npars(basering);i++) 686 { 687 sp=string(par(i)); 688 sp=sp[2..size(sp)-1]; 689 lMP[2][n+i]=sp; 690 vv=vv,1; 691 } 692 lMP[1]=0; 693 n=n+npars(MP); 694 } 695 696 // MPz is obtained by adding the new variable @z to MP 697 // ordering is wp(1...1) 698 // All the above subroutines work in MPz 699 string newvar; 700 if(size(#)>0) 701 { 702 if(typeof(#[1])=="string") 703 { 704 newvar=#[1]; 705 } 706 else 707 { 708 newvar = "a"; 709 } 710 } 711 else 712 { 713 newvar = "a"; 714 } 715 if (newvar=="a") 716 { 717 if(belongTo(newvar, lMP[2])||defined(a)){newvar = "b";} 718 if(belongTo(newvar, lMP[2])||defined(b)){newvar = "c";} 719 if(belongTo(newvar, lMP[2])||defined(c)){newvar = "@c";} 720 while(belongTo(newvar, lMP[2])) 721 { 722 newvar = "@" + newvar; 723 } 724 } 725 726 // create ring with extra parameter `newvar` for output: 727 setring(MP); 728 list Lout=ringlist(MP); 729 if(!pa) 730 { 731 list Lpar=list(char(MP),list(newvar),list(list("lp",intvec(1))),ideal(0)); 732 } 733 else 734 { 735 list Lpar=Lout[1]; 736 Lpar[2][size(Lpar[2])+1]=newvar; 737 vv=Lpar[3][1][2]; 738 vv=vv,1; 739 Lpar[3][1][2]=vv; 740 } 741 Lout[1]=Lpar; 742 def MPo=ring(Lout); 743 setring(MPo); 744 745 poly p=imap(MP,p); 746 747 if (size (variables (p)) > 2) 748 { 749 ERROR("// absfact.lib::absBiFactorize is not implemented for polynomials " 750 +"with more than 2 variables"); 751 } 752 753 // special treatment in the homogeneous case, dropping one variable 754 // by substituting the first variable by 1 755 int ho=homog(p); 756 if(ho) 757 { 758 int dh=deg(p); 759 p=subst(p,var(1),1); 760 int di=deg(p); 761 } 762 763 list tmpf=system ("absBiFact", p); 764 765 // the homogeneous case, homogenizing the result 766 // the new variable has to have degree 0 767 // need to change the ring 768 if(ho) 769 { 770 list ll=ringlist(MPo); 771 vv[size(vv)]=0; 772 ll[3][1][2]=vv; 773 def MPhelp=ring(ll); 774 setring(MPhelp); 775 list tmpf=imap(MPo,tmpf); 776 for(i=2;i<=size(tmpf[1]);i++) 777 { 778 tmpf[1][i]=homog(tmpf[1][i],var(1)); 779 } 780 if(dh>di) 781 { 782 tmpf[1][size(tmpf[1])+1]=var(1); 783 tmpf[2][size(tmpf[2])+1]=dh-di; 784 tmpf[3][size(tmpf[3])+1]=par(npars(MPo)); 785 tmpf[4]= tmpf[4]+dh-di; 786 } 787 setring(MPo); 788 tmpf=imap(MPhelp,tmpf); 789 } 790 791 if (pa) 792 { 793 number cok=imap(MP,cok); 794 tmpf[1][1]=cok*tmpf[1][1]; 795 } 796 797 // if we want the output as string 798 if(size(#)>0) 799 { 800 if(typeof(#[1])=="int") 801 { 802 if(#[1]==77) 803 { // undocumented feature for Gerhard's absPrimdecGTZ 804 if (size(tmpf[1])<2){ list abs_fac = list(var(n+1),poly(1)); } 805 else 806 { 807 list abs_fac= tmpf[3][2]; 808 abs_fac= abs_fac, tmpf[1][2]; 809 for (i= 3; i <= size(tmpf[1]); i++) 810 { 811 abs_fac=abs_fac,tmpf[3][i]; 812 abs_fac=abs_fac,tmpf[1][i]; 813 } 814 } 815 abs_fac=abs_fac,newvar; 816 return(string(abs_fac)); 817 } 818 } 819 } 820 821 list absolute_factors= tmpf; 822 export absolute_factors; 823 setring(MP); 824 825 dbprint( printlevel-voice+3," 826 // 'absBiFactorize' created a ring, in which a list absolute_factors (the 827 // absolute factors) is stored. 828 // To access the list of absolute factors, type (if the name S was assigned 829 // to the return value): 830 setring(S); absolute_factors; "); 831 return(MPo); 832 } 833 example 834 { 835 "EXAMPLE:"; echo = 2; 836 ring R = (0), (x,y), lp; 837 poly p = (-7*x^2 + 2*x*y^2 + 6*x + y^4 + 14*y^2 + 47)*(5x2+y2)^3*(x-y)^4; 838 def S = absBiFactorize(p) ; 839 setring(S); 840 absolute_factors; 841 } 842 843 611 844 /* 612 845 ring r=0,(x,t),dp; -
Singular/LIB/primdec.lib
red95e6 r2391e4 3769 3769 I=interred(I+F);option(set,save);return(I); 3770 3770 } 3771 I=simplify(I,1); 3771 3772 3772 3773 for(i=1;i<=n;i++) //consider all polynomials over … … 4444 4445 if(check==0) // H==I => U is a primary decomposition 4445 4446 { 4446 4447 option(set,save); 4447 4448 return(U); 4448 4449 } -
Singular/extra.cc
r552d26 r2391e4 3683 3683 } 3684 3684 else 3685 /*================= absBiFact ======================*/ 3686 if (strcmp(sys_cmd, "absBiFact") == 0) 3687 { 3688 if (h!=NULL) 3689 { 3690 res->rtyp=LIST_CMD; 3691 if (h->Typ()==POLY_CMD) 3692 { 3693 intvec *v=NULL; 3694 ideal mipos= NULL; 3695 int n= 0; 3696 ideal f=singclap_absBiFactorize((poly)(h->Data()), mipos, &v, n, currRing); 3697 if (f==NULL) return TRUE; 3698 ivTest(v); 3699 lists l=(lists)omAllocBin(slists_bin); 3700 l->Init(4); 3701 l->m[0].rtyp=IDEAL_CMD; 3702 l->m[0].data=(void *)f; 3703 l->m[1].rtyp=INTVEC_CMD; 3704 l->m[1].data=(void *)v; 3705 l->m[2].rtyp=IDEAL_CMD; 3706 l->m[2].data=(void*) mipos; 3707 l->m[3].rtyp=INT_CMD; 3708 l->m[3].data=(void*) (long) n; 3709 res->data=(void *)l; 3710 return FALSE; 3711 } 3712 else return TRUE; 3713 } 3714 else return TRUE; 3715 } 3716 else 3685 3717 #endif 3686 3718 /*================= probIrredTest ======================*/ -
Singular/subexpr.cc
red95e6 r2391e4 1066 1066 return ((idhdl)h->data.ustring)->data.ustring; 1067 1067 } 1068 case VECHO: return (void *) si_echo;1069 case VPRINTLEVEL:return (void *) printlevel;1070 case VCOLMAX: return (void *) colmax;1071 case VTIMER: return (void *) getTimer();1072 case VRTIMER: return (void *) getRTimer();1073 case VOICE: return (void *)( myynest+1);1074 case VMAXDEG: return (void *) Kstd1_deg;1075 case VMAXMULT: return (void *) Kstd1_mu;1076 case TRACE: return (void *) traceit;1077 case VSHORTOUT: return (void *)( currRing != NULL ? currRing->ShortOut : 0);1068 case VECHO: return (void *)(long)si_echo; 1069 case VPRINTLEVEL:return (void *)(long)printlevel; 1070 case VCOLMAX: return (void *)(long)colmax; 1071 case VTIMER: return (void *)(long)getTimer(); 1072 case VRTIMER: return (void *)(long)getRTimer(); 1073 case VOICE: return (void *)(long)(myynest+1); 1074 case VMAXDEG: return (void *)(long)Kstd1_deg; 1075 case VMAXMULT: return (void *)(long)Kstd1_mu; 1076 case TRACE: return (void *)(long)traceit; 1077 case VSHORTOUT: return (void *)(long)(currRing != NULL ? currRing->ShortOut : 0); 1078 1078 case VMINPOLY: 1079 1079 if ( (currRing != NULL) && nCoeff_is_algExt(currRing->cf) && !nCoeff_is_GF(currRing->cf))
Note: See TracChangeset
for help on using the changeset viewer.