Changeset d2fb562 in git for Singular/LIB
- Timestamp:
- Jan 12, 1999, 9:53:23 AM (25 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 8552c7ec6ef8b40263c2fe0ab9ce32c4c17d6654
- Parents:
- f9edcc229e151e8a6db292b78692694b5bcd3ad2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/jordan.lib
rf9edcc rd2fb562 1 1 /////////////////////////////////////////////////////////////////////////////// 2 2 3 version="$Id: jordan.lib,v 1. 4 1999-01-11 13:00:04mschulze Exp $";3 version="$Id: jordan.lib,v 1.5 1999-01-12 08:53:23 mschulze Exp $"; 4 4 info=" 5 5 LIBRARY: jordan.lib PROCEDURES TO COMPUTE THE JORDAN NORMAL FORM … … 7 7 email: mschulze@mathematik.uni-kl.de 8 8 9 jordan(M[,opt]); eigenvalues, jordan block sizes and jordan basis of 10 constant part of square matrix M 11 jordanmatrix(eb); jordan matrix with eigenvalues eb[1] and 12 jordan block sizes eb[2] 13 jordanform(M); jordan normal form of constant part of square matrix M 14 invmat(U); inverse matrix of constant part of matrix U 9 jordan(M[,opt]); eigenvalues and corresponding jordan block size vectors 10 of the constant part of the square matrix M and 11 a jordan basis for the constant part of M 12 jordanmatrix(eb); jordan matrix with eigenvalues eb[1] and corresponding 13 jordan block size vectors eb[2] 14 jordanform(M); jordan normal form of the constant part 15 of the square matrix M 16 invmat(U); inverse matrix of the invertible constant part 17 of the matrix U 15 18 "; 16 19 … … 19 22 20 23 proc jordan(matrix M,list #) 21 USAGE: <list> ret=jordan(<matrix> M[,<int> opt=0]); 22 ASSUME: characteristic polynomial of the constant part of M factorizable 23 RETURN: <ideal> ret[1] : eigenvalues of the constant part of M 24 <intvec> ret[2] : jordan block sizes of the constant part of M 25 if opt<2 26 <module> ret[3] : jordan basis for the constant part of M 27 if opt>0 24 USAGE: <list<ideal,list<intvec>,module>> ret=jordan(<matrix> M[,<int> opt=0]); 25 ASSUME: characteristic polynomial of the constant part of M completely 26 factorizable 27 RETURN: eigenvalues ret[1] and, if opt<2, corresponding jordan block 28 size vectors ret[2] of the constant part of M and, if opt>0, 29 a jordan basis ret[3] for the constant part of M 28 30 EXAMPLE: example jordan; shows an example 29 31 { 32 // test if square matrix 30 33 int n=nrows(M); 31 34 if(n!=ncols(M)) … … 35 38 } 36 39 40 // get constant part 37 41 def br=basering; 38 42 map zero=br,0; … … 40 44 kill zero; 41 45 46 // change to polynomial ring for factorization 42 47 changeord("pr","dp"); 43 48 matrix M=imap(br,M); 44 49 50 // factorize characteristic polynomial 45 51 list l=factorize(det(M-var(1)*freemodule(n)),2); 52 53 // get multiplicities mM 46 54 def eM,mM=l[1..2]; 47 55 kill l; 56 57 // test if factorization complete 48 58 int i; 49 59 for(i=size(eM);i>=1;i--) … … 57 67 } 58 68 69 // get eigenvalues eM 59 70 map inv=pr,-var(1); 60 71 eM=simplify(inv(eM),1); … … 64 75 kill pr; 65 76 77 // sort eigenvalues 66 78 int j; 67 79 poly e; … … 84 96 kill e,m; 85 97 98 // check option parameter 86 99 int opt=0; 87 100 if(size(#)>0) … … 93 106 } 94 107 108 // define needed variables 95 109 int k,l; 96 110 matrix E=freemodule(n); … … 98 112 module sNi; 99 113 list K; 100 101 114 if(opt>0) 102 115 { … … 110 123 } 111 124 125 // do the following for all eigenvalues eM[i] 112 126 for(i=ncols(eM);i>=1;i--) 113 127 { 114 128 Mi=M-eM[i]*E; 115 129 130 // compute kernels K of powers of Mi 116 131 K=list(module()); 117 132 for(Ni,sNi=Mi,0;size(sNi)<mM[i];Ni=Ni*Mi) … … 123 138 if(opt<2) 124 139 { 140 // compute jordan block size vector corresponding to eigenvalue eM[i] 125 141 bMi=0; 126 142 bMi[size(K[2])]=0; … … 137 153 if(opt>0) 138 154 { 155 // compute generating vectors for jordan basis vectors corresponding to 156 // eigenvalue eM[i] 139 157 if(size(K)>1) 140 158 { … … 147 165 K[j]=interred(reduce(K[j],std(K1))); 148 166 } 167 168 // compute jordan basis vectors corresponding to eigenvalue eM[i] from 169 // generating vectors 149 170 for(j=size(K);j>=2;j--) 150 171 { … … 162 183 } 163 184 185 // create return list 164 186 list ret=eM; 165 187 if(opt<2) … … 171 193 ret[3]=V; 172 194 } 195 173 196 return(ret); 174 197 } … … 186 209 proc jordanmatrix(list eb) 187 210 USAGE: <matrix> J=jordanmatrix(<list<ideal,list<intvec>> eb); 188 RETURN: <matrix> J : jordan matrix with eigenvalues eb[1] and189 jordan block sizes eb[2]211 RETURN: jordan matrix J with eigenvalues eb[1] and corresponding 212 jordan block size vectors eb[2] 190 213 EXAMPLE: example jordanmatrix; shows an example 191 214 { 215 // check parameters 192 216 if(size(eb)<2) 193 217 { … … 215 239 } 216 240 241 // get size of Jordan matrix 217 242 int i,j,k,n; 218 243 for(i=s;i>=1;i--) … … 220 245 if(typeof(bJ[i])!="intvec") 221 246 { 222 "//second entry in argument list not a list of int vectors";247 "//second entry in argument list not a list of intvecs"; 223 248 return(); 224 249 } … … 237 262 matrix J[n][n]; 238 263 264 // create Jordan matrix 239 265 int l; 240 266 for(i,l=1,1;i<=s;i++) … … 270 296 proc jordanform(matrix M) 271 297 USAGE: <matrix> J=jordanform(<matrix> M); 272 ASSUME: characteristic polynomial of the constant part of M factorizable 273 RETURN: <matrix> J : jordan normal form of the constant part of M 298 ASSUME: characteristic polynomial of the constant part of M completely 299 factorizable 300 RETURN: jordan normal form J of the constant part of M 274 301 EXAMPLE: example jordanform; shows an example 275 302 { … … 290 317 USAGE: <matrix> invU=invmat(<matrix> U); 291 318 ASSUME: constant part of U invertible 292 RETURN: <matrix> invU : inverse matrix ofconstant part of U319 RETURN: inverse matrix invU of the constant part of U 293 320 EXAMPLE: example invmat; shows an example 294 321 { 322 // test if square matrix 295 323 int n=nrows(U); 296 324 if(n!=ncols(U)) … … 300 328 } 301 329 330 // get constant part 302 331 def br=basering; 303 332 map zero=br,0; 304 333 U=zero(U); 305 334 335 // compute inverse 306 336 return(lift(U,freemodule(n))); 307 337 }
Note: See TracChangeset
for help on using the changeset viewer.