Changeset 0e200a in git


Ignore:
Timestamp:
Feb 18, 2005, 6:38:45 PM (18 years ago)
Author:
Viktor Levandovskyy <levandov@…>
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
b9e6b3a8fbdac60181ba5817714b3bde3734cdff
Parents:
041f605161d1a76a1c84079b6ca824b4fe4902a3
Message:
*levandov: changes from Markus - option set, smith fixes, RightInverse added


git-svn-id: file:///usr/local/Singular/svn/trunk@7738 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/control.lib

    r041f60 r0e200a  
    1 version="$Id: control.lib,v 1.20 2005-02-09 19:06:35 levandov Exp $";
     1version="$Id: control.lib,v 1.21 2005-02-18 17:38:45 levandov Exp $";
    22category="Applications";
    33info="
     
    7272LIB "nchomolog.lib";
    7373LIB "gkdim.lib";
     74
    7475//---------------------------------------------------------------
     76static proc Opt_Our()
     77"USAGE: Opt_Our();
     78RETURN: intvec, where previous options are stored
     79PURPOSE: save previous options and set customized options
     80"
     81{
     82  intvec v;
     83  v=option(get);
     84  option(redSB);
     85  option(redTail);
     86  return (v);
     87}
    7588proc declare(string NameOfRing, string Variables, list #)
    7689"USAGE: declare(NameOfRing, Variables,[Parameters, Ordering]);
     
    291304  module Id = freemodule(NCols);
    292305  module N  = transpose(M);
     306  intvec old_opt=Opt_Our();
    293307  Id = std(Id);
    294308  matrix T;
    295   option(redSB);
    296   option(redTail);
    297309  // check the correctness (Id \subseteq M)
    298310  // via dimension: {dim/GKdim} (M) = -1!
     
    315327  T2 =  transpose(T2);
    316328  // set options back
    317   option(noredTail);
     329  option(set,old_opt);
    318330  return(T2);
    319331}
     
    337349};
    338350//-----------------------------------------------------------------------
     351proc RightInverse(module R)
     352{
     353  return(transpose(LeftInverse(transpose(R))));
     354}
     355//-----------------------------------------------------------------------
    339356static proc dim_Our(module R)
    340357{
     
    344361    R = std(R);
    345362  }
    346   if (Is_NC())
    347   {
    348     d = GKdim(R);
    349   }
    350   else { d = dim(R); }
     363  //  if (Is_NC())
     364  //  {
     365  //    d = GKdim(R);
     366  //  }
     367  //  else { d = dim(R); }
     368  d = dim(R);
    351369  return(d);
    352370}
     
    354372static proc Ann_Our(module R)
    355373{
    356   if (Is_NC())
    357   {
    358     // TODO: use preAnn, that is an annihilator of the generators
    359     // what is a left ideal!
    360     return(-1);
    361   }
    362   else
    363   {
    364     return(Ann(R));
    365   }
    366 
     374//   if (Is_NC())
     375//   {
     376//     // TODO: use preAnn, that is an annihilator of the generators
     377//     // what is a left ideal!
     378//     return(-1);
     379//   }
     380//   else
     381//   {
     382//     return(Ann(R));
     383//   }
     384  return(Ann(R));
    367385}
    368386//-----------------------------------------------------------------------
     
    370388// mimicking 'Ext_R' from "homolog.lib" in commutative case
    371389{
    372   int ISNC = Is_NC();
     390  //  int ISNC = Is_NC();
    373391  int ExtraArg = ( size(#)>0 );
    374   if (ISNC)
    375   {
    376     // ExtraArg not yet implemented and thus ignored
    377     return( ncExt_R(i,R) );
    378   }
     392  //  if (ISNC)
     393  //  {
     394  //    // ExtraArg not yet implemented and thus ignored
     395  //    return( ncExt_R(i,R) );
     396  //  }
    379397  // the commutative case:
    380398  if (ExtraArg)
     
    398416};
    399417//------------------------------------------------------------------------
    400 static proc control_output(int i, int NVars, module R, module Ext_1)
     418static proc control_output(int i, int NVars, module R, module Ext_1, list Gen)
     419//static proc control_output(int i, int NVars, module R, module Ext_1)
    401420"USAGE:  control_output(i, NVars, R, Ext_1), where
    402421           i:  integer, number of first nonzero Ext or
     
    410429{
    411430  // TODO: NVars to be replaced with the global hom. dimension of basering!!!
    412   int d = dim_Our( std( transpose(R) ) ); // this is the dimension of the system
    413431  string DofS = "dimension of the system:";
    414432  string Fn   = "number of first nonzero Ext:";
     433  string Gen_mes = "The following parameter constellations might lead to a non-controllable system: ";
     434
     435  module RK = RightKernel(R);
     436  int d=dim_Our(std(transpose(R)));
     437
    415438  if (i==1)
    416439  {
    417     module RK = RightKernel(R);
    418440    return(
    419441            list ( Fn,
     
    434456 
    435457  if(i>NVars)
    436   { module RK = RightKernel(R);
     458  {
    437459    return( list(  Fn,
    438460                   -1,
    439                   "strongly controllable, image representation:",
     461                  "strongly controllable(flat), image representation:",
    440462                   RK,
    441463                  "left inverse to image representation:",
    442464                   LeftInverse(RK),
    443                    DofS,
    444                    d)
     465                   DofS,
     466                   d,
     467                   Gen_mes,
     468                   Gen)
    445469          );
    446470  };
     
    455479                  i,
    456480                 "controllable, not reflexive, image representation:",
    457                   RightKernel(R),
     481                  RK,
    458482                  DofS,
    459                   d )
     483                  d,
     484                  Gen_mes,
     485                  Gen)
    460486          );
    461487  };
     
    466492                   i,
    467493                  "reflexive, not strongly controllable, image representation:",
    468                    RightKernel(R),
     494                   RK,
    469495                   DofS,
    470                    d)
     496                   d,
     497                   Gen_mes,
     498                   Gen)
    471499          );
    472500  }; 
     
    484512  // TODO: NVars to be replaced with the global hom. dimension of basering!!!
    485513  int ExtIsZero;
    486 
    487   module Ext_1 = std(Ext_Our(1,R));
     514  intvec v=Opt_Our();
     515  module R_std=std(R);
     516  module Ext_1 = std(Ext_Our(1,R_std));
     517  //  module Ext_1 = std(Ext_Our(1,R));
    488518   
    489519  ExtIsZero=is_zero_Our(Ext_1);
     
    492522  {
    493523    i++;
    494     ExtIsZero = is_zero_Our( Ext_Our(i,R) );
    495   };
    496  
    497   return( control_output( i, NVars, R, Ext_1 ) );
     524    ExtIsZero = is_zero_Our( Ext_Our(i,R_std) );
     525    //    ExtIsZero = is_zero_Our( Ext_Our(i,R) );
     526  };
     527  matrix T=lift(R,R_std);
     528  list l=genericity(T);
     529  option(set,v);
     530
     531  return( control_output( i, NVars, R, Ext_1, l ) );
     532  //  return( control_output( i, NVars, R, Ext_1 ) );
    498533}
    499534example
     
    509544  view(control(R));
    510545};
     546//------------------------------------------------------------------------------------------
     547proc control2(module R)
     548"USAGE:  control2(R); R a module (R is the matrix of the system of equations which is to be investigated)
     549RETURN:  list of all the properties concerning controllability of the system (behavior) represented by the  matrix R
     550EXAMPLE:  example control; shows an example
     551NOTE: same as control(R); but using dimensions
     552"
     553{
     554  intvec v=option(get);
     555  module R_std=std(R);
     556  int d=dim_Our(R_std);
     557  int NVars=nvars(basering);
     558  int i=NVars-d;
     559  module Ext_1;
     560
     561  if(i==1)
     562    {
     563      Ext_1=std(Ext_Our(1,R_std));
     564    }
     565  matrix T=lift(R,R_std);
     566  list l=genericity(T);
     567  option(set, v);
     568  return( control_output( i, NVars, R, Ext_1, l));
     569}
     570example
     571{"EXAMPLE:";echo = 2;
     572  //Wind Tunnel
     573  ring A = (0,a, omega, zeta, k),(D1, delta),dp;
     574  module R;
     575  R = [D1+a, -k*a*delta, 0, 0],
     576      [0, D1, -1, 0],
     577      [0, omega^2, D1+2*zeta*omega, -omega^2];
     578  R=transpose(R);
     579  view(R);
     580  view(control2(R));
     581};
    511582//------------------------------------------------------------------------
    512 static proc autonom_output( int i, int NVars )
     583static proc autonom_output( int i, int NVars, module RC )
     584//static proc autonom_output( int i, int NVars )
    513585"USAGE:  proc autonom_output(i, NVars)
    514586           i:  integer, number of first nonzero Ext or
     
    527599                   i,
    528600                  "not autonomous",
     601                   "kernel representation for controllable part",
     602                   RC,
    529603                   DofS,
    530604                   d )
     
    564638    return( list(  Fn,
    565639                   i,
    566                   "strongly autonomous,in particular overdetermined",
     640                  "strongly autonomous(fin. dimensional),in particular overdetermined",
    567641                   DofS,
    568642                   d)
     
    590664  int d;
    591665  int NVars = nvars(basering);
    592   R = transpose(R);
    593   d = dim_Our( std(R) );
    594   return( autonom_output(NVars-d,NVars) );
     666//   R = transpose(R);
     667//   d = dim_Our( std(R) );
     668//   return( autonom_output(NVars-d,NVars) );
     669  module RT = transpose(R);
     670  module RC;  //for computation of controllable part if if exists
     671  d = dim_Our( std(RT) );  //this is the dimension of the system
     672  int i=NVars-d;  //First non-zero Ext
     673  if(d==0)
     674    {
     675      RC=LeftKernel(RightKernel(R));
     676    }
     677  return( autonom_output(i,NVars,RC) );
    595678}
    596679example
     
    614697{
    615698  int NVars=nvars(basering);
    616   int ExtIsZero;   
    617   R=transpose(R);
    618   ExtIsZero=is_zero_Our(Ext_Our(0,R));
     699  int ExtIsZero;
     700  module RT=transpose(R);
     701  module RC;
     702  ExtIsZero=is_zero_Our(Ext_Our(0,RT));     
     703//   R=transpose(R);
     704//   ExtIsZero=is_zero_Our(Ext_Our(0,R));
    619705  int i=0;
    620706  while( (ExtIsZero)&&(i<=NVars) )
    621707  {
    622708    i++;
    623     ExtIsZero = is_zero_Our(Ext_Our(i,R));
    624   };
    625   return(autonom_output(i,NVars));     
     709    ExtIsZero = is_zero_Our(Ext_Our(i,RT));
     710    //    ExtIsZero = is_zero_Our(Ext_Our(i,R));
     711  };
     712  if(i==0)
     713    {
     714      RC=LeftKernel(RightKernel(R));
     715    }
     716  return(autonom_output(i,NVars,RC));
     717  //  return(autonom_output(i,NVars));     
    626718}
    627719example
     
    904996{
    905997  list M = L;
    906   option(redSB);
    907   option(redTail);
     998  intvec v=Opt_Our();
     999  //  option(redSB);
     1000  //  option(redTail);
    9081001  int s = size(L);
    9091002  int i;
     
    9171010    }
    9181011  }
    919   option(noredTail); // set the initial option back
     1012  option(set, v); //set old values back
     1013  //  option(noredTail); // set the initial option back
    9201014  return(M);
    9211015}
     
    9441038  intvec v;
    9451039  int i,j;            // counter
     1040
     1041  if(N==0)
     1042  {
     1043    v=1,1;
     1044    return(v);
     1045  }
    9461046 
    9471047  for(i=1;i<=n;i++) // hier wird ein Element ausgewaehlt(!=0) und mit dessen Grad gestartet
     
    10151115"
    10161116{
    1017   if (nvars(basering)>1)
     1117  if (nvars(basering)>1) //if more than one variable, return empty list
    10181118    {
    10191119      list @L;
     
    10341134  matrix mu[1][m];             //to save leadcoefficients
    10351135  int ii;                       //counter
    1036   ideal J;                      //for extgcd-computations
    1037   matrix T;                     //----------"------------
    10381136 
    10391137  while ((k!=n) && (k!=m) )   
     
    11091207      L=extgcd(N[k-1,k-1],N[k,k]);  //one can use this line if extgcd-bug is fixed
    11101208     
    1111       //the next lines are needed for the divisibility condition of the entries of the Smith Form
    1112      
    11131209      if(!(N[k-1,k-1]==L[1]))  //means that N[k-1,k-1] is not a divisor of N[k,k]
    11141210        {
Note: See TracChangeset for help on using the changeset viewer.