Changeset f7920d7 in git
 Timestamp:
 Feb 16, 2002, 7:07:49 PM (21 years ago)
 Branches:
 (u'jengelhdatetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'f875bbaccd0831e36aaed09ff6adeb3eb45aeb94')
 Children:
 7656d7ef34fdb1322019e176e07b6cbc09bf3261
 Parents:
 b760e984c47d38e60c36e200c211040230bad496
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Singular/eigenval.cc
rb760e9 rf7920d7 2 2 * Computer Algebra System SINGULAR * 3 3 *****************************************/ 4 /* $Id: eigenval.cc,v 1. 7 20020216 13:49:03mschulze Exp $ */4 /* $Id: eigenval.cc,v 1.8 20020216 18:07:49 mschulze Exp $ */ 5 5 /* 6 6 * ABSTRACT: eigenvalues of constant square matrices … … 185 185 { 186 186 int n=MATROWS(M); 187 int i,j; 188 189 for(int k=1;k<n1;k++) 190 { 191 j=k+1; 192 while(j<n&&MATELEM(M,j,k)==0) 187 188 for(int k=1,j=2;k<n1;k++,j=k+1) 189 { 190 while(j<=n&&MATELEM(M,j,k)==0) 193 191 j++; 194 192 195 if( MATELEM(M,j,k)!=0)193 if(j<=n) 196 194 { 197 195 M=evSwap(M,j,k+1); 198 196 199 for(i =j+1;i<=n;i++)197 for(int i=j+1;i<=n;i++) 200 198 M=evRowElim(M,i,k+1,k); 201 199 } … … 233 231 return(l); 234 232 } 233 234 M=(matrix)idJet((ideal)M,0); 235 235 236 236 M=evHessenberg(M); … … 271 271 for(int i=0;i<IDELEMS(e0);i++) 272 272 { 273 number e1=nNeg(pGetCoeff(e0>m[i])); 274 pDeleteLm(&e0>m[i]); 275 if(pGetExp(e0>m[i],1)==0) 276 e>m[k]=pNSet(nDiv(pGetCoeff(e0>m[i]),e1)); 273 if(pNext(e0>m[i])==NULL) 274 { 275 (*m)[k]=(*m0)[i]; 276 k++; 277 } 277 278 else 278 e>m[k]=pNSet(nDiv(e1,pGetCoeff(e0>m[i]))); 279 nDelete(&e1); 280 (*m)[k]=(*m0)[i]; 281 k++; 279 if(pGetExp(e0>m[i],1)<2&&pGetExp(pNext(e0>m[i]),1)<2&& 280 pNext(pNext(e0>m[i]))==NULL) 281 { 282 number e1=nNeg(pGetCoeff(e0>m[i])); 283 if(pGetExp(pNext(e0>m[i]),1)==0) 284 e>m[k]=pNSet(nDiv(pGetCoeff(pNext(e0>m[i])),e1)); 285 else 286 e>m[k]=pNSet(nDiv(e1,pGetCoeff(pNext(e0>m[i])))); 287 nDelete(&e1); 288 (*m)[k]=(*m0)[i]; 289 k++; 290 } 291 else 292 { 293 e>m[k]=e0>m[i]; 294 e0>m[i]=NULL; 295 (*m)[k]=(*m0)[i]; 296 k++; 297 } 282 298 } 283 299 … … 290 306 idDelete((ideal *)&M); 291 307 292 for(int i=0;i<n1;i++) 293 { 294 if(e>m[i]!=NULL) 295 for(int j=i+1;j<n;j++) 296 { 297 if(e>m[j]!=NULL) 298 if(nEqual(pGetCoeff(e>m[i]),pGetCoeff(e>m[j]))) 299 { 300 (*m)[i]+=(*m)[j]; 301 (*m)[j]=0; 308 for(int i0=0;i0<n1;i0++) 309 { 310 for(int i1=i0+1;i1<n;i1++) 311 { 312 if(pEqualPolys(e>m[i0],e>m[i1])) 313 { 314 (*m)[i0]+=(*m)[i1]; 315 (*m)[i1]=0; 302 316 } 303 317 else 304 if(nGreater(pGetCoeff(e>m[i]),pGetCoeff(e>m[j]))) 305 { 306 poly p=e>m[i]; 307 e>m[i]=e>m[j]; 308 e>m[j]=p; 309 int k=(*m)[i]; 310 (*m)[i]=(*m)[j]; 311 (*m)[j]=k; 318 { 319 if(e>m[i0]==NULL&&!nGreaterZero(pGetCoeff(e>m[i1])) 320 e>m[i1]==NULL&& 321 (nGreaterZero(pGetCoeff(e>m[i0]))pNext(e>m[i0])!=NULL) 322 e>m[i0]!=NULL&&e>m[i1]!=NULL&& 323 (pNext(e>m[i0])!=NULL&&pNext(e>m[i1])==NULL 324 pNext(e>m[i0])==NULL&&pNext(e>m[i1])==NULL&& 325 nGreater(pGetCoeff(e>m[i0]),pGetCoeff(e>m[i1])))) 326 { 327 poly e1=e>m[i0]; 328 e>m[i0]=e>m[i1]; 329 e>m[i1]=e1; 330 int m1=(*m)[i0]; 331 (*m)[i0]=(*m)[i1]; 332 (*m)[i1]=m1; 333 } 312 334 } 313 335 }
Note: See TracChangeset
for help on using the changeset viewer.