Changeset 5f524e in git
- Timestamp:
- Nov 20, 2000, 5:02:03 PM (23 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- c36beecfa29ca61b3d39473a32c3e6f3a0a985d1
- Parents:
- f2e841257a03cef8970190e17e935122992cc572
- Location:
- Singular
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/gring.cc
rf2e8412 r5f524e 3 3 ****************************************/ 4 4 /*************************************************************** 5 * File: pp_Mult_mm__Template.cc6 * Purpose: template for p_Mult_n7 * Author: obachman (Olaf Bachmann) /levandov (Viktor Levandovsky)5 * File: gring.cc 6 * Purpose: pMult family of procedures 7 * Author: levandov (Viktor Levandovsky) 8 8 * Created: 8/00 - 11/00 9 * Version: $Id: gring.cc,v 1. 1 2000-11-13 14:50:23 levandov Exp $9 * Version: $Id: gring.cc,v 1.2 2000-11-20 16:02:03 levandov Exp $ 10 10 *******************************************************************/ 11 11 #include "mod2.h" 12 12 #include "gring.h" 13 #include "polys.h" 13 14 #ifdef HAVE_PLURAL 14 /*************************************************************** 15 * 16 * Returns: p*m 17 * Const: p, m 18 * If spNoether != NULL, then monoms which are smaller 19 * then spNoether are cut 20 * 21 ***************************************************************/ 15 16 //global nc_macros : 17 #define freeT(A) omFree((ADDRESS)A,(pVariables+1)*sizeof(Exponent_t)) 18 #define freeN(A,k) omFree((ADDRESS)A,k*sizeof(number)) 22 19 23 20 poly nc_pp_Mult_mm(poly p, const poly m, const poly spNoether, const ring ri) … … 52 49 } 53 50 54 poly nc_mm_Mult_ mm(Exponent_t *F, Exponent_t *G, const ring ri)51 poly nc_mm_Mult_nn(Exponent_t *F, Exponent_t *G, const ring ri) 55 52 56 53 /* destroys both f and g , f,g are monomials with the coefficient */ … … 81 78 out=pOne(); 82 79 for (i=1;i<=nv;i++) { F[i]=F[i]+G[i];} 83 F[0]=exp;80 // F[0]=exp; 84 81 pSetExpV(out,F); 85 82 pSetCoeff(out,cOut); … … 226 223 227 224 //----------pMultUU--------- 228 poly pMultUU (int i, int a, int j, int b)225 poly nc_uu_Mult_ww (int i, int a, int j, int b,const ring r) 229 226 { 230 227 int nv=pVariables; … … 234 231 { 235 232 out=pOne(); 236 p SetExp(out,j,b);237 p SetExp(out,i,a);238 if (i==j) p SetExp(out,j,a+b);239 p Setm(out);233 p_SetExp(out,j,b,r); 234 p_SetExp(out,i,a,r); 235 if (i==j) p_SetExp(out,j,a+b,r); 236 p_Setm(out,r); 240 237 return(out); 241 238 } … … 252 249 { 253 250 out=pOne(); 254 p SetExp(out,j,b);pSetm(out);251 p_SetExp(out,j,b,r);p_Setm(out,r); 255 252 return(out); 256 253 } … … 261 258 { 262 259 out=pOne(); 263 p SetExp(out,i,a);pSetm(out);260 p_SetExp(out,i,a,r);p_Setm(out,r); 264 261 return(out); 265 262 } … … 270 267 271 268 int vik = UPMATELEM(j,i); 272 if ((ri->nc->type==nc_skew)||(ri->nc->MF[vik]==0)) // ??? 273 { 274 out=pOne(); 275 pSetExp(out,j,b); pSetExp(out,i,a); 276 pSetm(out); 277 number tmp_number=NULL; 278 nPower(c,a*b,&tmp_number); 279 pSetCoeff(out,tmp_number); 280 return (out); 281 } 282 matrix cMT=currRing->MT[vik]; 283 int cMTsize=currRing->MTsize[vik]; 269 // FOR future nc_skew case 270 // if ((ri->nc->type==nc_skew)||(ri->nc->MF[vik]==0)) 271 // { 272 // out=pOne(); 273 // pSetExp(out,j,b); pSetExp(out,i,a); 274 // pSetm(out); 275 // number tmp_number=NULL; 276 // nPower(c,a*b,&tmp_number); 277 // pSetCoeff(out,tmp_number); 278 // return (out); 279 // } 280 matrix cMT=r->MT[vik]; 281 int cMTsize=r->MTsize[vik]; 284 282 285 283 if (((a<cMTsize)&&(b<cMTsize))&&(MATELEM(cMT,a,b)!=NULL)) 286 284 { 287 out=p Copy(MATELEM(cMT,a,b));285 out=p_Copy(MATELEM(cMT,a,b),r); 288 286 return (out); 289 287 } 290 288 291 //End(Zero_Exceptions = (0,0),(0,b),(a,0) )289 //End(Zero_Exceptions = (0,0),(0,b),(a,0),(a==b) ) 292 290 //in fact, now a>=1 and b>=1; and j<i 293 291 294 poly C=MATELEM( currRing->C,j,i);295 number c=p GetCoeff(C); //coeff296 poly D=MATELEM( currRing->D,j,i); //rest297 298 int newcMTsize ;292 poly C=MATELEM(r->C,j,i); 293 number c=p_GetCoeff(C,r); //coeff 294 poly D=MATELEM(r->D,j,i); //rest 295 296 int newcMTsize=0; 299 297 300 298 if (D==NULL) /* (skew)-commutativity check */ 301 299 { 302 300 out=pOne(); 303 p SetExp(out,j,b); pSetExp(out,i,a);304 p Setm(out);301 p_SetExp(out,j,b,r); p_SetExp(out,i,a,r); 302 p_Setm(out,r); 305 303 number tmp_number=NULL; 306 304 nPower(c,a*b,&tmp_number); 307 p SetCoeff(out,tmp_number);305 p_SetCoeff(out,tmp_number,r); 308 306 return(out); 309 307 } … … 311 309 if ((a==1)&&(b==1)) 312 310 { 313 out= p Copy(MATELEM(cMT,1,1)); /* already computed */311 out= p_Copy(MATELEM(cMT,1,1),r); /* already computed */ 314 312 return(out); 315 313 } … … 325 323 for (int q=p;q<=nv;q++) 326 324 { 327 MATELEM(tmp,p,q) = MATELEM( currRing->MT[UPMATELEM(j,i)],p,q);328 MATELEM( currRing->MT[UPMATELEM(j,i)],p,q)=NULL;325 MATELEM(tmp,p,q) = MATELEM(r->MT[UPMATELEM(j,i)],p,q); 326 MATELEM(r->MT[UPMATELEM(j,i)],p,q)=NULL; 329 327 } 330 328 } 331 id Delete((ideal *)&(currRing->MT[UPMATELEM(j,i)]));332 currRing->MT[UPMATELEM(j,i)] = tmp;333 currRing->MTsize[UPMATELEM(j,i)] = newcMTsize;334 } /* update of multiplication matrix is finished */335 336 cMT= currRing->MT[UPMATELEM(j,i)]; //cMT=current MT337 338 poly x=pOne();p SetExp(x,j,1);pSetm(x);//var(j);339 poly y=pOne();p SetExp(y,i,1);pSetm(y);//var(i); for convenience329 id_Delete((ideal *)&(r->MT[UPMATELEM(j,i)]),r); 330 r->MT[UPMATELEM(j,i)] = tmp; 331 r->MTsize[UPMATELEM(j,i)] = newcMTsize; 332 } /* The update of multiplication matrix is finished */ 333 334 cMT=r->MT[UPMATELEM(j,i)]; //cMT=current MT 335 336 poly x=pOne();p_SetExp(x,j,1,r);p_Setm(x,r);//var(j); 337 poly y=pOne();p_SetExp(y,i,1,r);pSetm(y,r);//var(i); for convenience 340 338 341 339 int k,m; … … 349 347 if (t==NULL) /* not computed yet */ 350 348 { 351 t=pCopy(MATELEM(cMT,k-1,1)); 352 t = pMultT2(y,t); 349 t=p_Copy(MATELEM(cMT,k-1,1),r); 350 // t = pMultT2(y,t); 351 t = nc_m_Mult_pp(y,t,,r); 353 352 MATELEM(cMT,k,1) = t; 354 353 } … … 363 362 if (t==NULL) //not computed yet 364 363 { 365 t=pCopy(MATELEM(cMT,a,m-1)); 366 t = pMultT(t,x); 364 t=p_Copy(MATELEM(cMT,a,m-1),r); 365 // t = pMultT(t,x); 366 t = nc_p_Mult_q(t,x,,r); 367 367 MATELEM(cMT,a,m) = t; 368 368 } 369 369 t=NULL; 370 370 } 371 p Delete(&x); pDelete(&y);371 p_Delete(&x,r); p_Delete(&y,r); 372 372 t=MATELEM(cMT,a,b); 373 return(p Copy(t)); /* as last computed element was cMT[a,b] */373 return(p_Copy(t,r)); /* as last computed element was cMT[a,b] */ 374 374 } 375 375 #endif -
Singular/gring.h
rf2e8412 r5f524e 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: gring.h,v 1. 1 2000-11-13 14:50:23 levandov Exp $ */6 /* $Id: gring.h,v 1.2 2000-11-20 16:02:03 levandov Exp $ */ 7 7 /* 8 8 * ABSTRACT additional defines etc for --with-plural … … 10 10 11 11 #ifdef HAVE_PLURAL 12 #include "polys.h" // do we need it really? 13 #include "p_Procs.h" 14 12 15 #define UPMATELEM(i,j) ( ((pVariables) * ((i)-1) - ((i) * ((i)-1))/2 + (j)-1)-(i) ) 13 16 // poly functions defined in p_Procs : 14 17 poly nc_pp_Mult_mm(poly p, poly m, poly spNoether, const ring r); 15 18 poly nc_p_Mult_mm(poly p, poly m, const ring r); 16 19 poly nc_p_Minus_mm_Mult_qq(poly p, poly m, poly q, 17 20 int &shorter, poly spNoether, const ring r); 21 // other routines we need in addition : 22 poly nc_m_Mult_pp(poly m, poly p, poly spNoether, const ring r); 23 poly nc_m_Mult_n(poly m, poly n, const ring r); 24 poly nc_mm_Mult_uu(poly p, poly m, const ring r); 25 poly nc_uu_Mult_ww(poly p, poly m, const ring r); 26 27 // #define nc_pp_Mult_mm(p, m, spNoether) nc_pp_Mult_mm(p, poly m, poly spNoether, const ring r) 18 28 19 29 #endif
Note: See TracChangeset
for help on using the changeset viewer.