Changeset 337919 in git


Ignore:
Timestamp:
Jan 11, 2001, 6:13:00 PM (23 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
167e413179ab275fe34d1eb07187736261e4ec66
Parents:
2dd32e6b8afefafb14da9f8d5f5e44b849c103a4
Message:
*hannes: documentayions building works again


git-svn-id: file:///usr/local/Singular/svn/trunk@5051 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
Singular/LIB
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/gaussman.lib

    r2dd32e r337919  
    11///////////////////////////////////////////////////////////////////////////////
    2 version="$Id: gaussman.lib,v 1.24 2001-01-10 17:42:26 mschulze Exp $";
     2version="$Id: gaussman.lib,v 1.25 2001-01-11 17:12:58 Singular Exp $";
    33category="Singularities";
    44
     
    1818 gamma4(...);           Hertling's gamma4 invariant
    1919
    20 SEE ALSO: mondromy.lib, spectrum.lib, jordan.lib
     20SEE ALSO: mondromy_lib, spectrum_lib, jordan_lib
    2121
    2222KEYWORDS: singularities; Gauss-Manin connection; monodromy; spectrum;
     
    250250        intvec b;
    251251        for(i=ncols(e);i>=1;i--)
    252         {
     252        {
    253253          b[i]=sum(l[2][i]);
    254254        }
     
    774774             int l[2][i]: multiplicity of spectral number l[1][i]
    775775           list l[3]:
    776              module l[3][i]: vector space basis of the l[1][i]-th graded part 
     776             module l[3][i]: vector space basis of the l[1][i]-th graded part
    777777                             of the V-filtration on the Jacobian algebra
    778778                             in terms of l[4]
  • Singular/LIB/linalg.lib

    r2dd32e r337919  
    1 //GMG last modified: 04/25/2000 
    2 //////////////////////////////////////////////////////////////////////////////
    3 version="$Id: linalg.lib,v 1.9 2001-01-07 02:06:39 greuel Exp $";
     1//GMG last modified: 04/25/2000
     2//////////////////////////////////////////////////////////////////////////////
     3version="$Id: linalg.lib,v 1.10 2001-01-11 17:12:59 Singular Exp $";
    44category="Linear Algebra";
    55info="
    6 LIBRARY:  linalg.lib    Algorithmic Linear Algebra
     6LIBRARY:  linalg.lib        Algorithmic Linear Algebra
    77AUTHORS:  Ivor Saynisch (ivs@math.tu-cottbus.de)
    88@*        Mathias Schulze (mschulze@mathematik.uni-kl.de)
    99
    1010PROCEDURES:
    11  inverse(A);        matrix, the inverse of A
     11 inverse(A);            matrix, the inverse of A
    1212 inverse_B(A);      list(matrix Inv,poly p),Inv*A=p*En ( using busadj(A) )
    1313 inverse_L(A);      list(matrix Inv,poly p),Inv*A=p*En ( using lift )
     
    1616 diag_test(A);      test whether A can be diagnolized
    1717 busadj(A);         coefficients of Adj(E*t-A) and coefficients of det(E*t-A)
    18  charpoly(A,v);     characteristic polynomial of A ( using busadj(A) ) 
     18 charpoly(A,v);     characteristic polynomial of A ( using busadj(A) )
    1919 adjoint(A);        adjoint of A ( using busadj(A) )
    2020 det_B(A);          determinant of A ( using busadj(A) )
     
    6161  kill @R;
    6262  setring BR;
    63   return(1); 
     63  return(1);
    6464}
    6565//////////////////////////////////////////////////////////////////////////////
     
    7070RETURN:   matrix
    7171"
    72 {       
     72{
    7373  module m=module(A);
    74  
     74
    7575  if(A[i,i]==0){
    7676    m[i]=m[i]+m[j];
     
    7979    m=module(transpose(matrix(m)));
    8080  }
    81  
     81
    8282  A=matrix(m);
    8383  m[j]=m[j]-(A[i,j]/A[i,i])*m[i];
     
    8585  m[j]=m[j]-(A[i,j]/A[i,i])*m[i];
    8686  m=module(transpose(matrix(m)));
    87  
     87
    8888  return(matrix(m));
    8989}
     
    9494{
    9595  int k;
    96   if (nrows(v2)>nrows(v1)) { k=nrows(v2); } else { k=nrows(v1); } 
     96  if (nrows(v2)>nrows(v1)) { k=nrows(v2); } else { k=nrows(v1); }
    9797  return ((transpose(matrix(v1,k,1))*matrix(v2,k,1))[1,1]);
    9898}
     
    104104proc inverse(matrix A, list #)
    105105"USAGE:    inverse(A [,opt]);  A a square matrix, opt integer
    106 RETURN: 
    107 @format   
     106RETURN:
     107@format
    108108          a matrix:
    109109          - the inverse matrix of A, if A is invertible;
    110110          - the 1x1 0-matrix if A is not invertible (in the polynomial ring!).
    111111          There are the following options:
    112           - opt=0 or not given: heuristically best option from below 
     112          - opt=0 or not given: heuristically best option from below
    113113          - opt=1 : apply std to (transpose(E,A)), ordering (C,dp).
    114114          - opt=2 : apply interred (transpose(E,A)), ordering (C,dp).
    115           - opt=3 : apply lift(A,E), ordering (C,dp). 
     115          - opt=3 : apply lift(A,E), ordering (C,dp).
    116116@end format
    117117NOTE:     parameters and minpoly are allowed; opt=2 is only correct for
     
    123123//--------------------------- initialization and check ------------------------
    124124   int ii,u,i,opt;
    125    matrix invA;                     
     125   matrix invA;
    126126   int db = printlevel-voice+3;      //used for comments
    127127   def R=basering;
     
    149149         {opt = 1;}
    150150         else
    151          {opt = 1;}                         
     151         {opt = 1;}
    152152      }
    153153      else {opt = 1;}
     
    177177   if( opt==1 or opt==2 )
    178178   {
    179       option(redSB); 
     179      option(redSB);
    180180      module B = freemodule(n),M;
    181181      if(opt == 2)
     
    186186      if(opt == 1)
    187187      {
    188          module D = std(transpose(B)); 
     188         module D = std(transpose(B));
    189189         D = transpose(simplify(D,1));
    190190      }
     
    192192      module D1 = D[n+1..2*n];
    193193//----------------------- check if matrix is invertible ----------------------
    194       for (ii=1; ii<=n; ii++) 
    195       { 
     194      for (ii=1; ii<=n; ii++)
     195      {
    196196         if ( D1[ii] != gen(ii) )
    197197         {
     
    225225  print(inverse(A));"";
    226226  matrix B[3][3]=
    227    y+1,  x+y,    y,   
    228    z,    z+1,    z,   
     227   y+1,  x+y,    y,
     228   z,    z+1,    z,
    229229   y+z+2,x+y+z+2,y+z+1;
    230230  print(inverse(B));
     
    244244    "// ** input is not a square matrix";;
    245245    return(A);
    246   } 
    247  
     246  }
     247
    248248  if(!const_mat(A)){
    249249    "// ** input is not a constant matrix";
    250250    return(A);
    251251  }
    252  
    253   if(deg(std(A-transpose(A))[1])!=-1){ 
     252
     253  if(deg(std(A-transpose(A))[1])!=-1){
    254254    "// ** input is not a symmetric matrix";
    255255    return(A);
     
    261261    }
    262262  }
    263  
     263
    264264  return(A);
    265265}
     
    273273
    274274//////////////////////////////////////////////////////////////////////////////
    275 proc orthogonalize(matrix A) 
     275proc orthogonalize(matrix A)
    276276"USAGE:    orthogonalize(A); A = constant matrix
    277277RETURN:    matrix, orthogonal basis of the colum space of A
     
    286286    matrix B;
    287287    return(B);
    288   } 
     288  }
    289289
    290290  module B=module(interred(A));
    291  
     291
    292292  for(i=1;i<=n;i=i+1) {
    293293    for(j=1;j<i;j=j+1) {
     
    297297    }
    298298  }
    299  
     299
    300300  return(matrix(B));
    301301}
     
    310310////////////////////////////////////////////////////////////////////////////
    311311proc diag_test(matrix A)
    312 "USAGE:   diag_test(A); A = const square matrix
     312"USAGE:          diag_test(A); A = const square matrix
    313313RETURN:   int,  1 if A is diagonalisable, 0 if not
    314314               -1 no statement is possible, since A does not split.
     
    319319{
    320320  int i,j;
    321   int n     = nrows(A); 
     321  int n     = nrows(A);
    322322  string mp = string(minpoly);
    323323  string cs = charstr(basering);
    324324  int np=0;
    325325
    326   if(ncols(A) != n) { 
     326  if(ncols(A) != n) {
    327327    "// input is not a square matrix";
    328328    return(-1);
    329   }             
     329  }
    330330
    331331   if(!const_mat(A)){
    332332    "// input is not a constant matrix";
    333333    return(-1);
    334   } 
     334  }
    335335
    336336  //Parameterring wegen factorize nicht erlaubt
     
    339339  }
    340340  if(np>0){
    341         "// rings with parameters not allowed";
    342         return(-1);
    343   }
    344 
    345   //speichern des aktuellen Rings 
     341        "// rings with parameters not allowed";
     342        return(-1);
     343  }
     344
     345  //speichern des aktuellen Rings
    346346  def BR=basering;
    347347  //setze R[t]
    348348  execute("ring rt=("+charstr(basering)+"),(@t,"+varstr(basering)+"),lp;");
    349349  execute("minpoly="+mp+";");
    350   matrix A=imap(BR,A); 
     350  matrix A=imap(BR,A);
    351351
    352352  intvec z;
    353353  intvec s;
    354   poly X;         //characteristisches Polynom 
     354  poly X;         //characteristisches Polynom
    355355  poly dXdt;      //Ableitung von X nach t
    356   ideal g;            //ggT(X,dXdt)
    357   poly b;             //Komponente der Busadjunkten-Matrix
     356  ideal g;              //ggT(X,dXdt)
     357  poly b;              //Komponente der Busadjunkten-Matrix
    358358  matrix E[n][n]; //Einheitsmatrix
    359        
     359
    360360  E=E+1;
    361361  A=E*@t-A;
    362362  X=det(A);
    363363
    364   matrix Xfactors=matrix(factorize(X,1));       //zerfaellt die Matrtix ?
     364  matrix Xfactors=matrix(factorize(X,1));        //zerfaellt die Matrtix ?
    365365  int nf=ncols(Xfactors);
    366366
     
    371371      return(-1);
    372372    }
    373   }     
     373  }
    374374
    375375  dXdt=diff(X,@t);
     
    377377
    378378  //Busadjunkte
    379   z=2..n;       
     379  z=2..n;
    380380  for(i=1;i<=n;i++){
    381     s=2..n; 
     381    s=2..n;
    382382    for(j=1;j<=n;j++){
    383383      b=det(submat(A,z,s));
    384    
     384
    385385      if(0!=reduce(b,g)){
    386         //" matrix not diagonalizable";
    387         setring BR;
    388         return(0);
    389       }
    390      
     386        //" matrix not diagonalizable";
     387        setring BR;
     388        return(0);
     389      }
     390
    391391      s[j]=j;
    392392    }
    393393    z[i]=i;
    394394  }
    395  
    396   //"Die Matrix ist diagonalisierbar";         
     395
     396  //"Die Matrix ist diagonalisierbar";
    397397  setring BR;
    398398  return(1);
     
    410410"USAGE:   busadj(A);  A = square matrix (of size nxn)
    411411RETURN:  list L:
    412 @format 
    413          L[1] contains the (n+1) coefficients of the characteristic 
     412@format
     413         L[1] contains the (n+1) coefficients of the characteristic
    414414              polynomial X of A, i.e.
    415415              X = L[1][1]+..+L[1][k]*t^(k-1)+..+(L[1][n+1])*t^n
    416416         L[2] contains the n (nxn)-matrices Hk which are the coefficients of
    417417              the busadjoint bA = adjoint(E*t-A) of A, i.e.
    418               bA = (Hn-1)*t^(n-1)+...+Hk*t^k+...+H0,  ( Hk=L[2][k+1] ) 
     418              bA = (Hn-1)*t^(n-1)+...+Hk*t^k+...+H0,  ( Hk=L[2][k+1] )
    419419@end format
    420420EXAMPLE: example busadj; shows an example"
     
    428428  poly a;
    429429
    430   if(ncols(A) != n) { 
     430  if(ncols(A) != n) {
    431431    "input is not a square matrix";
    432432    return(L);
    433   }     
     433  }
    434434
    435435  bA   = E;
     
    457457  list L = busadj(A);
    458458  poly X = L[1][1]+L[1][2]*t+L[1][3]*t2; X;
    459   matrix bA[2][2] = L[2][1]+L[2][2]*t; 
     459  matrix bA[2][2] = L[2][1]+L[2][2]*t;
    460460  print(bA);               //the busadjoint of A;
    461   print(bA*(t*unitmat(2)-A)); 
     461  print(bA*(t*unitmat(2)-A));
    462462}
    463463
     
    465465proc charpoly(matrix A, list #)
    466466"USAGE:   charpoly(A[,v]); A square matrix, v string, name of a variable
    467 RETURN:  poly, the characteristic polynomial det(E*v-A) 
     467RETURN:  poly, the characteristic polynomial det(E*v-A)
    468468         (default: v=name of last variable)
    469469NOTE:    A must be independent of the variable v. The computation uses det.
     
    477477  poly X;
    478478  if(ncols(A) != n)
    479   {     
     479  {
    480480    "// input is not a square matrix";
    481481    return(X);
    482   }     
     482  }
    483483  //---------------------- test for correct variable -------------------------
    484   if( size(#)==0 ){ 
    485     #[1] = varstr(z); 
     484  if( size(#)==0 ){
     485    #[1] = varstr(z);
    486486  }
    487487  if( typeof(#[1]) == "string") { v = #[1]; }
     
    490490    "// 2nd argument must be a name of a variable not contained in the matrix";
    491491    return(X);
    492   } 
     492  }
    493493  j=-1;
    494494  for(i=1; i<=z; i++)
     
    536536  string mp = string(minpoly);
    537537
    538   if(ncols(A) != n){   
     538  if(ncols(A) != n){
    539539    "// input is not a square matrix";
    540540    return(X);
    541   }     
     541  }
    542542
    543543  //test for correct variable
    544   if( size(#)==0 ){ 
    545     #[1] = varstr(nvars(BR)); 
     544  if( size(#)==0 ){
     545    #[1] = varstr(nvars(BR));
    546546  }
    547547  if( typeof(#[1]) == "string"){
     
    551551    "// 2nd argument must be a name of a variable not contained in the matrix";
    552552    return(X);
    553   } 
    554        
     553  }
     554
    555555  j=-1;
    556556  for(i=1; i<=nvars(BR); i++){
     
    561561    return(X);
    562562  }
    563  
     563
    564564  //var can not be in A
    565565  s="Wp(";
     
    590590    execute("X=X+L[1][i]*"+v+"^"+string(i-1)+";");
    591591  }
    592  
    593   return(X); 
     592
     593  return(X);
    594594}
    595595example
     
    612612  list L;
    613613
    614   if(ncols(A) != n) {   
     614  if(ncols(A) != n) {
    615615    "// input is not a square matrix";
    616616    return(Adj);
    617   }     
    618  
     617  }
     618
    619619  L  = busadj(A);
    620620  Adj= (-1)^(n-1)*L[2][1];
    621621  return(Adj);
    622  
     622
    623623}
    624624example
     
    636636"USAGE:    inverse_B(A);  A = square matrix
    637637RETURN:   list Inv with
    638           - Inv[1] = matrix I and 
    639           - Inv[2] = poly p 
    640           such that I*A = unitmat(n)*p; 
     638          - Inv[1] = matrix I and
     639          - Inv[2] = poly p
     640          such that I*A = unitmat(n)*p;
    641641NOTE:     p=1 if 1/det(A) is computable and  p=det(A) if not;
    642642          the computation uses busadj.
     
    650650  list L;
    651651  list Inv;
    652  
    653   if(ncols(A) != n) {   
     652
     653  if(ncols(A) != n) {
    654654    "input is not a square matrix";
    655655    return(I);
    656   }     
    657  
     656  }
     657
    658658  L=busadj(A);
    659   I=module(-L[2][1]);        //+-Adj(A)   
    660 
    661   if(reduce(1,std(L[1][1]))==0){ 
    662     I=I*lift(L[1][1],1)[1][1];     
     659  I=module(-L[2][1]);        //+-Adj(A)
     660
     661  if(reduce(1,std(L[1][1]))==0){
     662    I=I*lift(L[1][1],1)[1][1];
    663663    factor=1;
    664664  }
     
    682682//////////////////////////////////////////////////////////////////////////////
    683683proc det_B(matrix A)
    684 "USAGE:     det_B(A);  A any matrix 
     684"USAGE:     det_B(A);  A any matrix
    685685RETURN:    returns the determinant of A
    686686NOTE:      the computation uses the busadj algorithm
    687687EXAMPLE:   example det_B; shows an example"
    688688{
    689   int n=nrows(A); 
     689  int n=nrows(A);
    690690  list L;
    691691
     
    696696}
    697697example
    698 { "EXAMPLE"; echo=2; 
     698{ "EXAMPLE"; echo=2;
    699699  ring r=0,(x),dp;
    700700  matrix A[10][10]=random(2,10,10)+unitmat(10)*x;
    701701  print(A);
    702   det_B(A); 
     702  det_B(A);
    703703}
    704704
     
    707707"USAGE:     inverse_L(A);  A = square matrix
    708708RETURN:    list Inv representing a left inverse of A, i.e
    709            - Inv[1] = matrix I and 
     709           - Inv[1] = matrix I and
    710710           - Inv[2] = poly p
    711            such that I*A = unitmat(n)*p; 
     711           such that I*A = unitmat(n)*p;
    712712NOTE:      p=1 if 1/det(A) is computable and p=det(A) if not;
    713713           the computation computes first det(A) and then uses lift
    714 SEE ALSO:  inverse, inverse_B_
     714SEE ALSO:  inverse, inverse_B
    715715EXAMPLE:   example inverse_L; shows an example"
    716716{
     
    735735  // test if 1/det(A) exists
    736736  if(reduce(1,std(d))!=0){ E=E*d;}
    737  
     737
    738738  I=lift(A,E);
    739   if(I==unitmat(n)-unitmat(n)){ //catch error in lift 
     739  if(I==unitmat(n)-unitmat(n)){ //catch error in lift
    740740    "// matrix is not invertible";
    741741    return(Inv);
     
    745745  Inv=insert(Inv,factor);
    746746  Inv=insert(Inv,I);
    747  
     747
    748748  return(Inv);
    749749}
     
    761761//////////////////////////////////////////////////////////////////////////////
    762762proc gaussred(matrix A)
    763 "USAGE:   gaussred(A);   A any constant matrix 
     763"USAGE:   gaussred(A);   A any constant matrix
    764764RETURN:  list Z:  Z[1]=P , Z[2]=U , Z[3]=S , Z[4]=rank(A)
    765765         gives a row reduced matrix S, a permutation matrix P and a
    766          normalized lower triangular matrix U, with P*A=U*S   
     766         normalized lower triangular matrix U, with P*A=U*S
    767767NOTE:    This procedure is designed for teaching purposes mainly.
    768          The straight forward implementation in the interpreted library 
    769          is not very efficient (no standard basis computation).         
     768         The straight forward implementation in the interpreted library
     769         is not very efficient (no standard basis computation).
    770770EXAMPLE: example gaussred; shows an example"
    771771{
     
    787787
    788788  for(i=1;i<=mr;i=i+1){
    789     if((i+k)>m){break}; 
    790    
     789    if((i+k)>m){break};
     790
    791791    //Test: Diagonalelement=0
    792792    if(A[i,i+k]==0){
    793793      jp=i;pivo=0;
    794794      for(j=i+1;j<=n;j=j+1){
    795         c=abs(A[j,i+k]);
    796         if(pivo<c){ pivo=c;jp=j;}
     795        c=abs(A[j,i+k]);
     796        if(pivo<c){ pivo=c;jp=j;}
    797797      }
    798798      if(jp != i){       //Zeilentausch
    799         for(j=1;j<=m;j=j+1){ //Zeilentausch in A (und U) (i-te mit jp-ter)
    800           c=A[i,j];         
    801           A[i,j]=A[jp,j];
    802           A[jp,j]=c;
    803         }
    804         for(j=1;j<=n;j=j+1){ //Zeilentausch in P
    805           c=P[i,j];       
    806           P[i,j]=P[jp,j];
    807           P[jp,j]=c; 
    808         }
     799        for(j=1;j<=m;j=j+1){ //Zeilentausch in A (und U) (i-te mit jp-ter)
     800          c=A[i,j];
     801          A[i,j]=A[jp,j];
     802          A[jp,j]=c;
     803        }
     804        for(j=1;j<=n;j=j+1){ //Zeilentausch in P
     805          c=P[i,j];
     806          P[i,j]=P[jp,j];
     807          P[jp,j]=c;
     808        }
    809809      }
    810810      if(pivo==0){k++;continue;} //eine von selbst auftauchende Stufe !
    811811    }                          //i sollte im naechsten Lauf nicht erhoeht sein
    812    
    813     //Eliminationsschritt   
    814     for(j=i+1;j<=n;j=j+1){ 
     812
     813    //Eliminationsschritt
     814    for(j=i+1;j<=n;j=j+1){
    815815      c=A[j,i+k]/A[i,i+k];
    816816      for(l=i+k+1;l<=m;l=l+1){
    817         A[j,l]=A[j,l]-A[i,l]*c;
     817        A[j,l]=A[j,l]-A[i,l]*c;
    818818      }
    819819      A[j,i+k]=0;  // nur wichtig falls k>0 ist
    820820      A[j,i]=c;    // bildet U
    821821    }
    822   rang=i;   
    823   }
    824  
     822  rang=i;
     823  }
     824
    825825  for(i=1;i<=mr;i=i+1){
    826826    for(j=i+1;j<=n;j=j+1){
     
    829829    }
    830830  }
    831  
     831
    832832  Z=insert(Z,rang);
    833833  Z=insert(Z,A);
    834834  Z=insert(Z,U);
    835835  Z=insert(Z,P);
    836  
     836
    837837  return(Z);
    838838}
     
    857857           gives n row reduced matrix S, a permutation matrix P and a
    858858           normalized lower triangular matrix U, with P*A=U*S
    859 NOTE:      with row pivoting           
     859NOTE:      with row pivoting
    860860EXAMPLE:   example gaussred_pivot; shows an example"
    861861{
     
    877877
    878878  for(i=1;i<=mr;i=i+1){
    879     if((i+k)>m){break}; 
    880    
     879    if((i+k)>m){break};
     880
    881881    //Pivotisierung
    882882    pivo=abs(A[i,i+k]);jp=i;
     
    887887    if(jp != i){ //Zeilentausch
    888888      for(j=1;j<=m;j=j+1){ //Zeilentausch in A (und U) (i-te mit jp-ter)
    889         c=A[i,j];         
    890         A[i,j]=A[jp,j];
    891         A[jp,j]=c;
     889        c=A[i,j];
     890        A[i,j]=A[jp,j];
     891        A[jp,j]=c;
    892892      }
    893893      for(j=1;j<=n;j=j+1){ //Zeilentausch in P
    894         c=P[i,j];       
    895         P[i,j]=P[jp,j];
    896         P[jp,j]=c; 
     894        c=P[i,j];
     895        P[i,j]=P[jp,j];
     896        P[jp,j]=c;
    897897      }
    898898    }
    899899    if(pivo==0){k++;continue;} //eine von selbst auftauchende Stufe !
    900900                               //i sollte im naechsten Lauf nicht erhoeht sein
    901     //Eliminationsschritt   
    902     for(j=i+1;j<=n;j=j+1){ 
     901    //Eliminationsschritt
     902    for(j=i+1;j<=n;j=j+1){
    903903      c=A[j,i+k]/A[i,i+k];
    904904      for(l=i+k+1;l<=m;l=l+1){
    905         A[j,l]=A[j,l]-A[i,l]*c;
     905        A[j,l]=A[j,l]-A[i,l]*c;
    906906      }
    907907      A[j,i+k]=0;  // nur wichtig falls k>0 ist
    908908      A[j,i]=c;    // bildet U
    909909    }
    910   rang=i;   
    911   }
    912  
     910  rang=i;
     911  }
     912
    913913  for(i=1;i<=mr;i=i+1){
    914914    for(j=i+1;j<=n;j=j+1){
     
    917917    }
    918918  }
    919  
     919
    920920  Z=insert(Z,rang);
    921921  Z=insert(Z,A);
    922922  Z=insert(Z,U);
    923923  Z=insert(Z,P);
    924  
     924
    925925  return(Z);
    926926}
     
    966966proc mat_rk(matrix A)
    967967"USAGE:    mat_rk(A); A any constant matrix
    968 RETURN:   int, rank of A 
     968RETURN:   int, rank of A
    969969EXAMPLE:  example mat_rk; shows an example"
    970970{
     
    988988"USAGE:     U_D_O(A);   constant invertible matrix A
    989989RETURN:    list Z:  Z[1]=P , Z[2]=U , Z[3]=D , Z[4]=O
    990            gives a permutation matrix P, 
     990           gives a permutation matrix P,
    991991           a normalized lower triangular matrix U ,
    992            a diagonal matrix D, and 
     992           a diagonal matrix D, and
    993993           a normalized upper triangular matrix O
    994994           with P*A=U*D*O
     
    10101010    return(Z);
    10111011  }
    1012  
     1012
    10131013  L=gaussred(A);
    10141014
    10151015  if(L[4]!=n){
    10161016    "// input is not an invertible matrix";
    1017     Z=insert(Z,-1);  //hint for calling procedures 
     1017    Z=insert(Z,-1);  //hint for calling procedures
    10181018    return(Z);
    10191019  }
     
    10371037{ "EXAMPLE";echo=2;
    10381038  ring r = 0,(x),dp;
    1039   matrix A[5][5] = 10, 4,  0, -9,  8, 
    1040                    -3, 6, -6, -4,  9, 
     1039  matrix A[5][5] = 10, 4,  0, -9,  8,
     1040                   -3, 6, -6, -4,  9,
    10411041                    0, 3, -1, -9, -8,
    10421042                   -4,-2, -6, -10,10,
    10431043                   -9, 5, -1, -6,  5;
    1044   list Z = U_D_O(A);              //construct P,U,D,O s.t. P*A=U*D*O 
     1044  list Z = U_D_O(A);              //construct P,U,D,O s.t. P*A=U*D*O
    10451045  print(Z[1]);                    //P
    10461046  print(Z[2]);                    //U
     
    10531053//////////////////////////////////////////////////////////////////////////////
    10541054proc pos_def(matrix A)
    1055 "USAGE:     pos_def(A); A = constant, symmetric square matrix       
    1056 RETURN:    int: 
    1057            1  if A is positive definit , 
    1058            0  if not, 
    1059            -1 if unknown 
     1055"USAGE:     pos_def(A); A = constant, symmetric square matrix
     1056RETURN:    int:
     1057           1  if A is positive definit ,
     1058           0  if not,
     1059           -1 if unknown
    10601060EXAMPLE:   example pos_def; shows an example"
    10611061{
     
    10721072    "// input is not a constant matrix";
    10731073    return(-1);
    1074   }     
    1075   if(deg(std(A-transpose(A))[1])!=-1){ 
     1074  }
     1075  if(deg(std(A-transpose(A))[1])!=-1){
    10761076    "// input is not a hermitian (symmetric) matrix";
    10771077    return(-1);
    10781078  }
    1079  
     1079
    10801080  Z=U_D_O(A);
    10811081
     
    10851085
    10861086  H=Z[1];
    1087   //es fand Zeilentausch statt: also nicht positiv definit 
     1087  //es fand Zeilentausch statt: also nicht positiv definit
    10881088  if(deg(std(H-unitmat(n))[1])!=-1){
    10891089    return(0);
    10901090  }
    1091  
     1091
    10921092  H=Z[3];
    1093  
     1093
    10941094  for(j=1;j<=n;j=j+1){
    1095     if(H[j,j]<=0){ 
     1095    if(H[j,j]<=0){
    10961096      return(0);
    10971097    } //eigenvalue<=0, not pos.definit
     
    11051105  matrix A[5][5] = 20,  4,  0, -9,   8,
    11061106                    4, 12, -6, -4,   9,
    1107                     0, -6, -2, -9,  -8, 
    1108                    -9, -4, -9, -20, 10, 
     1107                    0, -6, -2, -9,  -8,
     1108                   -9, -4, -9, -20, 10,
    11091109                    8,  9, -8,  10, 10;
    11101110  pos_def(A);
     
    11181118proc linsolve(matrix A, matrix b)
    11191119"USAGE:     linsolve(A,b); A a constant nxm-matrix, b a constant nx1-matrix
    1120 RETURN:    a 1xm matrix X, solution of inhomogeneous linear system A*X = b 
     1120RETURN:    a 1xm matrix X, solution of inhomogeneous linear system A*X = b
    11211121           return the 0-matrix if system is not solvable
    11221122NOTE:      uses gaussred
     
    11311131  matrix Ab[n][m+1];
    11321132  matrix X[m][1];
    1133        
     1133
    11341134  if(ncols(b)!=1){
    11351135    "// right hand side b is not a nx1 matrix";
     
    11401140    "// input hand is not a constant matrix";
    11411141    return(X);
    1142   }     
    1143  
     1142  }
     1143
    11441144  if(n_b>n){
    11451145    for(i=n; i<=n_b; i++){
    11461146      if(b[i,1]!=0){
    1147         "// right hand side b not in Image(A)";
    1148         return X;
    1149       }
    1150     }   
    1151   }
    1152  
    1153   if(n_b<n){ 
     1147        "// right hand side b not in Image(A)";
     1148        return X;
     1149      }
     1150    }
     1151  }
     1152
     1153  if(n_b<n){
    11541154    matrix copy[n_b][1]=b;
    11551155    matrix b[n][1]=0;
     
    11581158    }
    11591159  }
    1160  
     1160
    11611161  r=mat_rk(A);
    1162        
     1162
    11631163  //1. b constant vector
    1164   if(const_mat(b)){     
     1164  if(const_mat(b)){
    11651165    //extend A with b
    11661166    for(i=1; i<=n; i++){
     
    11701170      Ab[i,m+1]=b[i,1];
    11711171    }
    1172      
     1172
    11731173    //Gauss reduction
    11741174    Z  = gaussred(Ab);
    11751175    Ab = Z[3];  //normal form
    1176     rc = Z[4];  //rank(Ab) 
     1176    rc = Z[4];  //rank(Ab)
    11771177    //print(Ab);
    11781178
    11791179    if(r<rc){
    1180         "// no solution";
    1181         return(X); 
    1182     }
    1183     k=m;       
     1180        "// no solution";
     1181        return(X);
     1182    }
     1183    k=m;
    11841184    for(i=r;i>=1;i=i-1){
    1185      
    1186       j=1;     
    1187       while(Ab[i,j]==0){j=j+1;}// suche Ecke 
    1188    
     1185
     1186      j=1;
     1187      while(Ab[i,j]==0){j=j+1;}// suche Ecke
     1188
    11891189      for(;k>j;k=k-1){ X[k]=0;}//springe zur Ecke
    1190      
     1190
    11911191
    11921192      c=Ab[i,m+1]; //i-te Komponene von b
    11931193      for(j=m;j>k;j=j-1){
    1194         c=c-X[j,1]*Ab[i,j];
     1194        c=c-X[j,1]*Ab[i,j];
    11951195      }
    11961196      if(Ab[i,k]==0){
    1197         X[k,1]=1; //willkuerlich
    1198       }
    1199       else{ 
    1200         X[k,1]=c/Ab[i,k];
     1197        X[k,1]=1; //willkuerlich
     1198      }
     1199      else{
     1200          X[k,1]=c/Ab[i,k];
    12011201      }
    12021202      k=k-1;
    12031203      if(k==0){break;}
    12041204    }
    1205    
    1206    
     1205
     1206
    12071207  }//endif (const b)
    12081208  else{  //b not constant
    12091209    "// !not implemented!";
    1210  
     1210
    12111211  }
    12121212
     
    12171217  ring r=0,(x),dp;
    12181218  matrix A[3][2] = -4,-6,
    1219                     2, 3, 
     1219                    2, 3,
    12201220                   -5, 7;
    12211221  matrix b[3][1] = 10,
     
    12771277ASSUME:  The eigenvalues of M are in the coefficient field.
    12781278RETURN:  The procedure returns a list jd with 3 entries:
    1279 @format       
     1279@format
    12801280         - jd[1] ideal, eigenvalues of M,
    1281          - jd[2] list of intvecs, jd[2][i][j] size of j-th Jordan block with 
     1281         - jd[2] list of intvecs, jd[2][i][j] size of j-th Jordan block with
    12821282           eigenvalue jd[1][i], and
    12831283         - jd[3] a matrix, jd[3]^(-1)*M*jd[3] in Jordan normal form.
     
    17451745system("--random", 12345678);
    17461746int n = 70;
    1747 matrix m = sparsemat(n,n,50,100);     
     1747matrix m = sparsemat(n,n,50,100);
    17481748option(prot,mem);
    17491749
    17501750int t=timer;
    1751 matrix im = inverse(m,1)[1]; 
     1751matrix im = inverse(m,1)[1];
    17521752timer-t;
    17531753print(im*m);
    1754 //list l0 = watchdog(100,"inverse("+"m"+",3)");   
     1754//list l0 = watchdog(100,"inverse("+"m"+",3)");
    17551755//bricht bei 100 sec ab und gibt l0[1]: string Killed zurueck
    17561756
    1757 //inverse(m,1): std       5sec 5,5 MB 
     1757//inverse(m,1): std       5sec 5,5 MB
    17581758//inverse(m,2): interred  12sec
    17591759//inverse(m,2): lift      nach 180 sec 13MB abgebrochen
    17601760//n=60: linalgorig: 3  linalg: 5
    1761 //n=70: linalgorig: 6,7 linalg: 11,12 
    1762 // aber linalgorig rechnet falsch! 
     1761//n=70: linalgorig: 6,7 linalg: 11,12
     1762// aber linalgorig rechnet falsch!
    17631763
    176417642. Sparse poly Matrizen
     
    17711771
    17721772int t=timer;
    1773 matrix im = inverse(m); 
     1773matrix im = inverse(m);
    17741774timer-t;
    17751775print(im*m);
     
    17901790
    17911791int t=timer;
    1792 matrix im = inverse(m); 
     1792matrix im = inverse(m);
    17931793timer-t;
    17941794print(im*m);
     
    18071807
    18081808int t=timer;
    1809 matrix im = inverse(m,3); 
     1809matrix im = inverse(m,3);
    18101810timer-t;
    18111811print(im*m);
     
    18181818int n =3;
    18191819ring r= 0,(x,y,z),(C,dp);
    1820 matrix A=triagmatrix(n,n,1,0,0,50,2);   
    1821 intmat B=sparsetriag(n,n,20,1);         
     1820matrix A=triagmatrix(n,n,1,0,0,50,2);
     1821intmat B=sparsetriag(n,n,20,1);
    18221822matrix M = A*transpose(B);
    18231823M=M*transpose(M);
     
    18351835//eifacheres Gegenbeispiel:
    18361836matrix M =
    1837 9yz+3y+3z+2,             9y2+6y+1,           
     18379yz+3y+3z+2,             9y2+6y+1,
    183818389xyz+3xy+3xz-9z2+2x-6z-1,9xy2+6xy-9yz+x-3y-3z
    18391839//det M=1, inverse(M,2); ->// ** matrix is not invertible
     
    184218425. charpoly:
    18431843-----------
    1844 //ring rp=(0,A,B,C),(x),dp; 
    1845 ring r=0,(A,B,C,x),dp;     
     1844//ring rp=(0,A,B,C),(x),dp;
     1845ring r=0,(A,B,C,x),dp;
    18461846matrix m[12][12]=
    1847 AC,BC,-3BC,0,-A2+B2,-3AC+1,B2,   B2,  1,   0, -C2+1,0, 
    1848 1, 1, 2C,  0,0,     B,     -A,   -4C, 2A+1,0, 0,    0, 
    1849 0, 0, 0,   1,0,     2C+1,  -4C+1,-A,  B+1, 0, B+1,  3B, 
     1847AC,BC,-3BC,0,-A2+B2,-3AC+1,B2,   B2,  1,   0, -C2+1,0,
     18481, 1, 2C,  0,0,     B,     -A,   -4C, 2A+1,0, 0,    0,
     18490, 0, 0,   1,0,     2C+1,  -4C+1,-A,  B+1, 0, B+1,  3B,
    18501850AB,B2,0,   1,0,     1,     0,    1,   A,   0, 1,    B+1,
    1851 1, 0, 1,   0,0,     1,     0,    -C2, 0,   1, 0,    1, 
    1852 0, 0, 2,   1,2A,    1,     0,    0,   0,   0, 1,    1, 
    1853 0, 1, 0,   1,1,     2,     A,    3B+1,1,   B2,1,    1, 
    1854 0, 1, 0,   1,1,     1,     1,    1,   2,   0, 0,    0, 
    1855 1, 0, 1,   0,0,     0,     1,    0,   1,   1, 0,    3, 
    1856 1, 3B,B2+1,0,0,     1,     0,    1,   0,   0, 1,    0, 
    1857 0, 0, 1,   0,0,     0,     0,    1,   0,   0, 0,    0, 
    1858 0, 1, 0,   1,1,     3,     3B+1, 0,   1,   1, 1,    0; 
     18511, 0, 1,   0,0,     1,     0,    -C2, 0,   1, 0,    1,
     18520, 0, 2,   1,2A,    1,     0,    0,   0,   0, 1,    1,
     18530, 1, 0,   1,1,     2,     A,    3B+1,1,   B2,1,    1,
     18540, 1, 0,   1,1,     1,     1,    1,   2,   0, 0,    0,
     18551, 0, 1,   0,0,     0,     1,    0,   1,   1, 0,    3,
     18561, 3B,B2+1,0,0,     1,     0,    1,   0,   0, 1,    0,
     18570, 0, 1,   0,0,     0,     0,    1,   0,   0, 0,    0,
     18580, 1, 0,   1,1,     3,     3B+1, 0,   1,   1, 1,    0;
    18591859option(prot,mem);
    18601860
  • Singular/LIB/mondromy.lib

    r2dd32e r337919  
    11///////////////////////////////////////////////////////////////////////////////
    2 version="$Id: mondromy.lib,v 1.19 2000-12-22 15:30:39 greuel Exp $";
     2version="$Id: mondromy.lib,v 1.20 2001-01-11 17:12:59 Singular Exp $";
    33category="Singularities";
    44info="
     
    66AUTHOR:   Mathias Schulze, email: mschulze@mathematik.uni-kl.de
    77
    8 OVERVIEW: 
    9  A library to compute the monodromy of an isolated hypersurface singularity. 
    10  It uses an algorithm by Brieskorn (manuscripta math. 2 (1970), 103-161) to 
    11  compute a connection matrix of the meromorphic Gauss-Manin connection up to 
    12  arbitrarily high order, and an algorithm of Gerard and Levelt (Ann. Inst. 
     8OVERVIEW:
     9 A library to compute the monodromy of an isolated hypersurface singularity.
     10 It uses an algorithm by Brieskorn (manuscripta math. 2 (1970), 103-161) to
     11 compute a connection matrix of the meromorphic Gauss-Manin connection up to
     12 arbitrarily high order, and an algorithm of Gerard and Levelt (Ann. Inst.
    1313 Fourier, Grenoble 23,1 (1973), pp. 157-195) to transform it to a simple pole.
    1414
     
    2323          Brieskorn lattice
    2424
    25 SEE ALSO: gaussman.lib
     25SEE ALSO: gaussman_lib
    2626";
    2727
     
    179179      v=v+ui;
    180180    }
    181     v=jet(v,n)/u0;   
     181    v=jet(v,n)/u0;
    182182    dbprint(printlevel-voice+2,"//...inverse computed ["+string(timer-t)+
    183183      " secs, "+string((memory(1)+1023)/1024)+" K]");
  • Singular/LIB/rinvar.lib

    r2dd32e r337919  
    11// Last change 10.12.2000 (TB)
    22///////////////////////////////////////////////////////////////////////////////
    3 version="$Id: rinvar.lib,v 1.5 2000-12-22 14:43:04 greuel Exp $";
     3version="$Id: rinvar.lib,v 1.6 2001-01-11 17:13:00 Singular Exp $";
    44category="Invariant theory";
    55info="
    66LIBRARY:  rinvar.lib      Invariant Rings of Reductive Groups
    7 AUTHOR:   Thomas Bayer,   tbayer@in.tum.de 
     7AUTHOR:   Thomas Bayer,   tbayer@in.tum.de
    88          http://wwwmayr.informatik.tu-muenchen.de/personen/bayert/
    99          Current Adress: Institut fuer Informatik, TU Muenchen
    10 OVERVIEW: 
    11  Implementation based on Derksen's algorithm. Written in the frame of the 
    12  diploma thesis (advisor: Prof. Gert-Martin Greuel) 'Computations of moduli 
     10OVERVIEW:
     11 Implementation based on Derksen's algorithm. Written in the frame of the
     12 diploma thesis (advisor: Prof. Gert-Martin Greuel) 'Computations of moduli
    1313 spaces of semiquasihomogenous singularities and an implementation in Singular'
    1414
     
    3030 TransferIdeal(R,name,nA);      transfer the ideal 'name' from R to basering
    3131
    32 SEE ALSO: qhmoduli.lib, zeroset.lib
     32SEE ALSO: qhmoduli_lib, zeroset_lib
    3333";
    3434
Note: See TracChangeset for help on using the changeset viewer.