Changeset ca3332 in git
 Timestamp:
 Feb 26, 2002, 1:25:17 PM (22 years ago)
 Branches:
 (u'spielwiese', 'd1b01e9d51ade4b46b745d3bada5c5f3696be3a8')
 Children:
 110345e2447643a55f28c0f99db37a5a1eb15273
 Parents:
 c38d39f13a88f9cc44ed7a216d923bb8f632cb53
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Singular/iparith.cc
rc38d39f rca3332 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: iparith.cc,v 1.27 6 20020226 09:01:11mschulze Exp $ */4 /* $Id: iparith.cc,v 1.277 20020226 12:25:17 mschulze Exp $ */ 5 5 6 6 /* … … 4822 4822 leftv v4=v3>next; 4823 4823 4824 if(v1>Typ()!=IDEAL_CMD&&v1>Typ()!=MODUL_CMD&&v1>Typ()!=MATRIX_CMD) 4825 { 4826 Warn("1st argument must be ideal, module, or matrix!"); 4824 int i1=iiTestConvert(v1>Typ(),MODUL_CMD); 4825 int i2=iiTestConvert(v2>Typ(),MODUL_CMD); 4826 4827 if(i1==0i2==0v3>Typ()!=INT_CMDv4>Typ()!=INTVEC_CMD) 4828 { 4829 Warn("<module>,<module>,<int>,<intvec> expected!"); 4827 4830 return TRUE; 4828 4831 } 4829 if(v1>Typ()!=v2>Typ()&& 4830 (v1>Typ()!=MATRIX_CMDv2>Typ()!=MODUL_CMD)&& 4831 (v1>Typ()!=MODUL_CMDv2>Typ()!=MATRIX_CMD)) 4832 { 4833 Warn("2nd argument must be ideal, module, or matrix!"); 4834 return TRUE; 4835 } 4836 assumeStdFlag(v2); 4837 if(v3>Typ()!=INT_CMD) 4838 { 4839 Warn("3rd argument must be int!"); 4840 return TRUE; 4841 } 4842 if(v4>Typ()!=INTVEC_CMD) 4843 { 4844 Warn("4th argument must be intvec!"); 4845 return TRUE; 4846 } 4847 4848 ideal P; 4849 if(v1>Typ()==MATRIX_CMD) 4850 P=idMatrix2Module(mpCopy((matrix)v1>Data())); 4851 else 4852 P=(ideal)v1>Data(); 4853 ideal Q; 4854 if(v2>Typ()==MATRIX_CMD) 4855 Q=idMatrix2Module(mpCopy((matrix)v2>Data())); 4856 else 4857 Q=(ideal)v2>Data(); 4832 4833 sleftv w1,w2; 4834 iiConvert(v1>Typ(),MODUL_CMD,i1,v1,&w1); 4835 iiConvert(v2>Typ(),MODUL_CMD,i2,v2,&w2); 4836 ideal P=(ideal)w1.Data(); 4837 ideal Q=(ideal)w2.Data(); 4838 4858 4839 int n=(int)v3>Data(); 4859 4840 short *w=iv2array((intvec *)v4>Data()); … … 4866 4847 matrix T=mpNew(IDELEMS(Q),IDELEMS(P)); 4867 4848 ideal R=idInit(IDELEMS(P),P>rank); 4868 matrix U=mpNew(P>rank,P>rank);4869 for(int i=MATROWS(U);i>=1;i)4870 MATELEM(U,i,i)=pOne();4871 4849 4872 4850 for(int i=IDELEMS(P)1;i>=0;i) … … 4880 4858 { 4881 4859 poly p0=pDivideM(pHead(p),pHead(Q>m[j])); 4882 p=pSub(p,ppMult_mm(Q>m[j],p0)); 4860 p=pJetW(pSub(p,ppMult_mm(Q>m[j],p0)),N,w); 4861 pNormalize(p); 4883 4862 if(pDegW(p0,w)>n) 4884 4863 pDelete(&p0); 4885 4864 else 4886 4865 MATELEM(T,j+1,i+1)=pAdd(MATELEM(T,j+1,i+1),p0); 4887 p=ppJetW(p0=p,N,w);4888 pDelete(&p0);4889 4866 j=IDELEMS(Q)1; 4890 4867 } … … 4908 4885 } 4909 4886 4910 if(v1>Typ()==MATRIX_CMD)4911 idDelete(&P);4912 if(v2>Typ()==MATRIX_CMD)4913 idDelete(&Q);4914 4887 omFree(w); 4915 4888 4916 4889 lists L=(lists)omAllocBin(slists_bin); 4917 L>Init( 3);4890 L>Init(2); 4918 4891 L>m[0].rtyp=MATRIX_CMD; 4919 4892 L>m[0].data=(void *)T; 4920 L>m[1].rtyp=MATRIX_CMD; 4921 L>m[1].data=(void *)U; 4922 L>m[2].rtyp=v1>Typ(); 4923 if(v1>Typ()==MATRIX_CMD) 4924 L>m[2].data=(void *)idModule2Matrix(R); 4893 L>m[1].rtyp=v1>Typ(); 4894 if(v1>Typ()==POLY_CMDv1>Typ()==VECTOR_CMD) 4895 { 4896 L>m[1].data=(void *)pCopy(R>m[0]); 4897 idDelete(&R); 4898 } 4899 else if(v1>Typ()==IDEAL_CMDv1>Typ()==MODUL_CMD) 4900 L>m[1].data=(void *)R; 4901 else if(v1>Typ()==MATRIX_CMD) 4902 L>m[1].data=(void *)idModule2Matrix(R); 4925 4903 else 4926 L>m[2].data=(void *)R; 4904 { 4905 L>m[1].rtyp=MODUL_CMD; 4906 L>m[1].data=(void *)R; 4907 } 4927 4908 res>data=L; 4928 4909 res>rtyp=LIST_CMD;
Note: See TracChangeset
for help on using the changeset viewer.