Changeset 2955ba in git


Ignore:
Timestamp:
Oct 7, 2009, 12:26:11 PM (15 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '4a9821a93ffdc22a6696668bd4f6b8c9de3e6c5f')
Children:
bedecea1bbe3e8a1d0e5a820d4d446733ede75b9
Parents:
cfca59b87c9afcfaf6c14e04e85063f3e85d9934
Message:
*hannes: format


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

Legend:

Unmodified
Added
Removed
  • factory/cf_map.cc

    rcfca59 r2955ba  
    11/* emacs edit mode for this file is -*- C++ -*- */
    2 /* $Id: cf_map.cc,v 1.14 2006-05-15 09:03:04 Singular Exp $ */
     2/* $Id: cf_map.cc,v 1.15 2009-10-07 10:26:11 Singular Exp $ */
    33
    44//{{{ docu
     
    2727{
    2828    if ( this != &p ) {
    29         V = p.V;
    30         S = p.S;
     29        V = p.V;
     30        S = p.S;
    3131    }
    3232    return *this;
     
    6868    int j;
    6969    for ( i = L, j = 1; i.hasItem(); i++, j++ )
    70         P.insert( MapPair( Variable(j), i.getItem() ) );
     70        P.insert( MapPair( Variable(j), i.getItem() ) );
    7171}
    7272//}}}
     
    8282{
    8383    if ( this != &m )
    84         P = m.P;
     84        P = m.P;
    8585    return *this;
    8686}
     
    155155
    156156    if ( j.hasItem() )
    157         if ( j.getItem().var() != f.mvar() ) {
    158             // simply descend if the current MapPair variable is
    159             // not the main variable of f
    160             CanonicalForm result = 0;
    161             CFIterator I;
    162             for ( I = f; I.hasTerms(); I++ )
    163                 result += power( f.mvar(), I.exp() ) * subsrec( I.coeff(), j );
    164             return result;
    165         }
    166         else {
    167             // replace the main variable of f with the image of
    168             // the current variable under MapPair
    169             CanonicalForm result = 0;
    170             CanonicalForm s = j.getItem().subst();
    171             CFIterator I;
    172             // move on to the next MapPair
    173             j++;
    174             for ( I = f; I.hasTerms(); I++ )
    175                 result += subsrec( I.coeff(), j ) * power( s, I.exp() );
    176             return result;
    177         }
     157        if ( j.getItem().var() != f.mvar() ) {
     158            // simply descend if the current MapPair variable is
     159            // not the main variable of f
     160            CanonicalForm result = 0;
     161            CFIterator I;
     162            for ( I = f; I.hasTerms(); I++ )
     163                result += power( f.mvar(), I.exp() ) * subsrec( I.coeff(), j );
     164            return result;
     165        }
     166        else {
     167            // replace the main variable of f with the image of
     168            // the current variable under MapPair
     169            CanonicalForm result = 0;
     170            CanonicalForm s = j.getItem().subst();
     171            CFIterator I;
     172            // move on to the next MapPair
     173            j++;
     174            for ( I = f; I.hasTerms(); I++ )
     175                result += subsrec( I.coeff(), j ) * power( s, I.exp() );
     176            return result;
     177        }
    178178    else
    179         return f;
     179        return f;
    180180}
    181181//}}}
     
    235235    n = i = 1;
    236236    while ( i <= level( f ) ) {
    237         while( degs[i] == 0 ) i++;
    238         if ( i != n ) {
    239             // swap variables and remember the swap in the map
    240             m.newpair( Variable( n ), Variable( i ) );
    241             result = swapvar( result, Variable( i ), Variable( n ) );
    242         }
    243         n++; i++;
     237        while( degs[i] == 0 ) i++;
     238        if ( i != n ) {
     239            // swap variables and remember the swap in the map
     240            m.newpair( Variable( n ), Variable( i ) );
     241            result = swapvar( result, Variable( i ), Variable( n ) );
     242        }
     243        n++; i++;
    244244    }
    245245    delete [] degs;
     
    267267    M = N = CFMap();
    268268    if ( a.size() == 0 )
    269         return;
     269        return;
    270270    int maxlevel = level( a[a.min()] );
    271271    int i, j;
     
    273273    // get the maximum of levels in a
    274274    for ( i = a.min() + 1; i <= a.max(); i++ )
    275         if ( level( a[i] ) > maxlevel )
    276             maxlevel = level( a[i] );
     275        if ( level( a[i] ) > maxlevel )
     276            maxlevel = level( a[i] );
    277277    if ( maxlevel <= 0 )
    278         return;
     278        return;
    279279
    280280    int * degs = new int[maxlevel+1];
    281281    int * tmp = new int[maxlevel+1];
    282282    for ( i = 1; i <= maxlevel; i++ )
    283         degs[i] = 0;
     283        degs[i] = 0;
    284284
    285285    // calculate the union of all levels occuring in a
    286286    for ( i = a.min(); i <= a.max(); i++ ) {
    287         tmp = degrees( a[i], tmp );
    288         for ( j = 1; j <= level( a[i] ); j++ )
    289             if ( tmp[j] != 0 )
    290                 degs[j] = 1;
     287        tmp = degrees( a[i], tmp );
     288        for ( j = 1; j <= level( a[i] ); j++ )
     289            if ( tmp[j] != 0 )
     290                degs[j] = 1;
    291291    }
    292292
     
    294294    i = 1; j = 1;
    295295    while ( i <= maxlevel ) {
    296         if ( degs[i] != 0 ) {
    297             M.newpair( Variable(i), Variable(j) );
    298             N.newpair( Variable(j), Variable(i) );
    299             j++;
    300         }
    301         i++;
     296        if ( degs[i] != 0 ) {
     297            M.newpair( Variable(i), Variable(j) );
     298            N.newpair( Variable(j), Variable(i) );
     299            j++;
     300        }
     301        i++;
    302302    }
    303303    delete [] tmp;
     
    373373    int * degsg = new int[n+1];
    374374
    375     for ( i = 0; i <= n; i++ ) {
    376         degsf[i] = degsg[i] = 0;
     375    for ( i = 0; i <= n; i++ )
     376    {
     377        degsf[i] = degsg[i] = 0;
    377378    }
    378379
     
    382383   
    383384    i = 1; k = 1;
    384     if ( pe > 1 ){
    385         M.newpair( Variable(pe), Variable(k) );
    386         N.newpair( Variable(k), Variable(pe) );
     385    if ( pe > 1 )
     386    {
     387        M.newpair( Variable(pe), Variable(k) );
     388        N.newpair( Variable(k), Variable(pe) );
    387389        k++;
    388390    }
    389     while ( i <= n ) {
    390         if ( degsf[i] > 0 && degsg[i] > 0 ) {
    391             if ( ( i != k ) && ( i != pe ) && ( i != p1 ) ) {
    392                 M.newpair( Variable(i), Variable(k) );
    393                 N.newpair( Variable(k), Variable(i) );
    394             }
    395             k++;
    396         }
    397         i++;
    398     }
    399     if ( p1 != pe ){
    400         M.newpair( Variable(p1), Variable(k) );
    401         N.newpair( Variable(k), Variable(p1) );
     391    while ( i <= n )
     392    {
     393        if ( degsf[i] > 0 && degsg[i] > 0 )
     394        {
     395            if ( ( i != k ) && ( i != pe ) && ( i != p1 ) )
     396            {
     397                M.newpair( Variable(i), Variable(k) );
     398                N.newpair( Variable(k), Variable(i) );
     399            }
     400            k++;
     401        }
     402        i++;
     403    }
     404    if ( p1 != pe )
     405    {
     406        M.newpair( Variable(p1), Variable(k) );
     407        N.newpair( Variable(k), Variable(p1) );
    402408        k++;
    403409    }
    404410    i = 1;
    405     while ( i <= n ) {
    406         if ( degsf[i] > 0 && degsg[i] == 0 ) {
    407             if ( i != k ) {
    408                 M.newpair( Variable(i), Variable(k) );
    409                 k++;
     411    while ( i <= n )
     412    {
     413        if ( degsf[i] > 0 && degsg[i] == 0 ) {
     414            if ( i != k )
     415            {
     416                M.newpair( Variable(i), Variable(k) );
     417                k++;
    410418            }
    411         }
    412         else if ( degsf[i] == 0 && degsg[i] > 0 ) {
    413             if ( i != k ) {
    414                 M.newpair( Variable(i), Variable(k) );
    415                 k++;
     419        }
     420        else if ( degsf[i] == 0 && degsg[i] > 0 )
     421        {
     422            if ( i != k )
     423            {
     424                M.newpair( Variable(i), Variable(k) );
     425                k++;
    416426            }
    417         }
    418         i++;
     427        }
     428        i++;
    419429    }
    420430
  • factory/cf_ops.cc

    rcfca59 r2955ba  
    11/* emacs edit mode for this file is -*- C++ -*- */
    2 /* $Id: cf_ops.cc,v 1.11 2007-12-19 14:26:20 Singular Exp $ */
     2/* $Id: cf_ops.cc,v 1.12 2009-10-07 10:26:11 Singular Exp $ */
    33
    44//{{{ docu
     
    507507//
    508508//}}}
    509 int *
    510 degrees ( const CanonicalForm & f, int * degs )
     509int * degrees ( const CanonicalForm & f, int * degs )
    511510{
    512511    if ( f.inCoeffDomain() )
     
    535534//
    536535//}}}
    537 int
    538 totaldegree ( const CanonicalForm & f )
     536int totaldegree ( const CanonicalForm & f )
    539537{
    540538    if ( f.isZero() )
Note: See TracChangeset for help on using the changeset viewer.