Changeset 7a8ca6 in git for Singular


Ignore:
Timestamp:
Feb 25, 2009, 7:51:26 PM (15 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38dfc5131670d387a89455159ed1e071997eec94')
Children:
61944d0a0689203f1f85c43b1610be266ec31371
Parents:
88542405b72b2e4e2770cdf6244a44221f9047a5
Message:
*hannes: format


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

Legend:

Unmodified
Added
Removed
  • Singular/LIB/perron.lib

    r8854240 r7a8ca6  
    11///////////////////////////////////////////////////////////////////////////////
    2 version="$Id: perron.lib,v 1.11 2008-04-23 14:06:10 motsak Exp $";
     2version="$Id: perron.lib,v 1.12 2009-02-25 18:51:26 Singular Exp $";
    33category="Noncommutative";
    44info="
    55LIBRARY:  perron.lib         computation of algebraic dependences
    6 AUTHORS:  Oleksandr Motsak,         {U@D}, where U={motsak}, D={mathematik.uni-kl.de}.
     6AUTHOR:   Oleksandr Motsak
    77
    88PROCEDURES:
     
    2525{
    2626  int N, D, i;
    27 
    2827  N = size(L);
    29 
    3028  if( N == 0 )
    31     {
    32       ERROR( "Input ideal must be non-zero!" );
    33     }
    34 
     29  {
     30    ERROR( "Input ideal must be non-zero!" );
     31  }
    3532  intvec W; // weights
    36 
    3733  for ( i = N; i > 0; i-- )
    38     {
    39       W[i] = deg(L[i]);
    40     }
    41 
     34  {
     35    W[i] = deg(L[i]);
     36  }
    4237  ////////////////////////////////////////////////////////////////////////
    4338  D = -1;
    44 
    4539  // Check whether the degree bound 'D' is given:
    4640  if( size(#)>0 )
     41  {
     42    if ( typeof(#[1]) == typeof(D) )
    4743    {
    48       if ( typeof(#[1]) == typeof(D) )
    49         {
    50           D = #[1];
    51 
    52           if( D <= 0 )
    53             {
    54               ERROR( "An optional parameter D must be positive!" );
    55             }
    56         }
     44      D = #[1];
     45      if( D <= 0 )
     46      {
     47        ERROR( "An optional parameter D must be positive!" );
     48      }
    5749    }
     50  }
    5851
    5952  // , otherwise we try to estimate it according to Perron's Th:
    6053  if( D < 0 )
     54  {
     55    D = 1;
     56    int d;
     57    int min = -1;
     58
     59    for ( i = size(L); i > 0 ; i-- )
    6160    {
    62       D = 1;
    63       int d, min;
    64 
    65       min = -1;
    66 
    67       for ( i = size(L); i > 0 ; i-- )
     61      d = W[i];
     62      D = D * d;
     63      if( min == -1)
     64      {
     65        min = d;
     66      }
     67      else
     68      {
     69        if( min > d )
    6870        {
    69           d = W[i];
    70 
    71           D = D * d;
    72           if( min == -1)
    73             {
    74               min = d;
    75             } else
    76               {
    77                 if( min > d )
    78                   {
    79                     min = d;
    80                   }
    81               }
     71          min = d;
    8272        }
    83 
    84       if( (D == 0) or (min <= 0) )
    85         {
    86           ERROR( "Wrong set of polynomials!" );
    87         }
    88 
    89       D = D / min;
    90 
     73      }
    9174    }
    92 
     75    if( (D == 0) or (min <= 0) )
     76    {
     77      ERROR( "Wrong set of polynomials!" );
     78    }
     79    D = D / min;
     80  }
    9381  ////////////////////////////////////////////////////////////////////////
    94 
    9582  def NCRING = basering;
    96 
    9783  def CurrentField = ringlist( NCRING )[1];
    98 
    99 //  CurrentField;
    10084
    10185  // We are going to construct a commutative ring in N variables F(i),
     
    10387
    10488  ring TEMPRING = 0, ( F(1..N) ), dp;
    105 
    10689  list RingList = ringlist( TEMPRING );
    107 
    10890  setring NCRING;
    109 
    11091
    11192  if( !defined(RingList) )
     
    11394    list RingList = imap( TEMPRING, RingList );
    11495  }
    115 
    116 
    11796  RingList[1] = CurrentField;
    118 
    119 //  RingList;
    12097
    12198  // New Commutative Ring with correct field!
     
    147124
    148125  if( (typeof(T) != "module") and (typeof(T) != "int" ) )
     126  {
     127    ERROR( "Wrong output from function 'linearMapKernel'!" );
     128  }
     129
     130  if( typeof(T) == "int" )
     131  {
     132    t = 1;
     133    if( T != 0 )
    149134    {
    150135      ERROR( "Wrong output from function 'linearMapKernel'!" );
    151136    }
    152 
    153   if( typeof(T) == "int" )
    154     {
    155       t = 1;
    156       if( T != 0 )
    157         {
    158           ERROR( "Wrong output from function 'linearMapKernel'!" );
    159         }
    160     }
     137  }
    161138
    162139  ////////////////////////////////////////////////////////////////////////
     
    168145
    169146  if( t == 0 ) // T is a module
    170     {
    171       module KER = imap( NCRING, T );
    172       Relations = linearCombinations( PBWBasis, KER );
    173 
    174     } else
    175       { // T == int(0) => all images are zero =>
    176         Relations = PBWBasis;
    177       }
    178 
     147  {
     148    module KER = imap( NCRING, T );
     149    Relations = linearCombinations( PBWBasis, KER );
     150  }
     151  else
     152  { // T == int(0) => all images are zero =>
     153    Relations = PBWBasis;
     154  }
    179155
    180156  ////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.